If you have been exposed to message passing for parallel programming on distributed memory systems, but do not have time to write complicated code using the message passing interface (MPI), or if you have been using MATLAB and want to explore parallel processing on clusters, take a look at coarray, a standardized language feature of modern Fortran.
In scientific computing, we often need to deal with large data sets, typically stored in arrays. Let’s assume that each process is holding a two dimensional array A(10000,10000), but only works on a portion of it. Suppose the current process needs the portion of A – e.g. A(:,33:64) – computed by its neighbour, process p. In an abstract fashion the operation can be stated as A(:,33:64) <- A(:,33:64) on process p
This is exactly what the coarray is for. One can write this operation as simple as A(:,33:64) = A(:,33:64)[p]
No complex MPI calls are required.
Coarray is a parallel processing construct of modern Fortran, in addition to the “forall” and “do concurrent” loop constructs for vectorized concurrent processing. As a Partitioned Global Access Space (PGAS) model, coarray was first introduced by Cray, and incorporated as an extension in its Cray Fortran, mainly for Cray hardware, in the 1990s. Eventually coarray became one of the language features in an ISO Fortran standard (2008). Currently the coarray features are supported by several popular compilers, including intel and GCC, on top of the underlying MPI library. Coarray has demonstrated both programming productivity and comparable performance.
In this tutorial, we will first go over the common parallel programming models. We will then introduce the syntax of coarray and a few simple rules. We will show how to compile and run parallel programmes with coarrays on your laptop and on SHARCNET systems.