# SYNC ALL

Statement: Performs a synchronization of all images on the current team.

The SYNC ALL statement takes the following form:

SYNC ALL[([STAT=stat-var][, ERRMSG=err-var])]

stat-var | Is a scalar integer variable in which the status of the synchronization is stored.
err-var | Is a scalar default character variable in which an error condition is stored if such a condition occurs.

STAT= and ERRMSG= can appear in either order, but only once in a SYNC ALL statement.

## Description

Execution on an image, for example, C, of the segment following the SYNC ALL statement is delayed until each other image has executed a SYNC ALL statement as many times as has image C.

The segments that executed before the SYNC ALL statement on an image, precede the segments that execute after the SYNC ALL statement on another image.

## Example

In the following example, image 5 reads data and transmits the data to other images:

    REAL :: W[*]
    SYNC ALL
    IF (THIS_IMAGE()==5) THEN
       READ (*,*) W
       DO I = 6, NUM_IMAGES()
          W[I] = W
       END DO
    END IF
    ...
    SYNC ALL

Parent topic: S

## See Also

Image Control Statements
Coarrays
Using Coarrays