https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88076

--- Comment #5 from Damian Rouson <damian at sourceryinstitute dot org> ---
This is an exciting idea.  When I gave some thought to writing a shared-memory
alternative coarray ABI, it seemed to me that pthreads would be a better choice
than OpenMP.  Part of the problem is that I was considering writing the
implementation in Fortran, and OpenMP lacked support several modern Fortran
features, including several object-oriented programming features.  That of
course won't be an issue for you, however, assuming you're going to write the
implementation in C.  I was going to leverage "forthreads," an open-source
Fortran 20003 interface to pthreads.  One thing that I think would be a major
benefit of having a Fortran implementation of the library is that it greatly
expand the potential community of contributors to include more of the users of
the compiler.

Another important consideration is whether to use the current gfortran
descriptors as arguments in the library functions (as is currently used) or
instead to use the Fortran 2018 CFI descriptors for which Paul recently
committed support.  If you go with the current gfortran descriptors, then there
could be a lot of code to rewrite if gfortran later adopts the standard
descriptors internally.  Paul's recent commit adds functions that can translate
between the gfortran and standard descriptors. I have a volunteer who I'm
hoping will use the translation functions to develop a new, alternative coarray
ABI that accepts the standard descriptors.

On another note mentioned earlier in this PR, I believe it will be necessary to
fork all threads at the beginning of execution and not join them at the end. 
Section 5.3.5 of the Fortran 2018 standard states, "Following the creation of a
fixed number of images, execution begins on each image."  Assuming there is a
one-to-one correspondence between images and threads, I read that as implying
that a fixed number of threads have to be set up before any one thread can
execute.  (Possibly there could also be additional non-image threads that get
forked later also though.)  I recall seeing several interesting papers from
10-15 years ago on SPMD-style programming using threads (OpenMP) so a
literature search on this topic be useful to read.

Reply via email to