[Patch, Fortran] PR 18918 - Fix/Add multi-image support to UCOBOUND

Mikael Morin mikael.morin@sfr.fr
Mon Apr 11 12:05:00 GMT 2011


On Tuesday 05 April 2011 19:44:29 Tobias Burnus wrote:
> This patch adds multi-image support to UCOBOUND. In the -fcoarray=single
> case, the last dimension is just "LCOARRAY (coarray, dim=corank)".
> However, if there are multiple images, one has for corank-1 coarrays:
> "lcobound(coarray) + num_images() -1" and for multi-rank coarrays for
> the last dimension "lcobound(coarray, dim=corank) + ceiling (real
> (num_images ()) / real (size)) - 1", where size is the product of the
> extends in all but the last codimension.
> 
> Well, that's actually all the patch does. (Except that "ceiling(N/S)-1"
> is replaced by "(N+S-1)/S-1" = "(N-1)/S".)
> 
> Build an regtested on x86-64-linux.
> OK for the trunk?
OK. Thanks

> 
> (Sorry, no test case. I think one should soon start to create a
> -fcoarray=lib version of the test suite, where one passes the link (e.g.
> "$DIR/mpi.o $MPI_LIB" or "$DIR/single.o") and run command (e.g. "mpiexec
> -n 3" or "") via environment variables.)
This is needed. However, to achieve better test coverage, we should avoid 
requiring the user to tweak the testsuite as much as possible. That is, test -
fcoarray=lib option with every libcaf by default, skipping the mpi one (for 
example) if libcaf_mpi was not built. 


> PPS: Maybe someone understands why UCOBOUND(corank_1_coarray) for which
> one has the pseudo code:
>     D = [codim=1].lbound + num_image - 1
> gets translated as:
>     D.1571 = (integer(kind=4)) (((character(kind=4))
> parm.2.dim[NON_LVALUE_EXPR <S.1> + 1].lbound + (character(kind=4))
> _gfortran_caf_num_images.4) + 4294967295);
> 
> Namely: Why are there all those casts to "character(kind=4)" and why is
> "+ (-1)" converted into 4294967295? The result surely works, but the
> dump looks odd.

You could try casting gfort_gvar_caf_num_images explicitely to 
gfc_array_index_type. Otherwise I don't know. Might be a bug.


Mikael



More information about the Gcc-patches mailing list