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

ID 767251
Date 3/31/2023
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

NUM_IMAGES

Transformational Intrinsic Function (Generic): Returns the number of images on the current or specified team.

result = NUM_IMAGES()

result = NUM_IMAGES (team)result = NUM_IMAGES (team_number)

team

(Input) Must be a scalar of type TEAM_TYPE defined in the intrinsic module ISO_FORTRAN_ENV. Fortran 2018 requires the team specified by team to be the current or an ancestor team. ifort accepts any team variable defined by a FORM TEAM statement, and will diagnose use of a team variable which does not describe the current or an ancestor team with a runtime message when the check standard-behavior compiler option is selected.

team_number

(Input) Must be an integer scalar. It must identify the initial team (-1), or a vaild team number of a team created by the same execution of the FORM TEAM statement that created the current team executing the function reference (a sibling of the current team).

Results

The result type is default integer. The result is the number of images on the current or specified team.

If neither team nor team_number are specified, the team is the current team. team and team_number may not both be specified.

You can specify a compiler option or environment variable to modify the number of images. If both are specified, the environment variable setting overrides the compiler option setting.

A compiler option must be specified to enable coarrays. If it is not specified and you use this intrinsic function, an error occurs.

Example

In the following example, image 1 is used to read data. The other images then copy the data:

REAL :: R[*]

IF (THIS_IMAGE()==1) THEN
   READ (7,*) R
   DO I = 2, NUM_IMAGES()
      R[I] = R
   END DO
END IF
SYNC ALL

See Also