Coarray usage resources

Now that I have lots of free time I’m finally starting to dig into coarrays as an alternative to MPI. Quite a few years ago now in the very early days of coarrays, someone – a european, Italian maybe? – had created a series of examples of how to implement various parallel programming approaches using coarrays. Does anyone recall his name or where those examples can be found?

I’d also be interested in any similar resources that approach coarrays from the perspective of an MPI user.

2 Likes
3 Likes

Perhaps not as much as from a comparison or size-by-side formulation of SPMD programs using the coarray Fortran approach relative to the MPI model but as a semiformal reference into the thoughts of an inventor of the coarray model, a resource worth reviewing closely is Parallel Programming with Co-arrays by Robert Numrich (Taylor & Francis, 2018).

3 Likes

Not exactly from the perspective of a MPI user, but here are two resources I’ve found interesting:

2 Likes

After a lot more searching the of the comp.lang.fortran archives I stumbled across his name, Michael Siehl. His examples are in many github repos: MichaelSiehl (Michael Siehl) · GitHub

1 Like

He published with ACM Fortran Forum too. Here is one link https://dl.acm.org/doi/10.1145/2980025.2980026

2 Likes

He’s here as @Federchen as well

3 Likes

Thanks for mentioning me and pointing to my Githubs. Nevertheless, much has changed and things are still changing with my coarray programming and I am currently preparing for completely different ways to program with Coarray Fortran: Channels and coroutines.

Simply said, channels allow non-blocking data transfer between coroutines (the blocking is surrounding the coroutines), and groups of coroutines do execute on the same threads (coarray images) at the same time (in constant change): If one group of coroutines must wait with further execution until a data transfer through a channel has completed, another group of coroutines (that uses a different channel for the data transfer between them) can still execute on the same coarray images. Advantages should be a boost of performance (each coarray image does always execute some portion of a task) and a safe and simple parallel programming style (using channels, coarrays and the required synchronizations are hidden).

It is still raw prototyping yet but it works the same with ifort and Gfortran/OpenCoarrays. (Gfortran/OpenCoarrays has some advantages yet). I did not try with the NAG compiler yet.

My current plans for upcoming Github repositories are:

  • Implementing coroutines with Coarray Fortran
  • A new type of synchronization method to implement channels with Coarray Fortran
  • Implementing channels based on coarrays
  • Implementing a Fragmented Objects model with Coarray Fortran

cheers

2 Likes

@nncarlson what resources did you find useful to learn coarrays? I couldn’t find a good comprehensive online tutorial.

I found this paper:

Numrich, Robert W., and John Reid. “Co-Array Fortran for parallel programming.” ACM Sigplan Fortran Forum . Vol. 17. No. 2. New York, NY, USA: ACM, 1998. ftp://hsl.rl.ac.uk/pub/reports/nrRAL98060.pdf

I also found this paper very interesting, for a background:

Numrich, Robert W. “Parallel numerical algorithms based on tensor notation and Co-Array Fortran syntax.” Parallel Computing 31.6 (2005): 588-607. Redirecting

Then searching coarray in Learn Fortran - Fortran Programming Language reveals these two additional resources:

Both seem relatively short, but should be enough to get started.

Probably this book mentioned above: Coarray usage resources - #3 by FortranFan might be a good resource, but I don’t currently have it. I believe Milan’s book (Modern Fortran) also had a coarray tutorial, but I currently don’t have it either.

Two more resources:

(links taken from the Coarray Fortran on LRZ’s HPC systems page of the Leibniz Supercomputing Centre)

Well I’m only at the initial stages of “learning” coarrays, and the only sources I have so far are the ones suggested by posters in this thread, which I am still working my way through. I was able to look at the Numrich book suggested by @FortranFan online via LANL. It gives a decent basic intro, but probably a majority of the material deals with implementation details of how to parallel decompose a problem, which is independent of coarrays, and only slips in coarrays as the last piece. I’ll add the papers you found to my list. If I find something I find particularly useful I’ll be sure to post about it here.

A tutorial that I think would be very helpful which I didn’t find, is a nuts-and-bolts “Getting started with coarrays”, which is concerned solely with how to compile and run a coarray program, including installation of additional software, if any, beyond the basic compiler. OpenCoarrays has done a nice job for gfortran, but I’m thinking of a comprehensive one-stop tutorial that covers all compilers. Things vary significantly between compilers; I found Intel to be particularly obtuse. Portability is a key thing when I am considering using a new feature, so from the outset I needed to be able to run my learning examples on multiple platforms (Intel, gfortran, and NAG so far).

2 Likes