SHMEM_WAIT(3) | Open MPI | SHMEM_WAIT(3) |
shmem_int_wait(3), shmem_int_wait(3)_until, shmem_int4_wait(3), shmem_int4_wait(3)_until, shmem_int8_wait(3), shmem_int8_wait(3)_until, shmem_long_wait(3), shmem_long_wait(3)_until, shmem_longlong_wait(3), shmem_longlong_wait(3)_until, shmem_short_wait(3), shmem_short_wait(3)_until, shmem_wait(3), shmem_wait(3)_until - Waits for a variable on the local processing element (PE) to change
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)
shmem_wait and shmem_wait_until wait for ivar to be changed by a remote write or atomic swap issued by a different processor. These routines can be used for point-to- point directed synchronization. A call to shmem_wait does not return until some other processor writes a value, not equal to cmp_value, into ivar on the waiting processor. A call to shmem_wait_until does not return until some other processor changes ivar to satisfy the condition implied by cmp and cmp_value. This mechanism is useful when a processor needs to tell another processor that it has completed some action.
The arguments are as follows:
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
May 26, 2022 | 4.1.4 |