SHMEM_LONGLONG_WAIT_UNTIL(3)
π NAME π
okay so this is the page for SHMEM_LONGLONG_WAIT_UNTIL(3) from the Open MPI manual, and bestie, it's literally the whole family of "wait for a variable on the local processing element (PE) to change" functions, gathered in one place:
shmem_int_wait(3),shmem_int_wait_until(3)shmem_int4_wait(3),shmem_int4_wait_until(3)shmem_int8_wait(3),shmem_int8_wait_until(3)shmem_long_wait(3),shmem_long_wait_until(3)shmem_longlong_wait(3),shmem_longlong_wait_until(3)shmem_short_wait(3),shmem_short_wait_until(3)shmem_wait(3),shmem_wait_until(3)
and their whole entire job is: waits for a variable on the local processing element (PE) to change. periodt. π
β¨ SYNOPSIS β¨
C or C++:
#include <mpp/shmem.h>
void shmem_int_wait(volatile int *var, int value)
void shmem_int_wait_until(volatile int *var, int cond, int value)
void shmem_long_wait(volatile long *var, long value)
void shmem_long_wait_until(volatile long *var, int cond, long value)
void shmem_longlong_wait(volatile long long *var, long long value)
void shmem_longlong_wait_until(volatile long long *var, int cond,
long long value)
void shmem_short_wait(volatile short *var, short value)
void shmem_short_wait_until(volatile short *var, int cond,
short value)
void shmem_wait(volatile long *ivar, long cmp_value)
void shmem_wait_until(volatile long *ivar, int cmp, long value)
Fortran:
INCLUDE "mpp/shmem.fh"
CALL SHMEM_INT4_WAIT(ivar, cmp_value)
CALL SHMEM_INT4_WAIT_UNTIL(ivar, cmp, cmp_value)
CALL SHMEM_INT8_WAIT(ivar, cmp_value)
CALL SHMEM_INT8_WAIT_UNTIL(ivar, cmp, cmp_value)
CALL SHMEM_WAIT(ivar, cmp_value)
CALL SHMEM_WAIT_UNTIL(ivar, cmp, cmp_value)
π DESCRIPTION π
so shmem_wait and shmem_wait_until are out here just waiting for ivar to get changed by a remote write or an atomic swap issued by a different processor. no cap. these routines are your go-to for point-to-point directed synchronization, iykyk.
a call to shmem_wait does not return until some other processor writes a value into ivar β on the waiting processor β that is not equal to cmp_value. π«Ά
a call to shmem_wait_until does not return until some other processor changes ivar so that it satisfies the condition implied by cmp and cmp_value.
this mechanism is so useful when one processor needs to tell another processor that it has completed some action. it's giving "hey bestie, I'm done, you can go now" energy. π
The arguments are as follows:
targetβ the remotely accessible integer data object to be updated on the remote PE. if you're in C/C++, the type oftargetshould match what's implied in the SYNOPSIS section. if you're using the Fortran compiler, it must be of type integer with an element size of 4 bytes forSHMEM_INT4_ADDand 8 bytes forSHMEM_INT8_ADD.valueβ the value to be atomically added totarget. if you're in C/C++, the type ofvalueshould match what's implied in the SYNOPSIS section. if you're in Fortran, it must be of type integer with an element size oftarget.peβ an integer that indicates the PE number upon whichtargetis to be updated. if you're in Fortran, it must be a default integer value.ivarβ a remotely accessible integer variable that is being updated by another PE. if you're in C/C++, the type ofivarshould match what's implied in the SYNOPSIS section. if you're in Fortran,ivarmust be a specific sized integer type based on which function you're calling, like so:shmem_wait,shmem_wait_until: defaultINTEGERshmem_int4_wait,shmem_int4_wait_until:INTEGER*4shmem_int8_wait,shmem_int8_wait_until:INTEGER*8
cmpβ the compare operator that comparesivarwithcmp_value.cmpmust be of type integer. if you're in Fortran, it must be of default kind. if you're in C/C++, the type ofcmpshould match what's implied in the SYNOPSIS section. thesecmpvalues are supported, bestie, memorize them:SHMEM_CMP_EQβ EqualSHMEM_CMP_NEβ Not equalSHMEM_CMP_GTβ Greater thanSHMEM_CMP_LEβ Less than or equal toSHMEM_CMP_LTβ Less thanSHMEM_CMP_GEβ Greater than or equal to
cmp_valueβcmp_valuemust be of type integer. if you're in C/C++, the type ofcmp_valueshould match what's implied in the SYNOPSIS section. if you're in Fortran,cmp_valuemust be an integer of the same size and kind asivar. theshmem_waitroutines return whenivaris no longer equal tocmp_value. theshmem_wait_untilroutines return when the compare condition is true. and that compare condition? it's defined by theivarargument compared withcmp_valueusing the comparison operator,cmp. slay. π
π EXAMPLES π
Example 1: the following call returns when variable ivar is not equal to 100:
INTEGER*8 IVAR
CALL SHMEM_INT8_WAIT(IVAR, INT8(100))
Example 2: the following call to SHMEM_INT8_WAIT_UNTIL is equivalent to the call to SHMEM_INT8_WAIT in example 1:
INTEGER*8 IVAR
CALL SHMEM_INT8_WAIT_UNTIL(IVAR, SHMEM_CMP_NE, INT8(100))
Example 3: the following C/C++ call waits until the sign bit in ivar is set by a transfer from a remote PE:
int ivar;
shmem_int_wait_until(&ivar, SHMEM_CMP_LT, 0);
Example 4: the following Fortran example is in the context of a subroutine:
SUBROUTINE EXAMPLE()
INTEGER FLAG_VAR
COMMON/FLAG/FLAG_VAR
. . .
FLAG_VAR = FLAG_VALUE ! initialize the event variable
. . .
IF (FLAG_VAR .EQ. FLAG_VALUE) THEN
CALL SHMEM_WAIT(FLAG_VAR, FLAG_VALUE)
ENDIF
FLAG_VAR = FLAG_VALUE ! reset the event variable for next time
. . .
END
π¦ See also π¦
intro_shmem(3) shmem_put(3)
bestie if you're stuck on the whole PE/variable-to-change situation, go read these next β they're the β¨iconicβ¨ companions, fr fr.
π Copyright π
2003-2026, The Open MPI Community
and that's a wrap, my love π«Ά the manual page you just read was SHMEM_LONGLONG_WAIT_UNTIL(3) from Open MPI, dropped on Sep 10, 2026 β go forth and wait for your variables to change, you absolute main character. no notes. periodt. πβ¨π
π¦ where this page comes from
- ubuntu stonking: openmpi-doc 5.0.10-6 Β· other
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms