[mpich2-dev] update MPI_Type_match_size() to return C99 complex?
Dave Goodell
goodell at mcs.anl.gov
Fri Dec 11 14:51:42 CST 2009
On Dec 11, 2009, at 1:24 PM, Lisandro Dalcin wrote:
> On Fri, Dec 11, 2009 at 3:54 PM, Dave Goodell <goodell at mcs.anl.gov>
> wrote:
>> So to me
>> it makes sense for this function to only return named predefined
>> datatypes
>> corresponding to F90 types, such as MPI_REAL4 and MPI_INTEGER8.
>
> Indeed, that's basically the wording in the MPI standard. But this is
> not the case for MPICH2.
>
> Please take a look at src/mpi/datatype/type_match_size.c
>
> you will see lines like the below:
>
> static MPI_Datatype real_types[] = { MPI_FLOAT, MPI_DOUBLE
> ...
> static MPI_Datatype int_types[] = { MPI_CHAR, MPI_SHORT, MPI_INT,
> ....
> static MPI_Datatype complex_types[] = { MPI_COMPLEX,
> MPI_DOUBLE_COMPLEX };
>
>
> Regarding your previous comments, I think you will agree this
> implementation is a nonsense.
I wouldn't say that the implementation is nonsense. There's a comment
on line 100 that explains the reasoning behind using (typically)
equivalent C types instead. Datatype handle values are valid in all
language bindings, so this will pretty much always work. There are
two cases where you could run into trouble: (A) there is no
corresponding C type for the Fortran type requested or (B) the user
wants to print out the type name for the type returned by
MPI_Type_match_size.
Now with that said, I think that the comment on line 100 is out of
date. We now do provide access to the named predefined Fortran types
from C, as required by the MPI Standard (starting at line 75 of
mpi.h). So we can convert it to use all Fortran types as you would
expect. I'll file this as a ticket to get back to at some point in
the future.
-Dave
More information about the mpich2-dev
mailing list