g95 and Coarray Fortran

With the availablity of affordable multi-core CPUs or scalable clusters, parallel processing is becoming an increasingly popular method to significantly speed up CPU intensive programs. Coarray Fortran, now implemented in the g95 compiler, provides a relatively simple language for parallel programming.

The Coarray-enabled g95 Fortran compiler is installed on interactive Linux servers gul3, gul4, gul5 available to staff, students and researchers in our university.

In Fortran 2008, the coarray extension provides the simplest language for parallel programming. It adopts the Single-Program-Multiple-Data (SPMD) programming model; a single program is replicated a fixed number of times, each replication (image) having its own set of data objects. The number of images may be the same as the number of physical processors, or it may be more, or it may be less.

More information can be found at http://www.g95.org/coarray.shtml

An example of a Fortran program that includes coarrays is: ca.f90
The program can be compiled in the normal way and run as a single image, and run as multiple images with the cocon utility. The program source contains the compile and run instructions.

Note that coarrays have existed in g95 only since "October 2, 2008" and so I expect much debugging/optimization will be performed before it is stable and efficient. In fact I tried the above program and found it not run faster in parallel mode (2 images on two CPU cores); I expect this will improve in the future (and possibly with more cores).

We have only two CPU cores on our interactive servers so parallel programming is currently only useful for those interested in looking at how it works. I intend to upgrade our servers in the near future with at least 4 cores each.
In summary, coarray Fortran have arrived - try it if you are interested, but don't expect performance enhancements until g95 optimizes (and we have more cores).

Comments/questions are welcome:
Andrew Beddall
system manager