Intel® Fortran Compiler 18.0 Developer Guide and Reference

Coarrays

Coarrays and synchronization constructs are defined by the Fortran 2008 Standard and are implemented as Intel® Fortran extensions that support parallel programming using a Single Program Multiple Data (SPMD) model. These features are not available on macOS* systems.

You must specify compiler option [Q]coarray to enable coarrays in your program.

A Fortran program containing coarrays is interpreted as if it were replicated a fixed number of times and all copies were executed asynchronously.

Each replication is called an "image", and each image has its own set of data objects. The number of images is set at run-time, but it can also be set by a compiler option or an environment variable.

The array syntax of Fortran is extended with additional trailing subscripts in square brackets to provide a clear representation of references to data that is spread across images. References without square brackets are to local data, so source code that can run independently is uncluttered. Any appearance of square brackets indicates communication between images.

Usually, each image resides on one processor. However, several images may share a processor and one image can execute on a cluster.

To reference any array variable that is coindexed, a subscript list must be present. If no subscript list is present, then the coindexed object must be a scalar.

Examples

Consider the following statement:

real, dimension(500), codimension[*] :: a,b

This statement declares two objects a and b, each as a coarray. A coarray always has the same shape on each image. In this case, each image has two real coarrays of size 500.

Consider that an image executes the following statement:

a(:) = b(:)[q]

In this case, the coarray b on image q is copied into coarray a on the executing image.

Consider the coindexed reference x[k]. If x is a rank 1 array, this reference to x on image k is incorrect syntax: a subscript list must be present. The correct form is x(:)[k] to access the entire array x on image k. If x is a scalar, then the syntax x[k] is correct.

See Also