Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
changes the way smpi tracing handles process ranks, to be able to use subgroups
[simgrid.git] / src / smpi / smpi_pmpi.c
index ebaa2f1..47a8e6d 100644 (file)
@@ -903,8 +903,8 @@ int PMPI_Irecv(void *buf, int count, MPI_Datatype datatype, int src,
 
   smpi_bench_end();
 #ifdef HAVE_TRACING
-  int rank = comm != MPI_COMM_NULL ? smpi_comm_rank(comm) : -1;
-  int src_traced = smpi_group_rank(smpi_comm_group(comm), src);
+  int rank = comm != MPI_COMM_NULL ? smpi_process_index() : -1;
+  int src_traced = smpi_group_index(smpi_comm_group(comm), src);
   TRACE_smpi_ptp_in(rank, src_traced, rank, __FUNCTION__);
 #endif
   if (request == NULL) {
@@ -931,9 +931,9 @@ int PMPI_Isend(void *buf, int count, MPI_Datatype datatype, int dst,
 
   smpi_bench_end();
 #ifdef HAVE_TRACING
-  int rank = comm != MPI_COMM_NULL ? smpi_comm_rank(comm) : -1;
+  int rank = comm != MPI_COMM_NULL ? smpi_process_index() : -1;
   TRACE_smpi_computing_out(rank);
-  int dst_traced = smpi_group_rank(smpi_comm_group(comm), dst);
+  int dst_traced = smpi_group_index(smpi_comm_group(comm), dst);
   TRACE_smpi_ptp_in(rank, rank, dst_traced, __FUNCTION__);
   TRACE_smpi_send(rank, rank, dst_traced);
 #endif
@@ -963,8 +963,8 @@ int PMPI_Recv(void *buf, int count, MPI_Datatype datatype, int src, int tag,
 
   smpi_bench_end();
 #ifdef HAVE_TRACING
-  int rank = comm != MPI_COMM_NULL ? smpi_comm_rank(comm) : -1;
-  int src_traced = smpi_group_rank(smpi_comm_group(comm), src);
+  int rank = comm != MPI_COMM_NULL ? smpi_process_index() : -1;
+  int src_traced = smpi_group_index(smpi_comm_group(comm), src);
   TRACE_smpi_computing_out(rank);
 
   TRACE_smpi_ptp_in(rank, src_traced, rank, __FUNCTION__);
@@ -977,7 +977,7 @@ int PMPI_Recv(void *buf, int count, MPI_Datatype datatype, int src, int tag,
   }
 #ifdef HAVE_TRACING
   //the src may not have been known at the beginning of the recv (MPI_ANY_SOURCE)
-  if(status!=MPI_STATUS_IGNORE)src_traced = smpi_group_rank(smpi_comm_group(comm), status->MPI_SOURCE);
+  if(status!=MPI_STATUS_IGNORE)src_traced = smpi_group_index(smpi_comm_group(comm), status->MPI_SOURCE);
   TRACE_smpi_ptp_out(rank, src_traced, rank, __FUNCTION__);
   TRACE_smpi_recv(rank, src_traced, rank);
   TRACE_smpi_computing_in(rank);
@@ -993,9 +993,9 @@ int PMPI_Send(void *buf, int count, MPI_Datatype datatype, int dst, int tag,
 
   smpi_bench_end();
 #ifdef HAVE_TRACING
-  int rank = comm != MPI_COMM_NULL ? smpi_comm_rank(comm) : -1;
+  int rank = comm != MPI_COMM_NULL ? smpi_process_index() : -1;
   TRACE_smpi_computing_out(rank);
-  int dst_traced = smpi_group_rank(smpi_comm_group(comm), dst);
+  int dst_traced = smpi_group_index(smpi_comm_group(comm), dst);
   TRACE_smpi_ptp_in(rank, rank, dst_traced, __FUNCTION__);
   TRACE_smpi_send(rank, rank, dst_traced);
 #endif
@@ -1022,10 +1022,10 @@ int PMPI_Sendrecv(void *sendbuf, int sendcount, MPI_Datatype sendtype,
 
   smpi_bench_end();
 #ifdef HAVE_TRACING
-  int rank = comm != MPI_COMM_NULL ? smpi_comm_rank(comm) : -1;
+  int rank = comm != MPI_COMM_NULL ? smpi_process_index() : -1;
   TRACE_smpi_computing_out(rank);
-  int dst_traced = smpi_group_rank(smpi_comm_group(comm), dst);
-  int src_traced = smpi_group_rank(smpi_comm_group(comm), src);
+  int dst_traced = smpi_group_index(smpi_comm_group(comm), dst);
+  int src_traced = smpi_group_index(smpi_comm_group(comm), src);
   TRACE_smpi_ptp_in(rank, src_traced, dst_traced, __FUNCTION__);
   TRACE_smpi_send(rank, rank, dst_traced);
   TRACE_smpi_send(rank, src_traced, rank);
@@ -1074,7 +1074,7 @@ int PMPI_Test(MPI_Request * request, int *flag, MPI_Status * status)
   int retval;
 
   smpi_bench_end();
-  if (request == NULL || flag == NULL) {
+  if (request == MPI_REQUEST_NULL || flag == NULL) {
     retval = MPI_ERR_ARG;
   } else if (*request == MPI_REQUEST_NULL) {
     retval = MPI_ERR_REQUEST;
@@ -1159,13 +1159,13 @@ int PMPI_Wait(MPI_Request * request, MPI_Status * status)
   smpi_bench_end();
 #ifdef HAVE_TRACING
   int rank = request && (*request)->comm != MPI_COMM_NULL
-      ? smpi_comm_rank((*request)->comm)
+      ? smpi_process_argc()
       : -1;
   TRACE_smpi_computing_out(rank);
 
   MPI_Group group = smpi_comm_group((*request)->comm);
-  int src_traced = smpi_group_rank(group, (*request)->src);
-  int dst_traced = smpi_group_rank(group, (*request)->dst);
+  int src_traced = smpi_group_index(group, (*request)->src);
+  int dst_traced = smpi_group_index(group, (*request)->dst);
   int is_wait_for_receive = (*request)->recv;
   TRACE_smpi_ptp_in(rank, src_traced, dst_traced, __FUNCTION__);
 #endif
@@ -1223,7 +1223,7 @@ int PMPI_Waitany(int count, MPI_Request requests[], int *index, MPI_Status * sta
       xbt_free(t);
     }
   }
-  int rank_traced = smpi_comm_rank(MPI_COMM_WORLD);
+  int rank_traced = smpi_process_index();
   TRACE_smpi_computing_out(rank_traced);
 
   TRACE_smpi_ptp_in(rank_traced, -1, -1, __FUNCTION__);
@@ -1280,7 +1280,7 @@ int PMPI_Waitall(int count, MPI_Request requests[], MPI_Status status[])
     xbt_free(adst);
     xbt_free(arecv);
   }
-  int rank_traced = smpi_comm_rank (MPI_COMM_WORLD);
+  int rank_traced = smpi_process_index();
   TRACE_smpi_computing_out(rank_traced);
 
   TRACE_smpi_ptp_in(rank_traced, -1, -1, __FUNCTION__);
@@ -1329,9 +1329,9 @@ int PMPI_Bcast(void *buf, int count, MPI_Datatype datatype, int root, MPI_Comm c
 
   smpi_bench_end();
 #ifdef HAVE_TRACING
-  int rank = comm != MPI_COMM_NULL ? smpi_comm_rank(comm) : -1;
+  int rank = comm != MPI_COMM_NULL ? smpi_process_index() : -1;
   TRACE_smpi_computing_out(rank);
-  int root_traced = smpi_group_rank(smpi_comm_group(comm), root);
+  int root_traced = smpi_group_index(smpi_comm_group(comm), root);
   TRACE_smpi_collective_in(rank, root_traced, __FUNCTION__);
 #endif
   if (comm == MPI_COMM_NULL) {
@@ -1354,7 +1354,7 @@ int PMPI_Barrier(MPI_Comm comm)
 
   smpi_bench_end();
 #ifdef HAVE_TRACING
-  int rank = comm != MPI_COMM_NULL ? smpi_comm_rank(comm) : -1;
+  int rank = comm != MPI_COMM_NULL ? smpi_process_index() : -1;
   TRACE_smpi_computing_out(rank);
   TRACE_smpi_collective_in(rank, -1, __FUNCTION__);
 #endif
@@ -1380,9 +1380,9 @@ int PMPI_Gather(void *sendbuf, int sendcount, MPI_Datatype sendtype,
 
   smpi_bench_end();
 #ifdef HAVE_TRACING
-  int rank = comm != MPI_COMM_NULL ? smpi_comm_rank(comm) : -1;
+  int rank = comm != MPI_COMM_NULL ? smpi_process_index() : -1;
   TRACE_smpi_computing_out(rank);
-  int root_traced = smpi_group_rank(smpi_comm_group(comm), root);
+  int root_traced = smpi_group_index(smpi_comm_group(comm), root);
   TRACE_smpi_collective_in(rank, root_traced, __FUNCTION__);
 #endif
   if (comm == MPI_COMM_NULL) {
@@ -1411,9 +1411,9 @@ int PMPI_Gatherv(void *sendbuf, int sendcount, MPI_Datatype sendtype,
 
   smpi_bench_end();
 #ifdef HAVE_TRACING
-  int rank = comm != MPI_COMM_NULL ? smpi_comm_rank(comm) : -1;
+  int rank = comm != MPI_COMM_NULL ? smpi_process_index() : -1;
   TRACE_smpi_computing_out(rank);
-  int root_traced = smpi_group_rank(smpi_comm_group(comm), root);
+  int root_traced = smpi_group_index(smpi_comm_group(comm), root);
   TRACE_smpi_collective_in(rank, root_traced, __FUNCTION__);
 #endif
   if (comm == MPI_COMM_NULL) {
@@ -1444,7 +1444,7 @@ int PMPI_Allgather(void *sendbuf, int sendcount, MPI_Datatype sendtype,
 
   smpi_bench_end();
 #ifdef HAVE_TRACING
-  int rank = comm != MPI_COMM_NULL ? smpi_comm_rank(comm) : -1;
+  int rank = comm != MPI_COMM_NULL ? smpi_process_index() : -1;
   TRACE_smpi_computing_out(rank);
   TRACE_smpi_collective_in(rank, -1, __FUNCTION__);
 #endif
@@ -1473,7 +1473,7 @@ int PMPI_Allgatherv(void *sendbuf, int sendcount, MPI_Datatype sendtype,
 
   smpi_bench_end();
 #ifdef HAVE_TRACING
-  int rank = comm != MPI_COMM_NULL ? smpi_comm_rank(comm) : -1;
+  int rank = comm != MPI_COMM_NULL ? smpi_process_index() : -1;
   TRACE_smpi_computing_out(rank);
   TRACE_smpi_collective_in(rank, -1, __FUNCTION__);
 #endif
@@ -1505,9 +1505,10 @@ int PMPI_Scatter(void *sendbuf, int sendcount, MPI_Datatype sendtype,
 
   smpi_bench_end();
 #ifdef HAVE_TRACING
-  int rank = comm != MPI_COMM_NULL ? smpi_comm_rank(comm) : -1;
+  int rank = comm != MPI_COMM_NULL ? smpi_process_index() : -1;
   TRACE_smpi_computing_out(rank);
-  int root_traced = smpi_group_rank(smpi_comm_group(comm), root);
+  int root_traced = smpi_group_index(smpi_comm_group(comm), root);
+
   TRACE_smpi_collective_in(rank, root_traced, __FUNCTION__);
 #endif
   if (comm == MPI_COMM_NULL) {
@@ -1536,9 +1537,9 @@ int PMPI_Scatterv(void *sendbuf, int *sendcounts, int *displs,
 
   smpi_bench_end();
 #ifdef HAVE_TRACING
-  int rank = comm != MPI_COMM_NULL ? smpi_comm_rank(comm) : -1;
+  int rank = comm != MPI_COMM_NULL ? smpi_process_index() : -1;
   TRACE_smpi_computing_out(rank);
-  int root_traced = smpi_group_rank(smpi_comm_group(comm), root);
+  int root_traced = smpi_group_index(smpi_comm_group(comm), root);
   TRACE_smpi_collective_in(rank, root_traced, __FUNCTION__);
 #endif
   if (comm == MPI_COMM_NULL) {
@@ -1568,9 +1569,9 @@ int PMPI_Reduce(void *sendbuf, void *recvbuf, int count,
 
   smpi_bench_end();
 #ifdef HAVE_TRACING
-  int rank = comm != MPI_COMM_NULL ? smpi_comm_rank(comm) : -1;
+  int rank = comm != MPI_COMM_NULL ? smpi_process_index() : -1;
   TRACE_smpi_computing_out(rank);
-  int root_traced = smpi_group_rank(smpi_comm_group(comm), root);
+  int root_traced = smpi_group_index(smpi_comm_group(comm), root);
   TRACE_smpi_collective_in(rank, root_traced, __FUNCTION__);
 #endif
   if (comm == MPI_COMM_NULL) {
@@ -1596,7 +1597,7 @@ int PMPI_Allreduce(void *sendbuf, void *recvbuf, int count,
 
   smpi_bench_end();
 #ifdef HAVE_TRACING
-  int rank = comm != MPI_COMM_NULL ? smpi_comm_rank(comm) : -1;
+  int rank = comm != MPI_COMM_NULL ? smpi_process_index() : -1;
   TRACE_smpi_computing_out(rank);
   TRACE_smpi_collective_in(rank, -1, __FUNCTION__);
 #endif
@@ -1625,7 +1626,7 @@ int PMPI_Scan(void *sendbuf, void *recvbuf, int count,
 
   smpi_bench_end();
 #ifdef HAVE_TRACING
-  int rank = comm != MPI_COMM_NULL ? smpi_comm_rank(comm) : -1;
+  int rank = comm != MPI_COMM_NULL ? smpi_process_index() : -1;
   TRACE_smpi_computing_out(rank);
   TRACE_smpi_collective_in(rank, -1, __FUNCTION__);
 #endif
@@ -1652,7 +1653,7 @@ int PMPI_Reduce_scatter(void *sendbuf, void *recvbuf, int *recvcounts,
 {
   int retval, i, size, count;
   int *displs;
-  int rank = comm != MPI_COMM_NULL ? smpi_comm_rank(comm) : -1;
+  int rank = comm != MPI_COMM_NULL ? smpi_process_index() : -1;
 
   smpi_bench_end();
 #ifdef HAVE_TRACING
@@ -1699,7 +1700,7 @@ int PMPI_Alltoall(void *sendbuf, int sendcount, MPI_Datatype sendtype,
 
   smpi_bench_end();
 #ifdef HAVE_TRACING
-  int rank = comm != MPI_COMM_NULL ? smpi_comm_rank(comm) : -1;
+  int rank = comm != MPI_COMM_NULL ? smpi_process_index() : -1;
   TRACE_smpi_computing_out(rank);
   TRACE_smpi_collective_in(rank, -1, __FUNCTION__);
 #endif
@@ -1744,7 +1745,7 @@ int PMPI_Alltoallv(void *sendbuf, int *sendcounts, int *senddisps,
 
   smpi_bench_end();
 #ifdef HAVE_TRACING
-  int rank = comm != MPI_COMM_NULL ? smpi_comm_rank(comm) : -1;
+  int rank = comm != MPI_COMM_NULL ? smpi_process_index() : -1;
   TRACE_smpi_computing_out(rank);
   TRACE_smpi_collective_in(rank, -1, __FUNCTION__);
 #endif