[MPI3 Fortran] MPI-2 Fortran question: 2D char arrayin MPI_COMM_SPAWN_MULTIPLE
Bill Long
longb at cray.com
Tue May 25 14:35:44 CDT 2010
Jeff Squyres wrote:
> On May 25, 2010, at 12:55 PM, Bill Long wrote:
>
>> Characters could also, for example,
>> be passed as the address of a hidden struct, with the first member of
>> the struct being the addresses of the beginning of the string, and the
>> second the length. If the interface specifies BIND(C) then an argument
>> if character(1) has to be passed, essentially, as if it were an integer
>> with the same number of bits, to match C convention. Character
>> variables with length > 1 are not interoperable, since there is no
>> analog in C.
>
> FWIW, I was specifically asking about MPI-2 here, so there's no BIND(C) in the discussion yet.
>
Right. I was jumping ahead here, to just note that bind(c) will not be
a solution.
>>> That is, they strategically look for a string_len sized string *comprised of all blanks* to denote the end of the array.
>> This would only work if the caller explicitly supplied such a value.
>
> It *seems* to work for all the compilers that I can test, except for gfortran.
>
> Of course, MPI_COMM_SPAWN_MULTIPLE is not a popular routine -- this could well have been broken for years and literally no one has noticed until now.
>
Indeed. See below.
>>> Or is the MPI-2 binding for MPI_COMM_SPAWN_MULTIPLE incorrect?
>> It is incorrect if it fails to mention that the user is required to
>> over-size the array and supply the sentinel value and also make sure
>> that no other element of the array is the sentinel value.
>
> The MPI spec does not require this. I'm only citing how I'm seeing it implemented in 2.5 MPI implementations.
OK. My intention was to say that the binding could be made solid IF
this requirement were added.
Perhaps other MPI implementations do it differently somehow...? What
does Cray MPI do?
>
I asked the MPI internals guys, and our MPI version does not support the
spawn feature (dynamic processes), so the usage level for this routine
would be zero. The speculation that "no one has noticed" certainly
applies in our case.
Cheers,
Bill
--
Bill Long longb at cray.com
Fortran Technical Support & voice: 651-605-9024
Bioinformatics Software Development fax: 651-605-9142
Cray Inc./Cray Plaza, Suite 210/380 Jackson St./St. Paul, MN 55101
More information about the mpiwg-fortran
mailing list