[MPIWG Fortran] "ELEMENTAL" keyword on mpi_f08 comparison operator functions
Rolf Rabenseifner
rabenseifner at hlrs.de
Sat Mar 12 04:07:14 CST 2022
Dear Reinhold, Jeff, Jeff, and all,
Reinhold, thank you for your answer and your explanation by phone today.
>> > It should be correct to add ELEMENTAL here and we should encourage that.
Yes, I completely agree with this statement.
One goal of the overloading is, that the following application code
DO WHILE (ANY(request-array.NE.MPI_REQUEST_NULL))
MPI_TESTSOME(10, request_array, ...)
END DO
should work in the mpi and mpi_f08 module, i.e., for
INTEGER request_array(10)
and
TYPE(MPI_Request), DIMENSION(10) :: request_array
In principle, Reinhold's 1st item mentioned, that an implementation
of an MPI library could do it in a different way by internaly checking
the shape of the arguments (here a one-dimsional array with 10 elements
and a scalar) and then returning internally doing the right comparisons
and returning a corrrect result (here again a one-dimsional array
with 10 elements).
In this sense, requiring ELEMENTAL is not needed because it would
restrict an implementation to do only the most easy solution ;-)
Of course, doing the comparison only for scalars should be treated
incorrect.
The most simple and most clear way for implementors and users to
tell them that the comparison must work for scalars and any
one- or multi-dimensional array of handles, is to directly say
that ELEMENTAL must be specified.
I would recommend to add this as an errata, because we should
have done this already in MPI-3.0, i.e., we should not have
allowed the complicated way as mentioned in Reinhold's 1st item.
Of course, restricting it to only scalar comparisons was never intended.
The errata must be done at two locations:
>> mpi_f08 in MPI-4.0 Section 19.1.2 page 793 lines 23-24:
>> > * Overload the operators .EQ. and .NE. to allow the comparison
>> > of these MPI handles with .EQ. , .NE. , == and /= .
ELEMENTAL shall be specified to not exclude array comparisons.
>>
>> mpi module in MPI-4.0 Section 19.1.3 page 795 lines 35-37:
>> * Define the derived type MPI_Status and all named handle types
>> that are used in the mpi_f08 module. For these named handle
>> types, overload the operators .EQ. and .NE. to allow handle
>> comparison via the .EQ., .NE., == and /= operators.
ELEMENTAL shall be specified to not exclude array comparisons.
I included already a first draft for that erratum.
Reinhold is not member of the mailing list, i.e. one of us should
always take care that his answers are also broadcasted to
"MPI-WG Fortran working group" <mpiwg-fortran at lists.mpi-forum.org>
Best regards
Rolf
----- Original Message -----
> From: "Rolf Rabenseifner" <rabenseifner at hlrs.de>
> To: "Reinhold Bader" <Reinhold.Bader at lrz.de>
> Cc: "Jeff Hammond" <jeff.science at gmail.com>, "MPI-WG Fortran working group" <mpiwg-fortran at lists.mpi-forum.org>, "Jeff
> Squyres" <jsquyres at cisco.com>
> Sent: Saturday, March 12, 2022 8:53:28 AM
> Subject: Re: AW: [MPIWG Fortran] "ELEMENTAL" keyword on mpi_f08 comparison operator functions
> I just resend Reinhold's answer to the list for the case that Reinhold is not
> member of the list.
> I'll try to call him to better understand his answer; and then he or I will come
> back.
> _________________
> Hello Rolf,
>
> apologies for the delayed response. Here my comments:
>
> 1. If an MPI implementation already implements the specifics
of these operators [these 3 additional words were meant by Reinhold]
> with assumed rank dummy arguments (with run-time checks for conformity
> of rank and shape),
> making these ELEMENTAL would not be possible. One would need to change the
> implementation to have scalar arguments. Similar if multiple specifics
> for different ranks are implemented.
[by Rolf: I expect that no MPI library was implemented in such a complicated way.]
> 2. Adding ELEMENTAL in an implementation will necessitate recompilation
> of application codes
> 3. Lack of portability for application codes seems to me to be less of a
> problem than it is now, i.e., adding the ELEMENTAL requirement in
> the spec would simply assure that implementations are not permitted
> to limit themselves to the scalar case.
>
> Regards
> Reinhold
>
>> -----Ursprüngliche Nachricht-----
>> Von: Rolf Rabenseifner <rabenseifner at hlrs.de>
>> Gesendet: Dienstag, 8. März 2022 11:59
>> An: Bader, Reinhold <Reinhold.Bader at lrz.de>
>> Cc: Jeff Hammond <jeff.science at gmail.com>; MPI-WG Fortran working
>> group <mpiwg-fortran at lists.mpi-forum.org>
>> Betreff: Re: [MPIWG Fortran] "ELEMENTAL" keyword on mpi_f08 comparison
>> operator functions
>>
>> Hello Reinhold,
>>
>> can you give as background information about this question on ELEMENTAL
>> below.
>>
>>
>> Our MPI handles are defined according to MPi-4.0 page 18 as
>>
>> TYPE, BIND(C) :: MPI_Comm
>> INTEGER :: MPI_VAL
>> END TYPE MPI_Comm
>>
>> and same for MPI_Group, ...
>>
>>
>> The MPI standard specifies for both the mpi and the mpi_f08 module:
>>
>> mpi_f08 in MPI-4.0 Section 19.1.2 page 793 lines 23-24:
>> > * Overload the operators .EQ. and .NE. to allow the comparison of these
>> MPI
>> > handles with .EQ. , .NE. , == and /= .
>>
>> mpi module in MPI-4.0 Section 19.1.3 page 795 lines 35-37:
>> * Defi
>>
>> ne the derived type MPI_Status and all named handle types that are used in
>> the
>> mpi_f08 module. For these named handle types, overload the operators
>> .EQ. and
>> .NE. to allow handle comparison via the .EQ., .NE., == and /= operators.
>>
>> Best regards
>> Rolf
>>
>>
>> ----- Original Message -----
>> > From: "MPI-WG Fortran working group"
>> > <mpiwg-fortran at lists.mpi-forum.org>
>> > To: "MPI-WG Fortran working group" <mpiwg-fortran at lists.mpi-
>> forum.org>
>> > Cc: "Jeff Hammond" <jeff.science at gmail.com>
>> > Sent: Tuesday, March 8, 2022 11:01:13 AM
>> > Subject: Re: [MPIWG Fortran] "ELEMENTAL" keyword on mpi_f08
>> comparison
>> > operator functions
>>
>> > It should be correct to add ELEMENTAL here and we should encourage that.
>> >
>> > I would argue that we should require ELEMENTAL in the place where it
>> says:
>> >
>> >
>> > * Overload the operators .EQ. and .NE. to allow the comparison of these
>> MPI
>> > handles with .EQ. , .NE. , == and /= .
>> > [ https://www.mpi-forum.org/docs/mpi-3.1/mpi31-report/node409.htm |
>> > https://www.mpi-forum.org/docs/mpi-3.1/mpi31-report/node409.htm ] (I
>> > assume the text is unchanged in MPI-4)
>> >
>> > Jeff
>> >
>> > On Tue, Mar 8, 2022 at 1:19 AM Jeff Squyres (jsquyres) via
>> > mpiwg-fortran < [ mailto:mpiwg-fortran at lists.mpi-forum.org |
>> > mpiwg-fortran at lists.mpi-forum.org ]
>> > > wrote:
>> >
>> >
>> > Forum Fortran WG --
>> >
>> > Any comments?
>> >
>> > I got one off-list reply explaining the use of ELEMENTAL, but I'm
>> > curious as to what the Forum's response should be.
>> >
>> > I ask because the use of ELEMENTAL has an impact on MPI application
>> portability.
>> > E.g., if the Open MPI family of implementations use ELEMENTAL but the
>> > MPICH family of implementations do not, that could be confusing for users.
>> >
>> > --
>> > Jeff Squyres
>> > [ mailto:jsquyres at cisco.com | jsquyres at cisco.com ]
>> >
>> > ________________________________________
>> > From: mpiwg-fortran < [
>> > mailto:mpiwg-fortran-bounces at lists.mpi-forum.org |
>> > mpiwg-fortran-bounces at lists.mpi-forum.org ] > on behalf of Jeff
>> > Squyres
>> > (jsquyres) via mpiwg-fortran < [
>> > mailto:mpiwg-fortran at lists.mpi-forum.org |
>> > mpiwg-fortran at lists.mpi-forum.org ] >
>> > Sent: Tuesday, March 1, 2022 10:24 AM
>> > To: MPI Forum
>> > Cc: Jeff Squyres (jsquyres)
>> > Subject: [MPIWG Fortran] "ELEMENTAL" keyword on mpi_f08 comparison
>> > operator functions
>> >
>> > An Open MPI user this morning requested that we add the "ELEMENTAL"
>> > keyword to the mpi_f08 module eq / neq operator functions: [
>> > https://github.com/open-mpi/ompi/issues/10057 |
>> > https://github.com/open-mpi/ompi/issues/10057 ]
>> >
>> > The only statement I can find in MPI-4.0 about the eq / neq operators
>> > is section 19.1.2, "Fortran Support Through the mpi_f08 Module", only
>> > says the following about the operator functions (p793, 22:23):
>> >
>> >> Overload the operators .EQ. and .NE. to allow the comparison of these
>> >> MPI handles with .EQ., .NE., == and /=.
>> >
>> > This doesn't seem to allow or disallow the use of ELEMENTAL.
>> >
>> > What are the pros / cons of adding ELEMENTAL to the eq / neq operator
>> functions?
>> >
>> > --
>> > Jeff Squyres
>> > [ mailto:jsquyres at cisco.com | jsquyres at cisco.com ]
>> > _______________________________________________
>> > mpiwg-fortran mailing list
>> > [ mailto:mpiwg-fortran at lists.mpi-forum.org |
>> > mpiwg-fortran at lists.mpi-forum.org ] [
>> > https://lists.mpi-forum.org/mailman/listinfo/mpiwg-fortran |
>> > https://lists.mpi-forum.org/mailman/listinfo/mpiwg-fortran ]
>> > _______________________________________________
>> > mpiwg-fortran mailing list
>> > [ mailto:mpiwg-fortran at lists.mpi-forum.org |
>> > mpiwg-fortran at lists.mpi-forum.org ] [
>> > https://lists.mpi-forum.org/mailman/listinfo/mpiwg-fortran |
>> > https://lists.mpi-forum.org/mailman/listinfo/mpiwg-fortran ]
>> >
>> >
>> > --
>> > Jeff Hammond
>> > [ mailto:jeff.science at gmail.com | jeff.science at gmail.com ] [
>> > http://jeffhammond.github.io/ | http://jeffhammond.github.io/ ]
>> >
>> > _______________________________________________
>> > mpiwg-fortran mailing list
>> > mpiwg-fortran at lists.mpi-forum.org
>> > https://lists.mpi-forum.org/mailman/listinfo/mpiwg-fortran
>>
>> --
>> Dr. Rolf Rabenseifner . . . . . . . . . .. email 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 .
> > Nobelstr. 19, D-70550 Stuttgart, Germany . . . . (Office: Room 1.307) .
--
Dr. Rolf Rabenseifner . . . . . . . . . .. email 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 .
Nobelstr. 19, D-70550 Stuttgart, Germany . . . . (Office: Room 1.307) .
More information about the mpiwg-fortran
mailing list