[MPIWG Fortran] MPI_STATUS_SIZE: Why only in Fortran?
Jeff Squyres (jsquyres)
jsquyres at cisco.com
Tue Sep 8 12:04:20 CDT 2020
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 <mpiwg-fortran at lists.mpi-forum.org<mailto:mpiwg-fortran at lists.mpi-forum.org>> 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" <mpiwg-fortran at lists.mpi-forum.org<mailto:mpiwg-fortran at lists.mpi-forum.org>>
To: "MPI-WG Fortran working group" <mpiwg-fortran at lists.mpi-forum.org<mailto:mpiwg-fortran at lists.mpi-forum.org>>
Cc: "wgropp" <wgropp at illinois.edu<mailto:wgropp at illinois.edu>>
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:mpiwg-fortran at lists.mpi-forum.org | mpiwg-fortran at lists.mpi-forum.org<mailto:mpiwg-fortran at lists.mpi-forum.org> ]
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:jsquyres at cisco.com | jsquyres at cisco.com<mailto:jsquyres at cisco.com> ]
_______________________________________________
mpiwg-fortran mailing list
mpiwg-fortran at lists.mpi-forum.org<mailto:mpiwg-fortran at lists.mpi-forum.org>
https://lists.mpi-forum.org/mailman/listinfo/mpiwg-fortran
_______________________________________________
mpiwg-fortran mailing list
mpiwg-fortran at lists.mpi-forum.org<mailto:mpiwg-fortran at lists.mpi-forum.org>
https://lists.mpi-forum.org/mailman/listinfo/mpiwg-fortran
--
Dr. Rolf Rabenseifner . . . . . . . . . .. email rabenseifner at hlrs.de<mailto:rabenseifner at hlrs.de> .
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
mpiwg-fortran at lists.mpi-forum.org<mailto:mpiwg-fortran at lists.mpi-forum.org>
https://lists.mpi-forum.org/mailman/listinfo/mpiwg-fortran
--
Jeff Squyres
jsquyres at cisco.com<mailto:jsquyres at cisco.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mpi-forum.org/pipermail/mpiwg-fortran/attachments/20200908/d8703403/attachment-0001.html>
More information about the mpiwg-fortran
mailing list