FORM TEAM statement

Standard: F77 F90 F95 F2003 F2008 F2018 Example program


FORM TEAM ( team-number , team-variable [ , form-team-spec ]... )

team-number ::= scalar-integer-expr
The team number value must be positive.

The team-variable must be of type TEAM_TYPE from the intrinsic module ISO_FORTRAN_ENV. Variables of that type are not permitted to be coarrays.

form-team-spec ::= ERRMSG = errmsg-variable
| NEW_INDEX = scalar-integer-expr
| STAT = stat-variable

At most one of each kind of form-team-spec is allowed. A stat-variable must be a non-coindexed scalar Integer variable, and should be able to support values from −9999 to +9999, i.e. it should be at least 16 bits. An errmsg-variable must be a non-coindexed default Character variable. The scalar-integer-expr in NEW_INDEX= must be positive.


The number of subteams that execution of FORM TEAM produces is equal to the number of unique team-number values in that execution; each unique team-number value identifies a subteam in the set, and each image belongs to the subteam whose team number it specified. If NEW_INDEX= appears, it specifies the image number that the image will have in its new subteam, and therefore must be in the range 1 to N, where N is the number of images in that subteam, and must be unique. If NEW_INDEX= does not appear, it is processor-dependent what the image number in the new subteam will be.

All active images in the current team must execute the same FORM TEAM statement.

If STAT= appears and no error occurs, zero is assigned to the stat-variable. If any of the images in the current team has stopped, STAT_STOPPED_IMAGE is assigned to the stat-variable. If no other error occurs, but an image has failed, STAT_FAILED_IMAGE is assigned. If any error other than a stopped or failed image occurs, some other positive value is assigned. If STAT= does not appear and an error occurs, the program will be error-terminated. If both STAT= and ERRMSG= appear, and any error occurs, an explanatory message is assigned to the errmsg-variable.

If no error occurs or the only error is a failed image, there is an implicit synchronisation of all active images and the team-variable becomes defined on those images with a valid team value. If any error other than a failed image occurs, team-variable becomes undefined and there is no guarantee of synchronisation.


CHANGE TEAM construct, ERRMSG= specifier, Image control statements, STAT= specifier