Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
* MPI_Sendrecv user+internal levels
[simgrid.git] / src / smpi / smpi_mpi.c
index 4ee1d8a..c1f5253 100644 (file)
@@ -191,10 +191,11 @@ int SMPI_MPI_Send(void *buf, int count, MPI_Datatype datatype, int dst,
   return retval;
 }
 
+
 /**
- * MPI_Sendrecv
+ * MPI_Sendrecv internal level 
  **/
-int SMPI_MPI_Sendrecv(void *sendbuf, int sendcount, MPI_Datatype sendtype, int dest, int sendtag, 
+int smpi_mpi_sendrecv(void *sendbuf, int sendcount, MPI_Datatype sendtype, int dest, int sendtag, 
                    void *recvbuf, int recvcount, MPI_Datatype recvtype, int source, int recvtag,
                    MPI_Comm comm, MPI_Status *status)
 {
@@ -206,36 +207,43 @@ smpi_mpi_request_t rrequest;
          rank = smpi_mpi_comm_rank(comm);
 
          /* send */
-         /* -------------*/
-           retval = smpi_create_request(sendbuf, sendcount, sendtype, 
+         retval = smpi_create_request(sendbuf, sendcount, sendtype, 
                                rank,dest,sendtag, 
                                comm, &srequest);
-         printf("[%d] isend request src=%d -> dst=%d (retval=%d)\n",rank,rank,dest,retval);
          smpi_mpi_isend(srequest);
         
-         
-         //retval = MPI_Isend( sendbuf, sendcount, sendtype, dest, sendtag, MPI_COMM_WORLD, &srequest);
-
-
          /* recv */
          retval = smpi_create_request(recvbuf, recvcount, recvtype, 
                                source, rank,recvtag, 
                                comm, &rrequest);
-         printf("[%d] irecv request src=%d -> dst=%d (retval=%d)\n",rank,source,rank,retval);
          smpi_mpi_irecv(rrequest);
 
-         //retval = MPI_Irecv( recvbuf, recvcount, recvtype, source, recvtag, MPI_COMM_WORLD, &rrequest);
-
-
          smpi_mpi_wait(srequest, MPI_STATUS_IGNORE);
-         printf("[%d] isend request src=%d dst=%d tag=%d COMPLETED (retval=%d) \n",rank,rank,dest,sendtag,retval);
-
+         //printf("[%d] isend request src=%d dst=%d tag=%d COMPLETED (retval=%d) \n",rank,rank,dest,sendtag,retval);
          smpi_mpi_wait(rrequest, MPI_STATUS_IGNORE);
-         printf("[%d] irecv request src=%d -> dst=%d tag=%d COMPLETED (retval=%d)\n",rank,source,rank,recvtag,retval);
+         //printf("[%d] irecv request src=%d -> dst=%d tag=%d COMPLETED (retval=%d)\n",rank,source,rank,recvtag,retval);
 
          return(retval);
 }
+/**
+ * MPI_Sendrecv user entry point
+ **/
+int SMPI_MPI_Sendrecv(void *sendbuf, int sendcount, MPI_Datatype sendtype, int dest, int sendtag, 
+                   void *recvbuf, int recvcount, MPI_Datatype recvtype, int source, int recvtag,
+                   MPI_Comm comm, MPI_Status *status)
+{
+int retval = MPI_SUCCESS;
+
+  smpi_bench_end();
+  smpi_mpi_sendrecv( sendbuf, sendcount, sendtype, dest, sendtag, 
+                        recvbuf, recvcount, recvtype, source, recvtag,
+                        comm, status);
+  smpi_bench_begin();
 
+  return retval;
+
+       
+}
 
 /**
  * MPI_Wait and friends
@@ -349,7 +357,7 @@ static void print_buffer_double(void *buf, int len, char *msg, int rank)
 
 #endif
 /**
- * MPI_Reduce
+ * MPI_Reduce internal level 
  **/
 int smpi_mpi_reduce(void *sendbuf, void *recvbuf, int count,
                 MPI_Datatype datatype, MPI_Op op, int root, MPI_Comm comm)
@@ -476,9 +484,6 @@ int root=0;  // arbitrary choice
 /**
  * MPI_Scatter user entry point
  **/
-//int SMPI_MPI_Scatter(void *sendbuf, int sendcount, MPI_Datatype datatype, 
-//                      void *recvbuf, int recvcount, MPI_Datatype recvtype,int root,
-//                     MPI_Comm comm);
 int SMPI_MPI_Scatter(void *sendbuf, int sendcount, MPI_Datatype datatype, 
                         void *recvbuf, int recvcount, MPI_Datatype recvtype,
                           int root, MPI_Comm comm)