Intel® Fortran Compiler 17.0 Developer Guide and Reference
Transformational Intrinsic Function (Generic): Returns cosubscripts for the image.
result = THIS_IMAGE ([coarray [, dim]])
coarray |
(Input; optional) Must be a coarray; it can be of any type. If it is allocatable, it must be allocated. |
dim |
(Input; optional) Must be a default integer scalar. Its value must be in the range 1 <= dim <= n, where n is the corank of coarray. The corresponding actual argument must not be an optional dummy argument. |
The result type is default integer. It is scalar if coarray does not appear or dim is present; otherwise, the result has rank one and its size is equal to the corank of coarray.
The result depends on which arguments are specified:
If no argument is specified, as in THIS_IMAGE ( ), the result is a scalar with a value equal to the index of the invoking image.
If only coarray is specified, the result is the sequence of cosubscript values for coarray that would specify the invoking image.
If coarray and dim are specified, the result is the value of cosubscript dim in the sequence of cosubscript values for coarray that would specify the invoking image.
Consider that coarray C is declared by the following statement:
REAL C(5, 10) [10, 0:9, 0:*]
On image 5, THIS_IMAGE ( ) has the value 5 and THIS IMAGE (C) has the value [5, 0, 0]. For the same coarray on image 213, THIS_IMAGE (C) has the value [3, 1, 2].
In the following example, image 1 is used to read data. The other images then copy the data:
IF (THIS_IMAGE()==1) READ (*,*) P
SYNC ALL
P = P[1]