Intel® Fortran Compiler XE 13.1 User and Reference Guides
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:
CODIMENSION attribute and "[cobounds]" to declare an object a coarray (covariable)
[coindices] notation to reference covariables on other images
SYNC ALL, SYNC IMAGES, and SYNC MEMORY statements to provide points where images must communicate to synchronize shared data
CRITICAL and END CRITICAL statements to form a block of code executed by one image at a time
LOCK and UNLOCK statements to control objects called locks, used to synchronize actions on specific images
ERROR STOP statement to end all images
ALLOCATE and DEALLOCATE statements may specify coarrays
Intrinsic procedures IMAGE_INDEX, LCOBOUND, NUM_IMAGES, THIS_IMAGE, and UCOBOUND
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:
If you use /Qcoarray-config-file:filename (Windows* OS) or -coarray-config-file=filename (Linux* OS), the /Qcoarray-num-images (Windows* OS) or -coarray-num-images (Linux* OS) cannot appear on the command line
The format of a configuration file is described in the Intel® MPI Library documentation; you will need to add the MPI option "-genv FOR_ICAF_STATUS launched" in the configuration file in order for coarrays to work on multi-node (distributed memory) systems.
You can also set the environment variable FOR_COARRAY_CONFIG_FILE to be the filename and path of the Intel® MPI Library configuration file you want to use at execution time.
Examples on Windows* OS:
/Qcoarray:shared /Qcoarray-num-images:8 runs a coarray program on shared memory using 8 images.
/Qcoarray:shared /Qcoarray-config-file:filename runs a coarray program on shared memory using the MPI configuration detailed in filename.
/Qcoarray:distributed /Qcoarray-config-file:filename runs a coarray program on distributed memory using the Intel® MPI Library configuration detailed in filename (the Intel® Cluster Toolkit license must be installed).
Examples on Linux* OS:
-coarray=shared -coarray-num-images=8 runs a coarray program on shared memory using 8 images.
-coarray=distributed -coarray-num-images=8 runs a coarray program on distributed memory across 8 images (the Intel® Cluster Toolkit license must be installed).
-coarray=distributed -coarray-config-file=filename runs a coarray program on distributed memory using the Intel® MPI Library configuration detailed in filename.
|
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 |