Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Add MPI_Type_size_x call
[simgrid.git] / src / smpi / smpi_pmpi.cpp
index dc58971..62ca0f1 100644 (file)
@@ -184,6 +184,21 @@ int PMPI_Type_size(MPI_Datatype datatype, int *size)
   return retval;
 }
 
+int PMPI_Type_size_x(MPI_Datatype datatype, MPI_Count *size)
+{
+  int retval = 0;
+
+  if (datatype == MPI_DATATYPE_NULL) {
+    retval = MPI_ERR_TYPE;
+  } else if (size == nullptr) {
+    retval = MPI_ERR_ARG;
+  } else {
+    *size = static_cast<MPI_Count>(smpi_datatype_size(datatype));
+    retval = MPI_SUCCESS;
+  }
+  return retval;
+}
+
 int PMPI_Type_get_extent(MPI_Datatype datatype, MPI_Aint * lb, MPI_Aint * extent)
 {
   int retval = 0;
@@ -499,7 +514,7 @@ int PMPI_Group_excl(MPI_Group group, int n, int *ranks, MPI_Group * newgroup)
   } else {
     if (n == 0) {
       *newgroup = group;
-      if(group!= smpi_comm_group(MPI_COMM_WORLD) && group != MPI_GROUP_NULL
+      if (group != smpi_comm_group(MPI_COMM_WORLD)
                 && group != smpi_comm_group(MPI_COMM_SELF) && group != MPI_GROUP_EMPTY)
       smpi_group_use(group);
     } else if (n == smpi_group_size(group)) {
@@ -602,7 +617,7 @@ int PMPI_Group_range_excl(MPI_Group group, int n, int ranges[][3], MPI_Group * n
   } else {
     if (n == 0) {
       *newgroup = group;
-      if(group!= smpi_comm_group(MPI_COMM_WORLD) && group != MPI_GROUP_NULL
+      if (group!= smpi_comm_group(MPI_COMM_WORLD)
                 && group != smpi_comm_group(MPI_COMM_SELF) && group != MPI_GROUP_EMPTY)
       smpi_group_use(group);
     } else {
@@ -1346,7 +1361,7 @@ int PMPI_Test(MPI_Request * request, int *flag, MPI_Status * status)
     smpi_empty_status(status);
     retval = MPI_SUCCESS;
   } else {
-    int rank = (request!=nullptr && (*request)->comm != MPI_COMM_NULL) ? smpi_process_index() : -1;
+    int rank = ((*request)->comm != MPI_COMM_NULL) ? smpi_process_index() : -1;
 
     instr_extra_data extra = xbt_new0(s_instr_extra_data_t,1);
     extra->type = TRACING_TEST;
@@ -1654,15 +1669,15 @@ int PMPI_Barrier(MPI_Comm comm)
   if (comm == MPI_COMM_NULL) {
     retval = MPI_ERR_COMM;
   } else {
-  int rank = comm != MPI_COMM_NULL ? smpi_process_index() : -1;
-  instr_extra_data extra = xbt_new0(s_instr_extra_data_t,1);
-  extra->type = TRACING_BARRIER;
-  TRACE_smpi_collective_in(rank, -1, __FUNCTION__, extra);
+    int rank               = comm != MPI_COMM_NULL ? smpi_process_index() : -1;
+    instr_extra_data extra = xbt_new0(s_instr_extra_data_t, 1);
+    extra->type            = TRACING_BARRIER;
+    TRACE_smpi_collective_in(rank, -1, __FUNCTION__, extra);
 
-  mpi_coll_barrier_fun(comm);
-  retval = MPI_SUCCESS;
+    mpi_coll_barrier_fun(comm);
+    retval = MPI_SUCCESS;
 
-  TRACE_smpi_collective_out(rank, -1, __FUNCTION__);
+    TRACE_smpi_collective_out(rank, -1, __FUNCTION__);
   }
 
   smpi_bench_begin();