') + ')', 'gi'); if (regex.test(text)) { found = true; var frag = document.createDocumentFragment(); var parts = text.split(regex); parts.forEach(function(part, i) { if (i % 2 === 0) { frag.appendChild(document.createTextNode(part)); } else { var span = document.createElement('span'); span.className = 'userscript-highlight'; span.textContent = part; frag.appendChild(span); } }); node.parentNode.replaceChild(frag, node); } }); } else if (node.nodeType === 1 && node.childNodes) { // element var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT']; if (!skipTags.includes(node.tagName)) { Array.from(node.childNodes).forEach(highlight); } } } highlight(document.body); // Re-highlight on dynamic content var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1 || node.nodeType === 3) highlight(node); }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ', 'i'); if (__m === '*' || __re.test(location.href)) { // Strip utm_, fbclid, gclid, etc. from all links on page (function() { var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content', 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid', 'ref', 'ref_src', 'source', 'medium', 'campaign']; function cleanUrl(url) { try { var u = new URL(url, window.location.origin); var changed = false; trackingParams.forEach(function(p) { if (u.searchParams.has(p)) { u.searchParams.delete(p); changed = true; } }); return changed ? u.toString() : url; } catch (e) { return url; } } function cleanLinks() { document.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } cleanLinks(); var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1) { if (node.tagName === 'A') cleanLinks(); node.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + ', 'i'); if (__m === '*' || __re.test(location.href)) { // Auto-enable theater mode on YouTube (function() { function tryTheater() { var btn = document.querySelector('button[aria-label="Theater mode"], ytd-player #player button[title="Theater mode"]'); if (btn && !btn.classList.contains('activated')) { btn.click(); } } // Try immediately tryTheater(); // Try after navigation (SPA) var lastUrl = location.href; setInterval(function() { if (location.href !== lastUrl) { lastUrl = location.href; setTimeout(tryTheater, 500); } }, 1000); // Also try on player load var observer = new MutationObserver(tryTheater); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ', 'i'); if (__m === '*' || __re.test(location.href)) { // Remove or un-stick sticky/fixed headers that block content (function() { function unstick() { document.querySelectorAll('header, nav, [role="banner"], .header, .navbar, .sticky, .fixed-top, [style*="position: fixed"], [style*="position:sticky"]').forEach(function(el) { if (el.style.position === 'fixed' || el.style.position === 'sticky' || getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') { el.style.position = 'static'; el.style.top = 'auto'; el.style.zIndex = 'auto'; } }); } unstick(); var observer = new MutationObserver(unstick); observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] }); })(); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); })(); Fix GPU with cgroups devices by wpoely86 · Pull Request #429 · adaptivecomputing/torque · GitHub
Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 8 additions & 56 deletions src/resmom/mom_main.c
Original file line numberDiff line numberDiff line change
Expand Up@@ -4680,8 +4680,8 @@ void recover_internal_layout()
}
#endif

#ifdef PENABLE_LINUX_CGROUPS
int cg_initialize_hwloc_topology()
#if defined(PENABLE_LINUX26_CPUSETS) || defined(PENABLE_LINUX_CGROUPS)
int initialize_hwloc_topology()
{
/* load system topology */
if ((hwloc_topology_init(&topology) == -1))
Expand All@@ -4705,56 +4705,13 @@ int cg_initialize_hwloc_topology()
hwloc_free_xmlbuffer(topology, xml_buf);
#endif

#ifdef PENABLE_LINUX_CGROUPS
read_all_devices();

unsigned long flags = HWLOC_TOPOLOGY_FLAG_WHOLE_SYSTEM;
flags |= HWLOC_TOPOLOGY_FLAG_IO_DEVICES;

#ifdef NVIDIA_GPUS
/* Include IO devices (i.e. PCI devices) when loading topology information.
* Currently, HWLOC_TOPOLOGY_FLAG_IO_DEVICES is only required for NVIDIA GPU detection.
* HWLOC_TOPOLOGY_FLAG_IO_DEVICES was introduced in hwloc 1.3. If NVIDIA_GPUS is defined
* --enable-nvidia-gpus was used, which requires hwloc 1.9 or later.
*/
flags |= HWLOC_TOPOLOGY_FLAG_IO_DEVICES;
#endif

if ((hwloc_topology_set_flags(topology, flags) != 0))
{
log_err(-1, msg_daemonname, "Unable to configure machine topology");
return(-1);
}

if ((hwloc_topology_load(topology) == -1))
{
log_err(-1, msg_daemonname, "Unable to load machine topology");
return(-1);
}

sprintf(log_buffer, "machine topology contains %d sockets %d memory nodes, %d cores %d cpus",
hwloc_get_nbobjs_by_type(topology, HWLOC_OBJ_SOCKET),
hwloc_get_nbobjs_by_type(topology, HWLOC_OBJ_NODE),
hwloc_get_nbobjs_by_type(topology, HWLOC_OBJ_CORE),
hwloc_get_nbobjs_by_type(topology, HWLOC_OBJ_PU));
log_record(PBSEVENT_SYSTEM, PBS_EVENTCLASS_SERVER, __func__, log_buffer);

return(PBSE_NONE);
}
#endif

#ifdef PENABLE_LINUX26_CPUSETS
int initialize_hwloc_topology()
{
/* load system topology */
if ((hwloc_topology_init(&topology) == -1))
{
log_err(-1, msg_daemonname, "Unable to init machine topology");
return(-1);
}

unsigned long flags = HWLOC_TOPOLOGY_FLAG_WHOLE_SYSTEM;

#ifdef NVIDIA_GPUS
#if defined(NVIDIA_GPUS) || defined(PENABLE_LINUX_CGROUPS)
/* Include IO devices (i.e. PCI devices) when loading topology information.
* Currently, HWLOC_TOPOLOGY_FLAG_IO_DEVICES is only required for NVIDIA GPU detection.
* HWLOC_TOPOLOGY_FLAG_IO_DEVICES was introduced in hwloc 1.3. If NVIDIA_GPUS is defined
Expand DownExpand Up@@ -5145,23 +5102,18 @@ int setup_program_environment(void)
log_record(PBSE_NONE,PBS_EVENTCLASS_SERVER,msg_daemonname,log_buffer);
}

#ifdef PENABLE_LINUX26_CPUSETS

#if defined(PENABLE_LINUX26_CPUSETS) || defined(PENABLE_LINUX_CGROUPS)
rc = initialize_hwloc_topology();
if (rc != PBSE_NONE)
exit(rc);
#endif

#ifdef PENABLE_LINUX26_CPUSETS
internal_layout = node_internals();

#endif

#ifdef PENABLE_LINUX_CGROUPS
#ifndef PENABLE_LINUX26_CPUSETS
/* If cpusets are enabled initialization has already been done */
ret = cg_initialize_hwloc_topology();
if (ret != PBSE_NONE)
exit(ret);
#endif

this_node.initializeMachine(topology);
ret = trq_cg_initialize_hierarchy();
if (ret != PBSE_NONE)
Expand Down