Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[SMPI] Make MPI_DATATYPE_NULL a non-null object
authorChristian Heinrich <franz-christian.heinrich@inria.fr>
Fri, 6 Jul 2018 06:37:37 +0000 (08:37 +0200)
committerChristian Heinrich <franz-christian.heinrich@inria.fr>
Fri, 6 Jul 2018 06:39:58 +0000 (08:39 +0200)
We're calling methods on the Datatype objects, such as
datatype->size(), especially in the replay component.
With MPI_DATATYPE_NULL being the nullptr, we'd have to
check every time whether or not a given object is
actually MPI_DATATYPE_NULL before using it.

Making MPI_DATATYPE_NULL a real object allows us to call methods
on this object that will be meaningful (for instance, size() returns 0)
and to avoid this constant checking.

Thanks to Michael Mercier for reporting this bug.

include/smpi/smpi.h
src/smpi/mpi/smpi_datatype.cpp

index 12e2ae6..32630ee 100644 (file)
@@ -224,7 +224,7 @@ typedef SMPI_Info* MPI_Info;
 #define MPI_STATUS_IGNORE ((MPI_Status*)NULL)
 #define MPI_STATUSES_IGNORE ((MPI_Status*)NULL)
 
-#define MPI_DATATYPE_NULL ((const MPI_Datatype)NULL)
+XBT_PUBLIC_DATA const MPI_Datatype MPI_DATATYPE_NULL;
 XBT_PUBLIC_DATA const MPI_Datatype MPI_CHAR;
 XBT_PUBLIC_DATA const MPI_Datatype MPI_SHORT;
 XBT_PUBLIC_DATA const MPI_Datatype MPI_INT;
index 5e752c1..954dbc9 100644 (file)
@@ -76,6 +76,7 @@ CREATE_MPI_DATATYPE(MPI_REAL, 38, float);
 CREATE_MPI_DATATYPE(MPI_REAL4, 39, float);
 CREATE_MPI_DATATYPE(MPI_REAL8, 40, float);
 CREATE_MPI_DATATYPE(MPI_REAL16, 41, double);
+CREATE_MPI_DATATYPE_NULL(MPI_DATATYPE_NULL, -1);
 CREATE_MPI_DATATYPE_NULL(MPI_COMPLEX8, 42);
 CREATE_MPI_DATATYPE_NULL(MPI_COMPLEX16, 43);
 CREATE_MPI_DATATYPE_NULL(MPI_COMPLEX32, 44);