Update hwloc CPU Binding Implementation#1226
Draft
bcmIntc wants to merge 1 commit into
Draft
Conversation
a1feea1 to
4fe8faa
Compare
c3476b5 to
0292757
Compare
…policies
Removes the HWLOC_ENFORCE_SINGLE_SOCKET / HWLOC_ENFORCE_SINGLE_NUMA_NODE
compile-time flags that unconditionally narrowed each PE's CPU affinity
mask at startup, overriding any binding set by the job launcher.
Replaces them with SHMEM_CPU_PLACEMENT_POLICY (default: none), a runtime
env var that lets users opt in to a specific placement strategy:
none - no changes; launcher owns CPU affinity entirely (default)
best-memory - bind CPUs to the NUMA node of the PE's current location
numa-local - alias for best-memory
socket-local - bind CPUs to the socket of the PE's current location
balanced-numa - round-robin PEs across NUMA nodes by local rank;
also sets memory binding via hwloc_set_membind
best-network - bind CPUs to the NUMA domain of the assigned NIC;
applied in transport_ofi.c after NIC selection
Adds SHMEM_DISABLE_CPU_BINDING (bool, default false) to suppress all
hwloc CPU placement regardless of policy.
The best-network policy is implemented in assign_nic_with_hwloc() in
transport_ofi.c, where the selected NIC's PCI bus attributes are already
in scope. All other policies are applied in a new apply_cpu_placement()
helper in init.c, called after hwloc_topology_load().
The hwloc topology object is preserved as it is still required by NIC
affinity selection in transport_ofi.c.
0292757 to
9db3d46
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
This PR replaces the previous compile-time-gated hwloc CPU binding in
shmem_internal_heap_postinit()Solution
Replace it with an opt-in system controlled by the new
SHMEM_CPU_PLACEMENT_POLICYenvironment variable (default:none).Available policies:
none(default)best-memory/numa-localsocket-localbalanced-numahwloc_set_membindbest-networkassign_nic_with_hwloc()after NIC selectionSHMEM_DISABLE_CPU_BINDING=truesuppresses all placement regardless of policy. The hwloc topologyinitialization is preserved as it is still required by NIC affinity selection in
transport_ofi.c.Files changed
src/init.c— removed old rebind logic; addedapply_cpu_placement()dispatching on policy namesrc/shmem_env_defs.h— addedSHMEM_CPU_PLACEMENT_POLICYenv var; updatedSHMEM_DISABLE_CPU_BINDINGdescriptionsrc/transport_ofi.c— addedbest-networkpolicy insideassign_nic_with_hwloc()where PCI topology is already in scopeTest coverage