-
Notifications
You must be signed in to change notification settings - Fork 929
Description
@bosilca, I found a Fortran/datatype bug and am trying to fix it but I want to hear your opinion.
The bug is that a Fortran program cannot be compiled if it uses some predefined datatypes.
The cause is that those datatypes are not defined or incorrectly defined in include/mpif-handles.h, which is created by ompi/include/mpif-values.pl.
The missing datatypes are:
MPI_C_BOOLMPI_LONG_LONG
The incorrectly defined datatypes are:
MPI_LONG_DOUBLE_INTMPI_CXX_FLOAT_COMPLEXMPI_CXX_DOUBLE_COMPLEXMPI_CXX_LONG_DOUBLE_COMPLEX
The incorrectly defined datatypes can be fixed easily:
--- a/ompi/include/mpif-values.pl
+++ b/ompi/include/mpif-values.pl
@@ -166,14 +166,14 @@ $handles->{MPI_DOUBLE} = 46;
$handles->{MPI_LONG_DOUBLE} = 47;
$handles->{MPI_FLOAT_INT} = 48;
$handles->{MPI_DOUBLE_INT} = 49;
-$handles->{MPI_LONGDBL_INT} = 50;
+$handles->{MPI_LONG_DOUBLE_INT} = 50;
$handles->{MPI_LONG_INT} = 51;
$handles->{MPI_2INT} = 52;
$handles->{MPI_SHORT_INT} = 53;
$handles->{MPI_CXX_BOOL} = 54;
-$handles->{MPI_CXX_CPLEX} = 55;
-$handles->{MPI_CXX_DBLCPLEX} = 56;
-$handles->{MPI_CXX_LDBLCPLEX} = 57;
+$handles->{MPI_CXX_FLOAT_COMPLEX} = 55;
+$handles->{MPI_CXX_DOUBLE_COMPLEX} = 56;
+$handles->{MPI_CXX_LONG_DOUBLE_COMPLEX} = 57;
$handles->{MPI_INT8_T} = 58;
$handles->{MPI_UINT8_T} = 59;
$handles->{MPI_INT16_T} = 60;The problem is the two missing datatypes.
MPI_C_BOOL should be inserted between MPI_OFFSET and MPI_C_COMPLEX for natural ordering in ompi/include/mpif-values.pl (they are added in MPI-2.2; see ompi/datatype/ompi_datatype_module.c). But doing so will generate a incompatibility in user's Fortran program because indices of MPI_C_COMPLEX and others will be shifted. We have three options. Which will we take?
- Insert
MPI_C_BOOLbetweenMPI_OFFSETandMPI_C_COMPLEX, and merge it to v2.x branch before v2.0.0 is released. - Insert
MPI_C_BOOLas the last line (index: 73). - Insert
MPI_C_BOOLbetweenMPI_OFFSETandMPI_C_COMPLEXfor master. And
insertMPI_C_BOOLas the last line (index: 73) for v2.x
MPI_LONG_LONG is a synonym of MPI_LONG_LONG_INT and is not defined separately in ompi/datatype/ompi_datatype_module.c. So simply adding a line below in ompi/include/mpif-values.pl will solve the problem. But MPI_C_FLOAT_COMPLEX is also a synonym of MPI_C_COMPLEX and it is defined separately in ompi/datatype/ompi_datatype_module.c and has own index 68. The treatment is inconsistent between MPI_LONG_LONG and MPI_C_FLOAT_COMPLEX! Should we change the treatment of either synonym or keep the inconsistency?
--- a/ompi/include/mpif-values.pl
+++ b/ompi/include/mpif-values.pl
@@ -160,6 +160,7 @@ $handles->{MPI_UNSIGNED} = 40;
$handles->{MPI_LONG} = 41;
$handles->{MPI_UNSIGNED_LONG} = 42;
$handles->{MPI_LONG_LONG_INT} = 43;
+$handles->{MPI_LONG_LONG} = $handles->{MPI_LONG_LONG_INT};
$handles->{MPI_UNSIGNED_LONG_LONG} = 44;
$handles->{MPI_FLOAT} = 45;
$handles->{MPI_DOUBLE} = 46;The program I checked the Fortran binding with is in my gist. This program needs --enable-mpi-cxx on configure for MPI_CXX_* datatypes.