Re: [MPI3 Fortran] TYPE(MPI_Status) with SEQUENCE attribute
Bill, This is an interesting idea. I added also Reinhold's idea to use BIND(C) together with normal Fortran INTEGER. I extended my tests and the only tests that did not fail are the SEQUENCE derived type. All other declarations of a handle or a status fail if the user has stored such a handle or status in a common block or a sequence derived type. This test is based on the requirement that the location of a MPI-2 handle or status in a Fortran user application has to work also with the new definition of handles and statuses, because we never want that the data structures of a user program must be significantly modified. Such a significant modification would be, that he/she cannot further use a standard common block, although they are deprecated. Too many Fortran programs exchange arguments through common blocks. For the new handles, the principal idea is, to have exactly one Fortran numerical unit, i.e., the same as with the MPI-2 definition of a handle, which was an INTEGER. Best regards Rolf ----- Original Message -----
From: "Bill Long" <[email protected]> To: [email protected] Sent: Friday, April 1, 2011 12:24:27 AM Subject: 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
_______________________________________________ mpi3-fortran mailing list [email protected] http://lists.mpi-forum.org/mailman/listinfo.cgi/mpi3-fortran
-- Dr. Rolf Rabenseifner . . . . . . . . . .. email [email protected] High Performance Computing Center (HLRS) . phone ++49(0)711/685-65530 University of Stuttgart . . . . . . . . .. fax ++49(0)711 / 685-65832 Head of Dpmt Parallel Computing . . . www.hlrs.de/people/rabenseifner Nobelstr. 19, D-70550 Stuttgart, Germany . (Office: Allmandring 30)
participants (1)
-
Rolf Rabenseifner