Intel® Fortran Compiler

Developer Guide and Reference

ID 767251
Date 4/28/2026
Public
Document Table of Contents

NOTIFYY WAIT

Statement: Causes the executing image to wait until the specified notify variable has a value at least that of the specified threshold value. The image then decrements the notify variable by the threshold value and continues execution.

NOTIFY WAIT (notify-var [, notify-wait-spec-list])

notify-var

Is a scalar variable of type NOTIFY_TYPE from the intrinsic module ISO_FORTRAN_ENV.

It must not depend on the value of stat-var or err-var.

It cannot be a coindexed variable .

notify-wait-spec-list

Is until-spec

or sync-stat-list

until-spec

Is UNTIL_COUNT= scalar-integer-expression.

sync-stat-list

Is STAT=stat-var

or ERRMSG=err-var

stat-var

Is a scalar integer variable in which the status of the synchronization is stored.

It may not be a coindexed variable.

err-var

Is a scalar default character variable in which explanatory text is stored if an error occurs.

It may not be a coindexed variable.

Each specifier in a notify-wait-spec-list is optional, may appear in any order, and may appear at most once in a sync-stat-list or in a wait-spec-list.

Description

When an image executes a NOTIFY WAIT statement, the following sequence of actions occur:

  • If UNTIL_COUNT is not specified, the threshold value is one; otherwise, it is the maximum value of one and the specified scalar-integer-expression.

  • The image executing the NOTIFY WAIT statement waits until the value of notify-var is equal to or greater than the threshold value; otherwise, an error occurs.

  • If no error condition has occurred, notify-var is atomically decremented by the threshold value.

The value of notify-var is processor dependent if an error occurs during the execution of an NOTIFY WAIT statement.

Execution of an assignment statement whose variable (LHS) has a NOTIFY= specifier is initially unsatisfied. The successful execution of a NOTIFY WAIT statement with a threshold value of n satisfies the first n unsatisfied executions of assignment statements whose NOTIFY=specifier specifies the same notify variable as the NOTIFY WAIT statement.

stat-var is assigned a value of zero if the execution of the NOTIFY WAIT statement is successful; otherwise, it is assigned a positive integer value different than that of STAT_STOPPED_IMAGE and STAT_FAILED_IMAGE from ISO_FORTRAN_ENV if an error occurs.

Error termination is initiated if an error occurs during the execution of a NOTIFY WAIT statement with no STAT= specifier.

An assignment statement with a NOTIFY= specifier and a NOTIFY WAIT statement differs from the similar sequence:

! On images other than image N
a[n] = x + y
EVENT POST (nx[n])

! On image N
EVENT WAIT (nx)
b = a

in that the notify operation can be incorporated into the same data packet as the value of a, and also that the synchronization is only on this particular data transfer and not all outstanding memory operations on the image. In other words

! On images other than image N
a[n,NOTIFY=nx] = x + y

! On image N
NOTIFY WAIT (nx)
b = a

does not constitute segment ordering and the NOTIFY WAIT statement is not an image control statement. The notify variable modification semantics are like those of atomic operations with regard to segment ordering.

Example

The following example shows the use of a NOTIFY= specifier in an image selector and a NOTIFY WAIT statement to synchronize each image with its left and right neighbor. Image 1 and image NUM_IMAGES() treat each other as left and right neighbors, conceptually laying the images out in a circle.

SUBROUTINE sub
USE, INTRINSIC     :: ISO_FORTRAN_ENV
TYPE(NOTIFY_TYPE)  :: notify_var[*]
REAL,DIMENSION(10) :: arr[*]
REAL,DIMENSION(10) :: a, b
INTEGER            :: i
INTEGER            :: me, next
...
me = (THIS_IMAGE)

IF (me == NUM_IMAGES()) THEN
  next = 1
ELSE 
  next = me + 1
END IF 

DO i = 1, 10
    arr(i) [next, NOTIFY=notify_var] = a(i) * b(i)
END DO

NOTIFY WAIT (notify_var, UNTIL_COUNT = 10)
PRINT *, arr
END SUGROUTINE

The assignment statement in the DO loop assigns the value a(i) * b(i) to arr(i) on the adjacent image, and increments the notify variable notify_var on that image. After the loop has terminated, the executing image waits until 10 values have been written to its local coarray, arr, before the PRINT statement can execute. When the NOTIFY WAIT statement is satisfied, the image's local notify-var is decremented by 10.