Description
Problem
Perhaps I misunderstand, but it seems that thread levels are not required to be compile-time constants in Fortran, even though all the implementations that I have used implement them this way.
Threads Constants
-----------------
C type: const int (or unnamed enum)
Fortran type: INTEGER
-----------------
MPI_THREAD_FUNNELED
MPI_THREAD_MULTIPLE
MPI_THREAD_SERIALIZED
MPI_THREAD_SINGLE
-----------------
It would be good to be more clear that these are compile-time constants. const int
is not an integer constant expression (details), although enum
appears to be. (C11 §6.2.5):
An enumeration comprises a set of named integer constant values. Each distinct enumeration constitutes a different enumerated type.
We say in A.1.1 that "Constants with the type const int may also be implemented as literal integer constants substituted by the preprocessor." but do not appear to require this.
Proposal
We should make thread levels compile-time constants and specify their values, since there is no point in leaving this ambiguous.
Threads Constants
-----------------
C type: const int (or unnamed enum)
Fortran type: INTEGER, PARAMETER
-----------------
MPI_THREAD_FUNNELED = ..
MPI_THREAD_MULTIPLE = ..
MPI_THREAD_SERIALIZED = ..
MPI_THREAD_SINGLE = ..
-----------------
Changes to the Text
Waiting to see what people think first...
Impact on Implementations
Both MPICH and Open-MPI implement these as compile-time constants in both C and Fortran.
MPICH defines them to be 0,1,2,3. Open-MPI uses an enum
and does not specify the values, although the C compiler produces the same values as MPICH. One or both might need to change, depending on what we decide here.
If we standardize {0,1,2,3}, we leave no room to add new thread levels between the existing ones, so it may be prudent to leave some space.
Impact on Users
Specifying the values fixes one of many ABI problems, among other things.
References and Pull Requests
Metadata
Metadata
Assignees
Type
Projects
Status