Intel® Fortran Compiler XE 13.1 User and Reference Guides

Using Coarrays

Coarrays, a data sharing concept standardized in Fortran 2008, enable parallel processing using multiple copies of a single program. Each copy, called an image, has ordinary local variables and also shared variables called coarrays or covariables. A covariable, which can be either an array or a scalar, is a variable whose storage spans across all the images in the program. In this Partitioned Global Address Space (PGAS) model, each image can access its own piece of a covariable as a local variable and can access those pieces that live on other images using coindices, which are enclosed in square brackets.

Intel® Fortran supports coarray programs that run using shared memory on a multicore or multiprocessor system. With an optional license, coarray programs can also run using distributed memory across a Linux* OS or Windows* OS cluster. Please refer to the product system requirements for further details.

Coarrays are not supported on OS X* systems.

For more information on how to write programs using coarrays, see books on the Fortran 2008 language or the ISO Fortran 2008 standard.

Using Coarray Program Syntax

The additional syntax required by coarrays includes:

Note

ATOMIC_DEFINE and ATOMIC_REF are not supported in this version of Intel® Fortran.

Using the Coarray Compiler Options

You must use the /Qcoarray (Windows* OS) or -coarray (Linux* OS) compiler option to enable the compiler to recognize coarray syntax. If you do not use this compiler option, a program that uses coarray syntax or features produces a compile-time error.

Using /Qcoarrays:shared (Windows* OS) or -coarrays=shared (Linux* OS) causes the underlying Intel® Message Passing Interface (MPI) parallelization to run in a single node environment (multiple cores or processors with shared memory). Using /Qcoarrays:distributed (Windows* OS) or -coarrays=distributed (Linux* OS) requires an Intel® Cluster Toolkit license to be installed and causes the underlying Intel® MPI Library parallelization to run in a multi-node environment (multiple CPUs with distributed memory). Using /Qcoarrays (Windows* OS) or -coarrays (Linux* OS) with no argument is equivalent to running on single node (shared memory).

No special procedure is necessary to run a program that uses coarrays; you simply run the executable file. The underlying parallelization implementation is Intel® MPI Library. Installation of the compiler automatically installs the necessary Intel® MPI run-time libraries to run on shared memory. The Intel® Cluster Toolkit installs the necessary Intel® MPI Library run-time libraries to run on distributed memory. Use of coarray applications with any other MPI implementation, or with OpenMP*, is not supported.

By default, the number of images created is equal to the number of execution units on the current system. You can override that by specifying the option /Qcoarray-num-images:n (Windows* OS) or -coarray-num-images=n (Linux* OS) on the ifort command that compiles the main program. You can also specify the number of images at execution time in an environment variable FOR_COARRAY_NUM_IMAGES.

To take advantage of Intel® MPI Library features in the coarrays environment, you can put the command line segments used by"mpiexec -config filename" into a file named filename and pass it to Intel® MPI Library with the /Qcoarray-config-file:filename (Windows* OS) or -coarray-config-file=filename (Linux* OS).

In most cases, you will not need to use the config-file option. Use of the config-file option is appropriate only in a limited number of cases; for instance, if you need to invoke some feature of MPI necessary to your environment.

Rules for using an MPI configuration file are as follows:

Examples on Windows* OS:

Examples on Linux* OS:

Optimization Notice

Intel's compilers may or may not optimize to the same degree for non-Intel microprocessors for optimizations that are not unique to Intel microprocessors. These optimizations include SSE2, SSE3, and SSSE3 instruction sets and other optimizations. Intel does not guarantee the availability, functionality, or effectiveness of any optimization on microprocessors not manufactured by Intel. Microprocessor-dependent optimizations in this product are intended for use with Intel microprocessors. Certain optimizations not specific to Intel microarchitecture are reserved for Intel microprocessors. Please refer to the applicable product User and Reference Guides for more information regarding the specific instruction sets covered by this notice.

Notice revision #20110804

See Also


Submit feedback on this help topic