SYNC IMAGES statement

Standard: F77 F90 F95 F2003 F2008 F2018 Example program


<Syntax>

SYNC IMAGES ( expression [ , sync-stat ]... )
SYNC IMAGES ( * [ , sync-stat ]... )
sync-stat ::= STAT = stat-variable | ERRMSG = errmsg-variable

The expression must be Integer, and either scalar or a vector (array with rank one); each value must be in the range one to NUM_IMAGES().

<Semantics>

In multiple image execution of a coarray program, execution of a SYNC IMAGES ( expression ) statement synchronises with corresponding SYNC IMAGES statement executions on the images whose indexes are listed in the expression. Including the invoking image number in the list has no effect. The segment following the nth execution of a SYNC IMAGES statement on image number I with the value J in its expression follows the segments on image J before its nth execution of SYNC IMAGES with I in its expression.

The effect of SYNC IMAGES (*) is exactly the same as with an expression listing every image, e.g. SYNC IMAGES ( [ (i,i=1,NUM_IMAGES()) ] ).

If the STAT= clause is present, zero is assigned to the stat-variable if no error occurs, and a positive value if an error occurs. If the ERRMSG= clause is present and an error occurs, the errmsg-variable is assigned an explanatory message; it remains unchanged if no error occurs.

<Related>

ERRMSG= specifier, Image control statements, STAT= specifier, SYNC ALL statement, SYNC TEAM statement