Re: [MPI3 Fortran] TYPE(MPI_Status) with SEQUENCE attribute
Hi Rolf, On 3/31/11 2:31 PM, Rolf Rabenseifner wrote:
Dear all,
as discussed, I had removed the SEQUENCE attribute from form the new TYPE(MPI_Status) derived type within the new mpi_f08 module.
I checked now with a test program whether the new status can be used in a user program in the same way as the old status (i.e. an INTEGER, DIMENSION(MPI_STATUS_SIZE) array) and detected, that the compiler will issue a lot of incompatibilities if the newly defined status does not use internally the sequence attribute.
The messages are valid. However, the use of SEQUENCE seems curious. I would have written the module more like this: MODULE mpi_f08 use,intrinsic :: iso_c_binding IMPLICIT NONE TYPE,bind(c) :: MPI_Comm INTEGER(C_int) :: MPI_VAL END TYPE MPI_Comm TYPE,bind(c) :: MPI_Status INTEGER(C_int) :: MPI_SOURCE INTEGER(C_int) :: MPI_TAG INTEGER(C_int) :: MPI_ERROR INTEGER(C_int) :: MPI_intern_highsize INTEGER(C_int) :: MPI_intern_lowsize END TYPE MPI_Status INTEGER(C_int),parameter :: MPI_STATUS_SIZE=5 END MODULE mpi_f08 The use of a bind(c) type ensures that the memory layout of the type is the same as for the corresponding C struct. It would seem like this is the goal. The SEQUENCE type does not necessarily have this characteristic. Cheers, Bill
It is not expected that this SEQUENCE attribute has any negative impact in scalable applications.
Therefore, I had to reinvent the SEQUENCE into the TYPE(MPI_Status).
The test program and compiler output is attached. The NON_.... variables are declared with types where the SEQUENCE is missing. All these NON_.... variables cause errors and the abort of the compilation.
Same usage patterns with MPI handle and status types internally using SEQUENCE do not cause any errors.
Best regards Rolf
-- Bill Long [email protected] 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
participants (1)
-
Bill Long