Re: [MPIWG Fortran] MPI_STATUS_SIZE: Why only in Fortran?
Dear Jeff, I just updated the header-text in https://github.com/mpi-forum/mpi-issues/issues/306 MPI 3.x: p704:13-xx (still to be done: list with the new C constants after the list for Fortran) MPI 4.x: p774:13-xx (still to be done: list with the new C constants after the list for Fortran) Text in the new C table header may be something like (see also my previous email, but I removed the hint to mpif.h and mpi module, because the Fortran constants must be provided also in the mpi_f08 module) Fortran status array size and reserved index values (C only) (in C only to specify a Fortran status array and indexes into such an array. The values of Fortran MPI_STATUS_SIZE and C MPI_F_STATUS_SIZE are identical, whereas the indexes in C are 1 less than in Fortran to reflect that arrays in Fortran start by default with index 1 whereas in C with index 0) ---------------------- C type: int ---------------------- MPI_F_STATUS_SIZE MPI_F_SOURCE MPI_F_TAG MPI_F_ERROR ---------------------- Additionally, I would change the Fortran header in the original table from Status array size and reserved index values (Fortran only) to Status array size and reserved index values (Fortran only) Please, do not forget to add also Annex A.1.1 in the list in the changelog. Changelog: please keep in mind, that for errata (see older erratas), we also cite the previous standard, to which the change applies, i.e., additionally ---- Sections 2.5.4, 18.2.5 and A.1.1 on pages 15, 758 and 771, and MPI-3.1 Sections 2.5.4, 17.2.5 and A.1.1 on pages 15, 656 and 669. Define the C constants MPI_F_STATUS_SIZE, MPI_F_SOURCE, MPI_F_TAG, and MPI_F_ERROR. ---- All the rest seems to be perfect. Thank you. Best regards Rolf ----- Original Message -----
From: "Jeff Squyres" <[email protected]> To: "Rolf Rabenseifner" <[email protected]>, "MPI-WG Fortran working group" <[email protected]> Sent: Tuesday, September 8, 2020 7:04:20 PM Subject: Re: [MPIWG Fortran] MPI_STATUS_SIZE: Why only in Fortran?
Issue (includes 3.x and 4.0 PDFs): https://github.com/mpi-forum/mpi-issues/issues/306 * 3.x PR: https://github.com/mpi-forum/mpi-standard/pull/271 * 4.0 PR: https://github.com/mpi-forum/mpi-standard/pull/270
Please review before I send this to the main Forum list.
Thanks!
On Sep 8, 2020, at 11:15 AM, Rolf Rabenseifner via mpiwg-fortran <[email protected]<mailto:[email protected]>> wrote:
It was clearly overseen when setting up the language interoperability chapter. Yes, we should duplicate the whole table MPI-3.1 A.1.1. p672:6-12 on MPI_STATUS_SIZE and the indexes MPI_SOURCE, MPI_TAG, and MPI_ERROR. My apologies, because I was involved.
In C, I would recommend to use the following name scheme that we already use for other Fortran specific constants and functions:
int MPI_F_STATUS_SIZE and MPI_F_SOURCE, MPI_F_TAG, and MPI_F_ERROR, (in C only to specify a Fortran status array and indexes into such an array as defined in mpif.h and the mpi module. The values of Fortran MPI_STATUS_SIZE and C MPI_F_STATUS_SIZE are identical, whereas the indexes in C are 1 less than in Fortran to reflect that the arrays in Fortran start by default with index 1 whereas in C with index 0)
On MPI-3.1 p656:29, I would add
In C, such an f_status array can be defined with MPI_Fint f_status[MPI_F_STATUS_SIZE]. Within this array, one can use in C the indexes MPI_F_SOURCE, MPI_F_TAG and MPI_F_ERROR to access the same elements as in Fortran with MPI_SOURCE, MPI_TAG and MPI_ERROR. The C indexes are 1 less the corresponding indexes in Fortran due to the different default array start indexes in both languages.
And MPI_F_STATUS_SIZE must be added to the list on page 15.
Yes, and I would treat it is an Errata because of the incompletness of Section 17.2.5.
And yes, sizeof(MPI_Status) may be 24 (bytes in C) whereas MPI_STATUS_SIZE and the new MPI_F_STATUS_SIZE would both be 6 (Fortran INTEGER).
Best regards Rolf
----- Original Message ----- From: "MPI-WG Fortran working group" <[email protected]<mailto:[email protected]>> To: "MPI-WG Fortran working group" <[email protected]<mailto:[email protected]>> Cc: "wgropp" <[email protected]<mailto:[email protected]>> Sent: Tuesday, September 8, 2020 3:43:29 PM Subject: Re: [MPIWG Fortran] MPI_STATUS_SIZE: Why only in Fortran?
I honestly can’t remember why we restricted MPI_STATUS_SIZE to Fortran - my best guess is one Jeff mentions, that we were maintaining the possibility that the C and Fortran statues could be a different size, and the possible confusion with sizeof(MPI_Status) is real. I’d go with a distinct name that included FORTRAN as an alternative.
Bill
William Gropp Director and Chief Scientist, NCSA Thomas M. Siebel Chair in Computer Science University of Illinois Urbana-Champaign
On Sep 8, 2020, at 8:32 AM, Jeff Squyres (jsquyres) via mpiwg-fortran < [ mailto:[email protected] | [email protected]<mailto:[email protected]> ] wrote:
Question: why is MPI_STATUS_SIZE only defined in Fortran?
MPI-3.1:2.5.4 p15:36 specifically states that MPI_STATUS_SIZE is only defined in Fortran. Why isn't is also defined in C?
I ask because I was just writing a test for the MPI_Status conversion functions in Open MPI. The test spans both Fortran and C. But in order to test the MPI_Status_f2c / MPI_Status_c2f functions (which are only defined in C, mind you), I wanted to make a stack-allocated array of MPI_Fint's for the INTEGER-array-style Fortran status. ...but I couldn't, because MPI_STATUS_SIZE isn't defined in C. Indeed, there's no mechanism in C for knowing how long an INTEGER-style Fortran status array needs to be -- even though we have functions in C for dealing with INTEGER-style Fortran statuses.
To be totally clear, you can't do this in C:
MPI_Fint f_status[MPI_STATUS_SIZE];
Is this an oversight? Shouldn't we define MPI_STATUS_SIZE in all languages?
Or, perhaps if there's possible confusion between MPI_STATUS_SIZE in C and sizeof(MPI_Status) (since they could actually be different values), perhaps we could call it MPI_FORTRAN_STATUS_SIZE in C? (Or even MPI_FORTRAN_INTEGER_STATUS_SIZE to differentiate it from sizeof(TYPE(MPI_Status))?
Thoughts?
If we view this as an errata, I think there's still time to get an update in for MPI-4.
-- Jeff Squyres [ mailto:[email protected] | [email protected]<mailto:[email protected]> ]
_______________________________________________ mpiwg-fortran mailing list [email protected]<mailto:[email protected]> https://lists.mpi-forum.org/mailman/listinfo/mpiwg-fortran
_______________________________________________ mpiwg-fortran mailing list [email protected]<mailto:[email protected]> https://lists.mpi-forum.org/mailman/listinfo/mpiwg-fortran
-- Dr. Rolf Rabenseifner . . . . . . . . . .. email [email protected]<mailto:[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<http://www.hlrs.de/people/rabenseifner> . Nobelstr. 19, D-70550 Stuttgart, Germany . . . . (Office: Room 1.307) . _______________________________________________ mpiwg-fortran mailing list [email protected]<mailto:[email protected]> https://lists.mpi-forum.org/mailman/listinfo/mpiwg-fortran
-- Jeff Squyres [email protected]<mailto:[email protected]>
-- 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: Room 1.307) .
participants (1)
-
Rolf Rabenseifner