Skip to content

Conversation

KADichev
Copy link
Collaborator

@KADichev KADichev commented Mar 1, 2024

While BSC collaboration had an example of compare-and-swap atomics, examples testing and demonstrating these were not in the repo. Here, we provide:

  • new LPF functions lpf_lock_slot and lpf_unlock_slot, which are BLOCKING and lock and unlock global LPF slots. These are implemented in src/MPI/ibverbs.cpp via opcode IB verbs atomic operation compare and swap. The lock slot expects a 0 and swaps it to 1. The unlock slot expects a 1 and swaps it to 1. In both cases, if the expected value is not found, we keep posting and polling until we find the value we expect. Hence, both of these calls are blocking, in contrast to much of the lpf semantics (such as put and get calls).
  • The example testing this makes every rank (including 0) get an exclusive lock on a global slot held at rank 0, increment a global counter held at rank 0 by 1, and release the lock. In the end, we expect the rank 0 to hold the number of ranks in its global counter.

…s. It is added as a functional test to LPF (tests/func_lpf_compare_and_swap.ibverbs.c), with implementation directly added to the backend in src/MPI/ibverbs.cpp, which employs IB Verbs atomics
@KADichev KADichev merged commit ad459e1 into hicr Mar 1, 2024
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