THIS_IMAGE(3) - [COLLECTIVE] Cosubscript index of this image
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
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.
THIS_IMAGE(3) returns the cosubscript for this image.
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.
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).
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_imageResults:
> value[1] is 1
Fortran 2008. With DISTANCE argument, TS 18508
NUM_IMAGES(3), IMAGE_INDEX(3)
Fortran intrinsic descriptions
Nemo Release 3.1 | this_image (3fortran) | November 02, 2024 |