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

TEAM_NUMBER

Transformational Intrinsic Function (Generic): Returns the team number of the specified team.

Syntax

result = TEAM_NUMBER ([ team ])

team

(Optional, Input) Must be of type TEAM_TYPE defined in the intrinsic module ISO_FORTRAN_ENV, with a value that describes the current team or an ancestor team. If team is not specified, the team is the current team.

Results

The result is an integer scalar whose value is -1 if the specified team is the initial team; otherwise, it is the positive integer value that identifies the team of the executing image in the set of teams described by the team.

Example

Consider the following program:

  PROGRAM main
  USE, INTRINSIC       :: ISO_FORTRAN_ENV
  TYPE (TEAM_TYPE)     :: original, odd_even
  original = GET_TEAM (CURRENT_TEAM)
  FORM TEAM (2-MOD(THIS_IMAGE(), 2), odd_even)
  CHANGE TEAM (odd_even)
    . . .
    IF((THIS_IMAGE()==1).AND. (TEAM_NUMBER()==2) THEN
      PRINT *, TEAM_NUMBER(original)
      PRINT *, TEAM_NUMBER()
    END IF
    . . . 
  END TEAM
  END PROGRAM
  
  The output of the print statements will be
    -1
     2

The above output assumes there are at least two images in the initial team.

See Also