Intel® Fortran Compiler Classic and Intel® Fortran Compiler Developer Guide and Reference

ID 767251
Date 3/22/2024
Public
Document Table of Contents

SYNC TEAM

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

Syntax

The SYNC TEAM statement takes the following form:

SYNC TEAM(team-value [, STAT = stat-var] [, ERRMSG = err-var])

team-value

Identifies the team to synchronize.

stat-var

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

err-var

(Optional) Is a scalar default character variable in which an error condition is stored if such a condition exists.

STAT= and ERR= can appear in any order, but each can appear at most once in a SYNC TEAM statement.

Description

A SYNC TEAM statement performs a synchronization of all images on the specified team. The team specified must be the current team or an ancestor team, or a team whose parent is the current team. The executing image must be a member of the specified team.

Execution of the segment following the SYNC TEAM statement is delayed on all images of the specified team until all images of the specified team have executed the same SYNC TEAM statement the same number of times.

A SYNC TEAM statement synchronizes a specific team, while a SYNC ALL statement synchronizes the current team.

Example

In the following example, two teams are created by the FORM TEAM statement. Team number 1 consists of the odd numbered images of the initial team; team number 2 consists of the even numbered images of the initial team.

The SYNC TEAM statement when executed by an odd numbered image on the initial team prevents all other odd numbered images of the initial team from proceeding to segment 2 until all odd images of the initial team have executed the SYNC TEAM statement. Similarly, all even numbered images of the initial team are prevented from executing segment 2 until all the even numbered images on the initial team have executed the SYNC TEAM statement.

Using a SYNC ALL statement would prevent all images of the initial team from executing segment 2 until all images had executed the SYNC ALL statement.

   PROGRAM MAIN
   USE ISO_FORTRAN_ENV
   TYPE (TEAM_TYPE) odd_even
   FORM TEAM (2-MOD (THIS_IMAGE(), 2), odd_even)
      ! Segment 1
   SYNC TEAM (odd_even)
      ! Segment 2
   END PROGRAM