-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
specify values of compile-time constants #1
Comments
Maybe not fully compile time constants but almost, we need to be careful of potential "Macros": 2.6.4:
|
Can you create a new issue for this? It is an important topic to address. |
The following table summarizes what I found with respect to specifications about allowed values for the
|
I will collect the values from all accessible implementations and tabulate, since that will guide us. |
Intel MPI 2021.7.1
MPICH 4.0.3
Open-MPI 4.1.4
|
|
In Open MPI '5.0.x' and 'main' the defaults in the current source code are
|
Could any of the current compile-time constants become link-time constants or init-time constants? |
Anything that is not used for a static string declaration can be unspecified at compile-time. See MPI 4.0 Section 2.5.4 for details. Fortran requires compile-time constants for initialization but Fortran isn't the top priority here. However, the MPICH ABI approach is much better for Fortran. |
Yeah, I was mostly thinking of the "Assorted Constants" |
|
|
Basically, for anything that has to be an integer and has no risk of conflicting with anything, I think we should just specify the constant. |
How about making all these link-time constants? I think MPICH will be obligated to keep MPICH ABI for the near future -- likely > 10 years. Thus we cannot change the internal values for these constants. If these are defined as link time constants, we can easily maintain an abi-layer for these symbols. If they are compile-time constants, we'll have to maintain a messy translation table. |
Yeah, I favor making anything that is not already required to be a compile-time constant to be a link-time constant. That makes ABI compatibility layers easier. |
Same |
@hzhou - Could you add them to the ABI header in the repo? (Whatever makes sense to you, then we can iterate) |
I think we have a problem here, which requires us to make all the integer constants compile-time constants, or make a breaking change in the spec. Recall:
While Consider this code: #include <mpi.h>
static int s = MPI_ANY_TAG;
const int c = MPI_ANY_TAG;
int main(void)
{
int m = MPI_ANY_TAG;
(void)m;
(void)s;
(void)c;
return MPI_ANY_TAG;
} I believe this is compliant per §2.5.4, but it does not compile with Mukautuva because I am resolving the value of I don't see any way to make this work without defining the value in the header. I can't do the following , which would allow me to resolve the value at runtime. extern void * MUK_MPI_ANY_TAG;
#define MPI_ANY_TAG (*(int*)MUK_MPI_ANY_TAG); Am I missing something? |
Signed-off-by: Jeff Hammond <[email protected]>
Well, so be it :) @jeffhammond Could you push a consolidated |
You can do whatever you want with naming things. The current Mukautuva development model is furious hacking so I am not using anything external, but I will eventually calm down and sync up with canonical ABI header repo. Currently, you are using |
By the way, https://github.com/jeffhammond/mukautuva/blob/main/testconstants.c tests for the existence of nearly all of the compile-time integer named constants. I am now able to pass this test with Mukautuva. Not all of those constants are correctly translated to the implementation value, but many are. In cases where MPICH and Open-MPI agree, I choose the same value. Comparison results, thread levels and |
I believe we have agreed to use pointers. It'll be a quick adaption for me, but it is best to pin down a version to continue work on. The
In either case, at least for now, we are adding runtime check/conversion since we can't rely on the assumption that any constants will match. This gives you total freedom in deciding these values. I would rather see the new ABI make clean sense, rather than to inherit artifacts from both OpenMPI and MPICH. |
We want this code to work, right? --
I don't think I think that leaves the only option to define all these constants to be compile-time constants and have shim layer to translate the constants at runtime. EDIT: it is possible for MPICH to work with link-time constants. MPICH need create dummy EDIT: There is a consideration for the shim translation. For compile-time constants, assuming the constants are in a lower range, it can be easily optimized into a simple range check to distinguish with builtin constants and dynamic values, and a table lookup for translating the builtin constants. If it is link time constants, then there is no optimizations. We are looking at a huge |
Yes, that code needs to work. Lots of code, including the MPICH test suite and the OSU MPI benchmarks, initialize to predefined handles before init. I spent the day implementing this in MUK. I used a simplified version of the OMPI method. I think I did it without an if-else table for datatypes but I need to check it tomorrow. I've made all the constants symbols when using MPICH by doing Because MUK handles are (internally) pointers to pointers, I don't need if-else tables, or at least I didn't before the last redesign. |
I won’t steal Hui’s thunder by giving away the details here, but point out that he has a reasonable solution. @hzhou - can you fill in the details about what we talked about this morning? :-) |
Sure. Give me a day or two to get pmodels/mpich#6390 in a working shape, then we can discuss by looking at the technical details. |
Problem
We must specify the values of compile-time constants to have an ABI.
Proposal
These must be compile-time constants. We need to figure out a safe upper bound.
Of the following, only
MPI_BSEND_OVERHEAD
is nontrivial, because it relates to implementation details.All error constants in A.1.1.
These will change with every release of the MPI standard:
Standardizing the Fortran ABI is a different issue, but if we go down that path, these need to be specified:
This is a C constant that must match Fortran.
These are currently compiler-specific, in addition to being implementation-specific. However, by the time we finish MPI-5, the associated Fortran 2018 features should be widely available, and we may be able to deprecate them. Alternatively, these can become runtime queries, although that may impact user experience in some cases.
Changes to the Text
TODO
Impact on Implementations
Implementations will need to change to the standard values.
Impact on Users
ABI standardization is good.
References and Pull Requests
mpi-forum#642
The text was updated successfully, but these errors were encountered: