Skip to Content

Coarray Fortran (CAF)

Coarray Fortran (CAF) language constructs are recognized by default with the Cray Fortran compiler. To disable this, use the -hnocaf flag.

While CAF makes interprocess (called "images") communication syntactically much simpler than using MPI for message passing, synchronizations and critical regions are still necessary to ensure data arrives in the intended order.

Data structures which participate in communication thus must be declared as coarrays, fundamentally with the suffix [0:*] appended to their existing declarations.

Furthermore, there are optimal and suboptimal ways of doing broadcasts, collectives, and all-to-all communications.

A program is interpreted as if it were replicated a number of times and all copies were executed asynchronously. Each copy has its own set of data objects and is termed an image. The array syntax of Fortran is extended with additional trailing subscripts in square brackets to provide a concise representation of references to data that is spread across images.

The CAF extension has been available for a long time and was implemented in some Fortran compilers such as those from Cray (since release 3.1). Since the inclusion of coarrays in the Fortran 2008 standard, the number of implementations is growing. The first open-source compiler which implemented coarrays as specified in the Fortran 2008 standard for Linux architectures is G95.

Co-Array Fortran is a PGAS (Partitioned Global Address Space) language, a class of parallel programming languages that can work efficiently on the Gemini interconnect of the Cray XE6. Co-Array is a small set of extensions to Fortran for Single Program Multiple Data parallel programming that is included in the current Fortran Standard, Fortran 2008. Hugepages may be needed for CAF programs. 

For more information