SHMEM_LONG_WAIT_UNTIL(3)
π NAME π
okay so this is the shmem_long_wait_until(3) page from Open MPI, bestie β¨ and it's actually a whole friend group, not a solo act. Every single one of these is a way to wait for a variable on the local processing element (PE) to change π:
shmem_int_wait <#shmem-int-wait>(3)shmem_int_wait <#shmem-int-wait>(3)_untilshmem_int4_wait(3)shmem_int4_wait(3)_untilshmem_int8_wait(3)shmem_int8_wait(3)_untilshmem_long_wait <#shmem-long-wait>(3)shmem_long_wait <#shmem-long-wait>(3)_untilshmem_longlong_wait <#shmem-longlong-wait>(3)shmem_longlong_wait <#shmem-longlong-wait>(3)_untilshmem_short_wait <#shmem-short-wait>(3)shmem_short_wait <#shmem-short-wait>(3)_untilshmem_wait <#shmem-wait>(3)shmem_wait <#shmem-wait>(3)_until
like. the whole squad showed up. no cap π
β¨ 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)
copy these exactly, bestie, the compiler is NOT forgiving π«Ά
πΈ DESCRIPTION πΈ
shmem_wait <#shmem-wait> and shmem_wait_until <#shmem-wait-until> are out here waiting for ivar to get changed by a remote write or an atomic swap issued by a different processor. yes. another PE has to do it. you cannot do it to yourself, this is not that kind of party π
These routines are for point-to-point directed synchronization β aka "hey bestie, tell me when you're done" energy.
So here's the vibe:
- A call to
shmem_wait <#shmem-wait>does not return until some other processor writes a value intoivaron the waiting processor that is not equal tocmp_value. - A call to
shmem_wait_until <#shmem-wait-until>does not return until some other processor changesivarso that it satisfies the condition implied bycmpandcmp_value.
This mechanism is literally iconic when a processor needs to tell another processor that it has completed some action. it's giving "i'm done, you may proceed" π
π The arguments
okay bestie, quick heads up: the original page liststarget,valueandpehere too, so we're keeping them, no skipping, that's the rule π
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 the SYNOPSIS says. If you're on a Fortran compiler, it must be of typeintegerwith an element size of 4 bytes forSHMEM_INT4_ADDand 8 bytes forSHMEM_INT8_ADD.valueβ The value to be atomically added totarget. In C/C++, the type ofvalueshould match what the SYNOPSIS says. In Fortran, it must be of typeintegerwith an element size oftarget.peβ An integer that indicates the PE number upon whichtargetis to be updated. In Fortran, it must be a defaultintegervalue.ivarβ A remotely accessible integer variable that is being updated by another PE. In C/C++, the type ofivarshould match what the SYNOPSIS says. In Fortran,ivarmust be a specific sized integer type according to the function being called, like this:shmem_wait <#shmem-wait>,shmem_wait_until <#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 typeinteger. In Fortran it must be of default kind. In C/C++ the type ofcmpshould match what the SYNOPSIS says. Here are the supportedcmpvalues, slay: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 typeinteger. In C/C++, the type ofcmp_valueshould match what the SYNOPSIS says. In Fortran,cmp_valuemust be an integer of the same size and kind asivar. Theshmem_wait <#shmem-wait>routines return whenivaris no longer equal tocmp_value. Theshmem_wait_until <#shmem-wait-until>routines return when the compare condition is true. That compare condition is defined by theivarargument compared withcmp_valueusing the comparison operator,cmp. periodt π
π¦ 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 π
obviously go read these next, bestie, iykyk:
intro_shmem(3)shmem_put(3)
π Copyright
2003-2026, The Open MPI Community
and that's the whole page, bestie π«Ά this was Open MPI's SHMEM_LONG_WAIT_UNTIL(3), dated Sep 10, 2026, and you ate every single word of it. mwah π
β¨
π¦ 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