Skip to content

tests/unit: add hierarchical_barrier correctness test#62

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

tests/unit: add hierarchical_barrier correctness test#62
bcmIntc wants to merge 1 commit into
openshmem-org:mainfrom
bcmIntc:bcm_hierarchical_barrier_test

Conversation

@bcmIntc
Copy link
Copy Markdown
Collaborator

@bcmIntc bcmIntc commented Apr 30, 2026

Summary

  • Adds test/unit/hierarchical_barrier.c, a four-subtest correctness suite for shmem_barrier_all() targeting the hierarchical barrier introduced by
    --enable-hierarchical-barrier in the SOS library. The test is also valid and meaningful on non-hierarchical builds.
  • write_visibility: each PE puts its PE number to its right neighbor then barriers; verifies the remote write is visible on return. Catches barriers that return before
    all puts are globally visible.
  • successive_barriers: 8 back-to-back put+barrier+verify rounds per iteration. Stresses pSync slot reset — specifically the race where a signal from call N+1 arrives
    before call N's slot is cleared, causing a hang or spurious early completion.
  • asymmetric_arrival: even PEs spin before entering the barrier, odd PEs enter immediately. Verifies correct completion under staggered arrival, which exercises the
    tree gather path under real timing skew.
  • atomic_counter: all PEs atomically increment a counter on PE 0 each iteration; PE 0 verifies the cumulative total equals npes * loop after each barrier. Catches lost
    updates that would indicate CPU/NIC coherency hazards or barrier ordering failures.

Test plan

  • Build without --enable-hierarchical-barrier and confirm all four subtests pass (baseline correctness)
  • Build with --enable-hierarchical-barrier and confirm all four subtests pass
  • Run at small scale (2 PEs, same node) — exercises the single-node degenerate path
  • Run at PPN >= 64, 2+ nodes — exercises the full three-phase hierarchical path
  • Run with -l 1000 to stress pSync reset under rapid successive calls
  • Run with -v to confirm per-subtest pass/fail output is readable

Four-subtest correctness suite for shmem_barrier_all():
write visibility, successive barriers (pSync reset stress),
asymmetric PE arrival, and atomic counter consistency across rounds.

Valid on any build; specifically targets the hierarchical barrier
enabled by --enable-hierarchical-barrier.

Usage: hierarchical_barrier [-v] [-l <loops>]

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@bcmIntc bcmIntc force-pushed the bcm_hierarchical_barrier_test branch from 3778cac to b6c8ea8 Compare May 1, 2026 12:24
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