Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Copy the group when doing a comm_split, to avoid to have shared objects with referenc...
[simgrid.git] / src / smpi / smpi_pmpi.c
index e79d126..26e809b 100644 (file)
@@ -350,14 +350,17 @@ int PMPI_Group_translate_ranks(MPI_Group group1, int n, int *ranks1,
                               MPI_Group group2, int *ranks2)
 {
   int retval, i, index;
-
   smpi_bench_end();
   if (group1 == MPI_GROUP_NULL || group2 == MPI_GROUP_NULL) {
     retval = MPI_ERR_GROUP;
   } else {
     for (i = 0; i < n; i++) {
-      index = smpi_group_index(group1, ranks1[i]);
-      ranks2[i] = smpi_group_rank(group2, index);
+      if(ranks1[i]==MPI_PROC_NULL){
+        ranks2[i]=MPI_PROC_NULL;
+      }else{
+        index = smpi_group_index(group1, ranks1[i]);
+        ranks2[i] = smpi_group_rank(group2, index);
+      }
     }
     retval = MPI_SUCCESS;
   }
@@ -603,26 +606,25 @@ int PMPI_Group_range_incl(MPI_Group group, int n, int ranges[][3],
         }
       }
 
-        *newgroup = smpi_group_new(size);
-        j = 0;
-        for (i = 0; i < n; i++) {
-          for (rank = ranges[i][0];     /* First */
-               rank >= 0; /* Last */
-               ) {
-            index = smpi_group_index(group, rank);
-            smpi_group_set_mapping(*newgroup, index, j);
-            j++;
-            rank += ranges[i][2]; /* Stride */
-           if (ranges[i][0]<ranges[i][1]){
-             if(rank > ranges[i][1])
-               break;
-           }else{
-             if(rank < ranges[i][1])
-               break;
-           }
-          }
+      *newgroup = smpi_group_new(size);
+      j = 0;
+      for (i = 0; i < n; i++) {
+        for (rank = ranges[i][0];     /* First */
+             rank >= 0; /* Last */
+             ) {
+          index = smpi_group_index(group, rank);
+          smpi_group_set_mapping(*newgroup, index, j);
+          j++;
+          rank += ranges[i][2]; /* Stride */
+         if (ranges[i][0]<ranges[i][1]){
+           if(rank > ranges[i][1])
+             break;
+         }else{
+           if(rank < ranges[i][1])
+             break;
+         }
         }
-      //}
+      }
     }
     smpi_group_use(*newgroup);
     retval = MPI_SUCCESS;
@@ -1565,7 +1567,7 @@ int PMPI_Waitsome(int incount, MPI_Request requests[], int *outcount,
   int retval;
 
   smpi_bench_end();
-  if (outcount == NULL || indices == NULL) {
+  if (outcount == NULL) {
     retval = MPI_ERR_ARG;
   } else {
     *outcount = smpi_mpi_waitsome(incount, requests, indices, status);
@@ -1581,7 +1583,7 @@ int PMPI_Testsome(int incount, MPI_Request requests[], int* outcount,
   int retval;
 
    smpi_bench_end();
-   if (outcount == NULL || indices == NULL) {
+   if (outcount == NULL) {
      retval = MPI_ERR_ARG;
    } else {
      *outcount = smpi_mpi_testsome(incount, requests, indices, status);
@@ -2010,6 +2012,34 @@ int PMPI_Scan(void *sendbuf, void *recvbuf, int count,
   return retval;
 }
 
+int PMPI_Exscan(void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype,
+                MPI_Op op, MPI_Comm comm){
+  int retval;
+
+  smpi_bench_end();
+#ifdef HAVE_TRACING
+  int rank = comm != MPI_COMM_NULL ? smpi_process_index() : -1;
+  TRACE_smpi_computing_out(rank);
+  TRACE_smpi_collective_in(rank, -1, __FUNCTION__);
+#endif
+  if (comm == MPI_COMM_NULL) {
+    retval = MPI_ERR_COMM;
+  } else if (datatype == MPI_DATATYPE_NULL) {
+    retval = MPI_ERR_TYPE;
+  } else if (op == MPI_OP_NULL) {
+    retval = MPI_ERR_OP;
+  } else {
+    smpi_mpi_exscan(sendbuf, recvbuf, count, datatype, op, comm);
+    retval = MPI_SUCCESS;
+  }
+#ifdef HAVE_TRACING
+  TRACE_smpi_collective_out(rank, -1, __FUNCTION__);
+  TRACE_smpi_computing_in(rank);
+#endif
+  smpi_bench_begin();
+  return retval;
+}
+
 int PMPI_Reduce_scatter(void *sendbuf, void *recvbuf, int *recvcounts,
                        MPI_Datatype datatype, MPI_Op op, MPI_Comm comm)
 {
@@ -2683,11 +2713,6 @@ int PMPI_Alltoallw( void *sendbuf, int *sendcnts, int *sdispls, MPI_Datatype *se
   NOT_YET_IMPLEMENTED
 }
 
-int PMPI_Exscan(void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype,
-                MPI_Op op, MPI_Comm comm){
-  NOT_YET_IMPLEMENTED
-}
-
 int PMPI_Comm_set_name(MPI_Comm comm, char* name){
   NOT_YET_IMPLEMENTED
 }