[Patch, Fortran, 4.7] PR 18918 - Add initial support for a coarray communication library

Tobias Burnus burnus@net-b.de
Sat Mar 19 16:23:00 GMT 2011


This patch adds a first support for a coarray communication library.

Note: The patch does not yet allow communication (i.e. access to remote 
coarrays); thus it is only of limited practical use. (If you restrict 
yourself to barriers and this_image/num_images, you can already 
parallelize.)

This patch contains two parts: (a) The front end part, which mainly adds 
some library calls. (b) Two communication library implementations. 
(Single-image library and a very initial MPI version.)


To (a): The patch adds library calls for
- Initialization and finalization
- STOP/ERROR STOP
- SYNC ALL/SYNC IMAGES
- CRITICAL block
- num_images() and this_image()*
- Additionally, SYNC MEMORY is handled (via BUILT_IN_SYNCHRONIZE)
(* only no-argument version)


To (b): The MPI library currently requires MPI 2.x, does not work for 
SYNC IMAGE(<images>), and is very rough.

The single-image library version is the library equivalent to 
-fcoarray=single, but less efficient. Its purpose is for testing - and 
to avoid recompilation (e.g. if you do not have the source code).

My idea is to place those library into libgfortran/caf. The user has to 
compile them themselves and link it then to their "gfortran 
-fcoarray=lib" compiled program. (Cf. 
http://gcc.gnu.org/ml/fortran/2011-03/msg00003.html).

Build and regtested on x86-64-linux.
(a) Is the patch OK for the 4.7 trunk?
(b) Are the libgfortrancaf.h, libgfortrancaf_mpi.c and 
libgfortrancaf_single.c OK for inclusion at libgfortran/caf?

  * * *

TODO:
- Documentation about the usage of coarrays - and in particular calling 
the library for programs with a non-gfortran main program
- Add test-suite support, where the user specifies (e.g. via environment 
variables?) the to-be-linked coarray communication library (e.g. 
"-lgfortrancaf_mpi") and the command to run it (e.g. "mpiexec -n 3")
- autoconf work: Allow to automatically build the communication library 
(statically), in particular the single-image version.

And the obvious extensions:
- Implement ATOMIC, LOCK, coarray registration/communication, and other 
left overs
- Properly implement an MPI version.

(I plan to concentrate on the front-end (FE) version - and will only do 
a minimal version for the single/MPI library. I hope that someone else 
will take over that part. If not, I might do it after the FE part is 
implemented. Maybe, one also finds a student, who wants to work on it 
via Google's Summer of Code program.)

Tobias
-------------- next part --------------
A non-text attachment was scrubbed...
Name: coarray-lib.diff
Type: text/x-patch
Size: 23687 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20110319/1809f7de/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: libgfortrancaf.h
Type: text/x-chdr
Size: 1927 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20110319/1809f7de/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: libgfortrancaf_single.c
Type: text/x-csrc
Size: 2681 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20110319/1809f7de/attachment-0002.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: libgfortrancaf_mpi.c
Type: text/x-csrc
Size: 5450 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20110319/1809f7de/attachment-0003.bin>


More information about the Gcc-patches mailing list