Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Fix bug in SMPI with permanent receive mode.
[simgrid.git] / src / smpi / smpi_mpi_dt.c
index 852b4d4..29843af 100644 (file)
@@ -182,12 +182,20 @@ MPI_Datatype smpi_datatype_dup(MPI_Datatype datatype)
 int smpi_datatype_extent(MPI_Datatype datatype, MPI_Aint * lb,
                          MPI_Aint * extent)
 {
+  if(datatype == MPI_DATATYPE_NULL){
+    *lb=0;
+    *extent=0;
+    return MPI_SUCCESS;
+  }
   *lb = datatype->lb;
   *extent = datatype->ub - datatype->lb;
   return MPI_SUCCESS;
 }
 
 MPI_Aint smpi_datatype_get_extent(MPI_Datatype datatype){
+  if(datatype == MPI_DATATYPE_NULL){
+    return 0;
+  }
   return datatype->ub - datatype->lb;
 }
 
@@ -205,7 +213,7 @@ int smpi_datatype_copy(void *sendbuf, int sendcount, MPI_Datatype sendtype,
 {
   int count;
   if(smpi_privatize_global_variables){
-    switch_data_segment(smpi_process_index());
+    smpi_switch_data_segment(smpi_process_index());
   }
   /* First check if we really have something to do */
   if (recvcount > 0 && recvbuf != sendbuf) {
@@ -1608,8 +1616,8 @@ void smpi_op_apply(MPI_Op op, void *invec, void *inoutvec, int *len,
                    MPI_Datatype * datatype)
 {
   if(smpi_privatize_global_variables){ //we need to switch here, as the called function may silently touch global variables
-    XBT_VERB("Applying operation, switch to the right data frame ");
-    switch_data_segment(smpi_process_index());
+    XBT_DEBUG("Applying operation, switch to the right data frame ");
+    smpi_switch_data_segment(smpi_process_index());
   }
 
   if(!_xbt_replay_is_active())