[MPI3 Fortran] Results of recent J3 Fortran meeting

Bill Long longb at cray.com
Thu Oct 21 17:07:20 CDT 2010



N.M. Maclaren wrote:
> On Oct 21 2010, Bill Long wrote:

>> We currently interoperate only with C's char type. On the Fortran side, 
>> the interoperable declaration is character(kind=c_char).  Fortran's 
>> default character kind is irrelevant.  And sizeof(char) is 1. So there 
>> is no issue here.
> 
> Except for the last sentence, that is true.  But one of MPI's major
> requirements is that it should be able to handle Fortran default types,
> and NOT force every program to use the C-interoperability KINDs to
> call MPI!  Sorry, but there IS an issue.
> 

OK, I agree that there is a general issue for MPI with non-interoperable 
types.  We have a type code for that - CFI_type_unspecified.   I assume 
that, if the MPI routines are expecting data objects of Fortran types 
that have no corresponding C types (and hence there is little that can 
be done with them in C other than memory copies) then the actual intent 
is to only make memory copies.  In that case, knowing the size of a 
single character is unimportant. All you need is the base_addr, 
elem_len, rank, and dim[] information.

The origin of CFI_type_unspecified is to provide a type code in the case 
that the actual argument is TYPE(*).  If you want to pass a 
non-interoperable kind of character to a C function, you can write the 
Fortran interface with a TYPE(*) argument.  If the rest of the 
declaration requires  a C descriptor pointer in the C prototype, then 
the contents of that descriptor will look just like the one I'm 
proposing for the interoperable character kind, except that the type 
code will be CFI_type_unspecified, rather than CFI_type_char.  The 
base_addr, elem_len, rank, and dim[] information will be correct and the 
MPI memory copies should work just fine.

In fact, consistency in the way character arguments are passed to 
CHARACTER(kind-C_CHAR) dummies and to TYPE(*) dummies is yet another 
argument against the rank modification scheme.

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