Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Cannot have comm == MPI_COMM_NULL here.
[simgrid.git] / src / smpi / bindings / smpi_pmpi_request.cpp
index c8ef0ec..a896991 100644 (file)
@@ -157,7 +157,7 @@ int PMPI_Irecv(void *buf, int count, MPI_Datatype datatype, int src, int tag, MP
     retval = MPI_ERR_TAG;
   } else {
 
-    int rank = comm != MPI_COMM_NULL ? smpi_process()->index() : -1;
+    int rank       = smpi_process()->index();
     int src_traced = comm->group()->index(src);
 
     instr_extra_data extra = xbt_new0(s_instr_extra_data_t,1);
@@ -206,7 +206,7 @@ int PMPI_Isend(void *buf, int count, MPI_Datatype datatype, int dst, int tag, MP
   } else if(tag<0 && tag !=  MPI_ANY_TAG){
     retval = MPI_ERR_TAG;
   } else {
-    int rank = comm != MPI_COMM_NULL ? smpi_process()->index() : -1;
+    int rank               = smpi_process()->index();
     int dst_traced = comm->group()->index(dst);
     instr_extra_data extra = xbt_new0(s_instr_extra_data_t,1);
     extra->type = TRACING_ISEND;
@@ -254,7 +254,7 @@ int PMPI_Issend(void* buf, int count, MPI_Datatype datatype, int dst, int tag, M
   } else if(tag<0 && tag !=  MPI_ANY_TAG){
     retval = MPI_ERR_TAG;
   } else {
-    int rank = comm != MPI_COMM_NULL ? smpi_process()->index() : -1;
+    int rank               = smpi_process()->index();
     int dst_traced = comm->group()->index(dst);
     instr_extra_data extra = xbt_new0(s_instr_extra_data_t,1);
     extra->type = TRACING_ISSEND;
@@ -301,7 +301,7 @@ int PMPI_Recv(void *buf, int count, MPI_Datatype datatype, int src, int tag, MPI
   } else if(tag<0 && tag !=  MPI_ANY_TAG){
     retval = MPI_ERR_TAG;
   } else {
-    int rank               = comm != MPI_COMM_NULL ? smpi_process()->index() : -1;
+    int rank               = smpi_process()->index();
     int src_traced         = comm->group()->index(src);
     instr_extra_data extra = xbt_new0(s_instr_extra_data_t, 1);
     extra->type            = TRACING_RECV;
@@ -351,7 +351,7 @@ int PMPI_Send(void *buf, int count, MPI_Datatype datatype, int dst, int tag, MPI
   } else if(tag < 0 && tag !=  MPI_ANY_TAG){
     retval = MPI_ERR_TAG;
   } else {
-    int rank               = comm != MPI_COMM_NULL ? smpi_process()->index() : -1;
+    int rank               = smpi_process()->index();
     int dst_traced         = comm->group()->index(dst);
     instr_extra_data extra = xbt_new0(s_instr_extra_data_t,1);
     extra->type            = TRACING_SEND;
@@ -397,7 +397,7 @@ int PMPI_Ssend(void* buf, int count, MPI_Datatype datatype, int dst, int tag, MP
   } else if(tag<0 && tag !=  MPI_ANY_TAG){
     retval = MPI_ERR_TAG;
   } else {
-    int rank               = comm != MPI_COMM_NULL ? smpi_process()->index() : -1;
+    int rank               = smpi_process()->index();
     int dst_traced         = comm->group()->index(dst);
     instr_extra_data extra = xbt_new0(s_instr_extra_data_t,1);
     extra->type            = TRACING_SSEND;
@@ -448,7 +448,7 @@ int PMPI_Sendrecv(void* sendbuf, int sendcount, MPI_Datatype sendtype, int dst,
     retval = MPI_ERR_TAG;
   } else {
 
-    int rank               = comm != MPI_COMM_NULL ? smpi_process()->index() : -1;
+    int rank               = smpi_process()->index();
     int dst_traced         = comm->group()->index(dst);
     int src_traced         = comm->group()->index(src);
     instr_extra_data extra = xbt_new0(s_instr_extra_data_t, 1);
@@ -613,8 +613,7 @@ int PMPI_Wait(MPI_Request * request, MPI_Status * status)
   } else if (*request == MPI_REQUEST_NULL) {
     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;
 
     int src_traced = (*request)->src();
     int dst_traced = (*request)->dst();
@@ -645,7 +644,7 @@ int PMPI_Waitany(int count, MPI_Request requests[], int *index, MPI_Status * sta
 {
   if (index == nullptr)
     return MPI_ERR_ARG;
-  
+
   if (count <= 0)
     return MPI_SUCCESS;
 
@@ -658,9 +657,7 @@ int PMPI_Waitany(int count, MPI_Request requests[], int *index, MPI_Status * sta
     int tag;
     MPI_Comm comm;
   } savedvalstype;
-  savedvalstype* savedvals=nullptr;
-
-  savedvals = xbt_new0(savedvalstype, count);
+  savedvalstype* savedvals = xbt_new0(savedvalstype, count);
 
   for (int i = 0; i < count; i++) {
     MPI_Request req = requests[i];      //already received requests are no longer valid