Manual Reference Pages  - this_image (3fortran)

NAME

THIS_IMAGE(3) - [COLLECTIVE] Cosubscript index of this image

SYNOPSIS

result = this_image() | = this_image(distance) | = this_image(coarray,dim)

       integer function this_image( distance ,coarray, dim )

type(TYPE(kind=**)),optional :: coarray[*] integer,intent(in),optional :: distance integer,intent(in),optional :: dim

CHARACTERISTICS

o a kind designated as ** may be any supported kind for the type
o COARRAY can be of any type. If DIM is present it is required.
o DISTANCE is not permitted together with COARRAY
o if DIM if present, coarray is required.

DESCRIPTION

THIS_IMAGE(3) returns the cosubscript for this image.

OPTIONS

o DISTANCE : Nonnegative scalar integer (not permitted together with COARRAY).
o COARRAY : if DIM present, required).
o DIM : If present, DIM shall be between one and the corank of COARRAY.

RESULT

Default integer. If COARRAY is not present, it is scalar; if DISTANCE is not present or has value 0, its value is the image index on the invoking image for the current team, for values smaller or equal distance to the initial team, it returns the image index on the ancestor team which has a distance of DISTANCE from the invoking team. If DISTANCE is larger than the distance to the initial team, the image index of the initial team is returned. Otherwise when the COARRAY is present, if DIM is not present, a rank-1 array with corank elements is returned, containing the cosubscripts for COARRAY specifying the invoking image. If DIM is present, a scalar is returned, with the value of the DIM element of THIS_IMAGE(COARRAY).

EXAMPLES

Sample program:

    program demo_this_image
    implicit none
    integer :: value[*]
    integer :: i
       value = this_image()
       sync all
       if (this_image() == 1) then
          do i = 1, num_images()
             write(*,’(2(a,i0))’) ’value[’, i, ’] is ’, value[i]
          end do
       endif
    end program demo_this_image

Results:

       value[1] is 1

STANDARD

Fortran 2008. With DISTANCE argument, TS 18508

SEE ALSO

NUM_IMAGES(3), IMAGE_INDEX(3)

fortran-lang intrinsic descriptions


Nemo Release 3.1 this_image (3fortran) April 28, 2024
Generated by manServer 1.08 from 57b6d677-1693-46f4-8f1d-63dac4ba4164 using man macros.