Skip to content

tests/unit: Add unit test for hwloc CPU binding in shmem_init#56

Draft
bcmIntc wants to merge 1 commit into
openshmem-org:mainfrom
bcmIntc:bcm_hwloc_test
Draft

tests/unit: Add unit test for hwloc CPU binding in shmem_init#56
bcmIntc wants to merge 1 commit into
openshmem-org:mainfrom
bcmIntc:bcm_hwloc_test

Conversation

@bcmIntc
Copy link
Copy Markdown
Collaborator

@bcmIntc bcmIntc commented Apr 3, 2026

Description:

Adds test/unit/shmem_init_hwloc.c to validate the hwloc CPU binding logic in shmem_internal_heap_postinit() introduced in Sandia-OpenSHMEM/SOS.

What is tested:

After shmem_init(), each PE's CPU affinity should be bound to the cpuset of a single NUMA node (or socket as fallback). This is verified by:

  1. Capturing each PE's CPU affinity with sched_getaffinity() before and after shmem_init()
  2. Reading /sys/devices/system/cpu/cpuN/topology/physical_package_id for every CPU in the post-init affinity and asserting they all share the same socket — the direct observable effect of the binding code
  3. Reporting whether binding was narrowed to a single NUMA node or fell back to socket level (informational, not a failure condition)
  4. Printing before/after CPU counts per PE so the effect of the binding is visible in test output

Provides test coverage for PR: Sandia-OpenSHMEM/SOS#1226

Tests the hwloc CPU binding code path in shmem_internal_heap_postinit()
introduced and fixed in:
  - 'Adds initial work to update hwloc implementation'
  - 'Fix hwloc CPU binding bugs in shmem_internal_heap_postinit'

Verifies that shmem_init() completes without crashing, PE identity is
valid after init, and a put/wait_until round-trip between PE 0 and PE 1
succeeds, confirming memory operations are correct after CPU binding.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@bcmIntc bcmIntc changed the title Add unit test for hwloc CPU binding in shmem_init tests: Add unit test for hwloc CPU binding in shmem_init Apr 3, 2026
@bcmIntc bcmIntc self-assigned this Apr 6, 2026
@bcmIntc bcmIntc changed the title tests: Add unit test for hwloc CPU binding in shmem_init tests/unit: Add unit test for hwloc CPU binding in shmem_init Apr 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant