RFC: Handling of Coarrays with Regards to Allocatable Components
Paul Richard Thomas
paul.richard.thomas@gmail.com
Sat Jun 14 17:39:00 GMT 2014
Dear Tobias,
My suggestion would be to go with a) and, if it turns out to be an
issue, convert to b) later on. I cannot help but feel that if we are
clear about the need to compile consistently with -fcoarray=lib it
should not be a problem.
With best regards
Paul
On 13 June 2014 22:21, Tobias Burnus <burnus@net-b.de> wrote:
> Hi everyone,
>
> when doing a derived-type assignment, allocatable components are also
> assigned. The same happens when doing
> derived_type_var = coarray_derived_type_var[remote_image_idx]
>
> If the allocatable is of polymorphic component, the information about
> allocatable components of the polymorphic component is not available when
> compiling the line above. Thus, we have to generate a "caf_get" subroutine
> for the actual type, which does the copying. (That's also how we already
> handle polymorphic-component assignments. The polymorphic variable/component
> then points to a "virtual table" for the dynamic type which contains the
> procedure pointer to the _copy for that type.)
>
> One has two options: Either generating the "caf_copy" subroutine only with
> -fcoarray=lib – or to generate them unconditionally. What do you think is
> the better option?
>
> a) Generating caf_copy only with -fcoarray=lib:
> + Saves memory when no coarrays are used
> – Might lead to run time failures when mixing code compiled with
> -fcoarray=lib and without, but only when the coarray code uses a derived
> type, which itself (or an extension used as actual type) is declared in a
> file compiled without -fcoarray=lib
>
> b) Always generating caf_get/caf_send
> + Avoids issues with mixing -fcoarray=lib code with other code
> – Requires that the called library functions generated for -fcoarray=lib are
> always available. One might provide a do-nothing stub in libgfortran and
> override them in the actual libcaf_* library when linking the latter.
> (Requires weak symbols.)
> – Breaks the ABI for all polymorphic code (but that's already required for
> the new array descriptor)
>
> What do you think would be best?
>
> Tobias
>
--
The knack of flying is learning how to throw yourself at the ground and miss.
--Hitchhikers Guide to the Galaxy
More information about the Fortran
mailing list