[Mpi-forum] All MPI implementors: Implementation of MPI constants in C and Fortran / MPI meeting May 3, 2023 9am CDT discussion

Jeff Hammond jeff.science at gmail.com
Thu May 4 04:40:50 CDT 2023


Many constants cannot be used in "fixed array length in a declaration"
because they are negative numbers, which is not only legal but the only
choice for MPI_UNDEFINED, so you cannot use that criteria for anything.

We say "All named constants, with the exceptions noted below for Fortran,
can be used in initialization expressions or assignments," which means the
following is valid:

#include <mpi.h>
static int x = MPI_ANY_SOURCE;
int main(void) { return 0; }

C static global initialization of integers requires compile-time constants
(example below).  While we may have implied that all constants could be
link-time constants, this is only possible for non-integer constants, i.e.
handles and buffer address constants.

% cat init.c
extern int w;
static int* p = &w;
static int q = w;

% gcc -c init.c
init.c:3:16: error: initializer element is not a compile-time constant
static int q = w;
               ^
1 error generated.

Jeff

On Tue, May 2, 2023 at 9:51 PM Rolf Rabenseifner via mpi-forum <
mpi-forum at lists.mpi-forum.org> wrote:
>
> Dear implementor of an MPI library,
>
> Based on the discussion today in the MPI forum meeting,
> I have the following urgent question to you:
>
>   Did you implement all MPI constants that are described in Annex A.1.1
>     as of type "const int (or unnamed enum)"
>   as "C integer constant expression"
>     (according to the specification of the C language)?
>
> If yes, then all is okay and the proposed change of the MPI standard in
>     https://github.com/mpi-forum/mpi-standard/pull/821/files
> will not require any change of your MPI implementation.
>
> If not, then please can you tell which MPI constant(s) MPI_XXX
>
> - have you implemented in a way that
>
>  - it still can be used in an initialization expression,
>    i.e., in a application statement like
>      int x=MPI_XXX;
>  - but it cannot be used as a case-label in a switch statement like
>      switch(MPI_XXX) {
>          case MPI_XXX: printf("XXX\n");
>          default: ;
>      }
>  - and cannot be used as a fixed array length in a declaration like
>      float x[MPI_XXX];
>
> - and how implemented you such an MPI constant that this problem arises?
>
> We'll discuss this again tomorrow May 3, 2023 at the beginning
> of the MPI forum meeting.
>
> See you hopefully at the meeting,
> and hopefully reporting that you have no problem with the proposal,
>
> kind regards
> Rolf
>
>
> ----- Original Message -----
> > From: "Rolf Rabenseifner" <rabenseifner at hlrs.de>
> > To: "Main MPI Forum mailing list" <mpi-forum at lists.mpi-forum.org>
> > Cc: "Puri Bangalore" <pvbangalore at ua.edu>, "Claudia Blaas-Schenner" <
claudia.blaas-schenner at tuwien.ac.at>, "Jeff
> > Hammond" <jeff.science at gmail.com>
> > Sent: Tuesday, May 2, 2023 2:04:01 PM
> > Subject: Re: Informal meeting announcement for the May 2023 meeting of
the MPI Forum
>
> > Der forum memebers, dear Wesley,
> >
> > please can we add in the agenda after
> >
> >  Informal Errata Reading  705  Fortran has only compile-time constants
  Rolf
> >
> > an additional slot
> >
> >  Errata Discussion  657 All C const int (or unnamed enum) as
compile-time
> >  constants   Rolf, Jeff H.
> >
> > Bestr regards
> > Rolf
> >
> >
> > ----- Original Message -----
> >> From: "Rolf Rabenseifner" <rabenseifner at hlrs.de>
> >> To: "Main MPI Forum mailing list" <mpi-forum at lists.mpi-forum.org>
> >> Cc: "Puri Bangalore" <pvbangalore at ua.edu>, "Claudia Blaas-Schenner"
> >> <claudia.blaas-schenner at tuwien.ac.at>
> >> Sent: Saturday, April 29, 2023 7:38:00 AM
> >> Subject: Informal meeting announcement for the May 2023 meeting of the
MPI Forum
> >
> >> Dear forum members,
> >>
> >> I would like to make the following announcements for the next MPI
Forum Meeting
> >> (May 2-5, 2023):
> >>
> >> - informal reading and discussion
> >>    #705 Errata: Fortran has only compile-time constants    Rolf
> >>      Issue https://github.com/mpi-forum/mpi-issues/issues/705
> >>      PR    https://github.com/mpi-forum/mpi-standard/pull/819
> >>      PDF
> >>
https://github.com/mpi-forum/mpi-standard/files/11358444/mpi41-report_Issue705_PR819.pdf
> >>
> >> This errata should be completely discussed in next (May 2-5, 2023)
meeting.
> >> It is then planned to have an final errata reading plus errata vote at
next
> >> meeting (July 10-13, 2023).
> >>
> >> It is a bug since MPI-2.2 because a problem in C was directly mapped
to Fortran.
> >> This mapping was wrong.
> >> In Fortran, there is no distinction between link-time and compile-time
> >> constants.
> >>
> >> Best regards
> >> Rolf Rabenseifner
> >
> >
> > --
> > Dr. Rolf Rabenseifner . . . . . . . . . .. . . rabenseifner at hlrs.de .
> > High Performance Computing Center (HLRS) . . . ++49(0)711/685-65530 .
> > University of Stuttgart . . . . . . www.hlrs.de/people/rabenseifner .
> > Nobelstr. 19, 70569 Stuttgart, Germany
>
> --
> Dr. Rolf Rabenseifner . . . . . . . . . .. . . rabenseifner at hlrs.de .
> High Performance Computing Center (HLRS) . . . ++49(0)711/685-65530 .
> University of Stuttgart . . . . . . www.hlrs.de/people/rabenseifner .
> Nobelstr. 19, 70569 Stuttgart, Germany
> _______________________________________________
> mpi-forum mailing list
> mpi-forum at lists.mpi-forum.org
> https://lists.mpi-forum.org/mailman/listinfo/mpi-forum



--
Jeff Hammond
jeff.science at gmail.com
http://jeffhammond.github.io/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mpi-forum.org/pipermail/mpi-forum/attachments/20230504/b6b68e41/attachment-0001.html>


More information about the mpi-forum mailing list