Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
welcome simgrid::smpi::Request
[simgrid.git] / src / smpi / colls / bcast-SMP-binary.cpp
index b551d84..05cacd5 100644 (file)
@@ -57,9 +57,9 @@ int smpi_coll_tuned_bcast_SMP_binary(void *buf, int count,
   // if root is not zero send to rank zero first
   if (root != 0) {
     if (rank == root)
-      smpi_mpi_send(buf, count, datatype, 0, tag, comm);
+      Request::send(buf, count, datatype, 0, tag, comm);
     else if (rank == 0)
-      smpi_mpi_recv(buf, count, datatype, root, tag, comm, &status);
+      Request::recv(buf, count, datatype, root, tag, comm, &status);
   }
   // when a message is smaller than a block size => no pipeline 
   if (count <= segment) {
@@ -69,52 +69,52 @@ int smpi_coll_tuned_bcast_SMP_binary(void *buf, int count,
       if (rank == 0) {
         //printf("node %d left %d right %d\n",rank,to_inter_left,to_inter_right);
         if (to_inter_left < size)
-          smpi_mpi_send(buf, count, datatype, to_inter_left, tag, comm);
+          Request::send(buf, count, datatype, to_inter_left, tag, comm);
         if (to_inter_right < size)
-          smpi_mpi_send(buf, count, datatype, to_inter_right, tag, comm);
+          Request::send(buf, count, datatype, to_inter_right, tag, comm);
         if ((to_intra_left - base) < num_core)
-          smpi_mpi_send(buf, count, datatype, to_intra_left, tag, comm);
+          Request::send(buf, count, datatype, to_intra_left, tag, comm);
         if ((to_intra_right - base) < num_core)
-          smpi_mpi_send(buf, count, datatype, to_intra_right, tag, comm);
+          Request::send(buf, count, datatype, to_intra_right, tag, comm);
       }
       // case LEAVES ROOT-of-eash-SMP
       else if (to_inter_left >= size) {
         //printf("node %d from %d\n",rank,from_inter);
-        request = smpi_mpi_irecv(buf, count, datatype, from_inter, tag, comm);
-        smpi_mpi_wait(&request, &status);
+        request = Request::irecv(buf, count, datatype, from_inter, tag, comm);
+        Request::wait(&request, &status);
         if ((to_intra_left - base) < num_core)
-          smpi_mpi_send(buf, count, datatype, to_intra_left, tag, comm);
+          Request::send(buf, count, datatype, to_intra_left, tag, comm);
         if ((to_intra_right - base) < num_core)
-          smpi_mpi_send(buf, count, datatype, to_intra_right, tag, comm);
+          Request::send(buf, count, datatype, to_intra_right, tag, comm);
       }
       // case INTERMEDIAT ROOT-of-each-SMP
       else {
         //printf("node %d left %d right %d from %d\n",rank,to_inter_left,to_inter_right,from_inter);
-        request = smpi_mpi_irecv(buf, count, datatype, from_inter, tag, comm);
-        smpi_mpi_wait(&request, &status);
-        smpi_mpi_send(buf, count, datatype, to_inter_left, tag, comm);
+        request = Request::irecv(buf, count, datatype, from_inter, tag, comm);
+        Request::wait(&request, &status);
+        Request::send(buf, count, datatype, to_inter_left, tag, comm);
         if (to_inter_right < size)
-          smpi_mpi_send(buf, count, datatype, to_inter_right, tag, comm);
+          Request::send(buf, count, datatype, to_inter_right, tag, comm);
         if ((to_intra_left - base) < num_core)
-          smpi_mpi_send(buf, count, datatype, to_intra_left, tag, comm);
+          Request::send(buf, count, datatype, to_intra_left, tag, comm);
         if ((to_intra_right - base) < num_core)
-          smpi_mpi_send(buf, count, datatype, to_intra_right, tag, comm);
+          Request::send(buf, count, datatype, to_intra_right, tag, comm);
       }
     }
     // case non ROOT-of-each-SMP
     else {
       // case leaves
       if ((to_intra_left - base) >= num_core) {
-        request = smpi_mpi_irecv(buf, count, datatype, from_intra, tag, comm);
-        smpi_mpi_wait(&request, &status);
+        request = Request::irecv(buf, count, datatype, from_intra, tag, comm);
+        Request::wait(&request, &status);
       }
       // case intermediate
       else {
-        request = smpi_mpi_irecv(buf, count, datatype, from_intra, tag, comm);
-        smpi_mpi_wait(&request, &status);
-        smpi_mpi_send(buf, count, datatype, to_intra_left, tag, comm);
+        request = Request::irecv(buf, count, datatype, from_intra, tag, comm);
+        Request::wait(&request, &status);
+        Request::send(buf, count, datatype, to_intra_left, tag, comm);
         if ((to_intra_right - base) < num_core)
-          smpi_mpi_send(buf, count, datatype, to_intra_right, tag, comm);
+          Request::send(buf, count, datatype, to_intra_right, tag, comm);
       }
     }
 
@@ -135,16 +135,16 @@ int smpi_coll_tuned_bcast_SMP_binary(void *buf, int count,
         for (i = 0; i < pipe_length; i++) {
           //printf("node %d left %d right %d\n",rank,to_inter_left,to_inter_right);
           if (to_inter_left < size)
-            smpi_mpi_send((char *) buf + (i * increment), segment, datatype,
+            Request::send((char *) buf + (i * increment), segment, datatype,
                      to_inter_left, (tag + i), comm);
           if (to_inter_right < size)
-            smpi_mpi_send((char *) buf + (i * increment), segment, datatype,
+            Request::send((char *) buf + (i * increment), segment, datatype,
                      to_inter_right, (tag + i), comm);
           if ((to_intra_left - base) < num_core)
-            smpi_mpi_send((char *) buf + (i * increment), segment, datatype,
+            Request::send((char *) buf + (i * increment), segment, datatype,
                      to_intra_left, (tag + i), comm);
           if ((to_intra_right - base) < num_core)
-            smpi_mpi_send((char *) buf + (i * increment), segment, datatype,
+            Request::send((char *) buf + (i * increment), segment, datatype,
                      to_intra_right, (tag + i), comm);
         }
       }
@@ -152,16 +152,16 @@ int smpi_coll_tuned_bcast_SMP_binary(void *buf, int count,
       else if (to_inter_left >= size) {
         //printf("node %d from %d\n",rank,from_inter);
         for (i = 0; i < pipe_length; i++) {
-          request_array[i] = smpi_mpi_irecv((char *) buf + (i * increment), segment, datatype,
+          request_array[i] = Request::irecv((char *) buf + (i * increment), segment, datatype,
                     from_inter, (tag + i), comm);
         }
         for (i = 0; i < pipe_length; i++) {
-          smpi_mpi_wait(&request_array[i], &status);
+          Request::wait(&request_array[i], &status);
           if ((to_intra_left - base) < num_core)
-            smpi_mpi_send((char *) buf + (i * increment), segment, datatype,
+            Request::send((char *) buf + (i * increment), segment, datatype,
                      to_intra_left, (tag + i), comm);
           if ((to_intra_right - base) < num_core)
-            smpi_mpi_send((char *) buf + (i * increment), segment, datatype,
+            Request::send((char *) buf + (i * increment), segment, datatype,
                      to_intra_right, (tag + i), comm);
         }
       }
@@ -169,21 +169,21 @@ int smpi_coll_tuned_bcast_SMP_binary(void *buf, int count,
       else {
         //printf("node %d left %d right %d from %d\n",rank,to_inter_left,to_inter_right,from_inter);
         for (i = 0; i < pipe_length; i++) {
-          request_array[i] = smpi_mpi_irecv((char *) buf + (i * increment), segment, datatype,
+          request_array[i] = Request::irecv((char *) buf + (i * increment), segment, datatype,
                     from_inter, (tag + i), comm);
         }
         for (i = 0; i < pipe_length; i++) {
-          smpi_mpi_wait(&request_array[i], &status);
-          smpi_mpi_send((char *) buf + (i * increment), segment, datatype,
+          Request::wait(&request_array[i], &status);
+          Request::send((char *) buf + (i * increment), segment, datatype,
                    to_inter_left, (tag + i), comm);
           if (to_inter_right < size)
-            smpi_mpi_send((char *) buf + (i * increment), segment, datatype,
+            Request::send((char *) buf + (i * increment), segment, datatype,
                      to_inter_right, (tag + i), comm);
           if ((to_intra_left - base) < num_core)
-            smpi_mpi_send((char *) buf + (i * increment), segment, datatype,
+            Request::send((char *) buf + (i * increment), segment, datatype,
                      to_intra_left, (tag + i), comm);
           if ((to_intra_right - base) < num_core)
-            smpi_mpi_send((char *) buf + (i * increment), segment, datatype,
+            Request::send((char *) buf + (i * increment), segment, datatype,
                      to_intra_right, (tag + i), comm);
         }
       }
@@ -193,23 +193,23 @@ int smpi_coll_tuned_bcast_SMP_binary(void *buf, int count,
       // case leaves
       if ((to_intra_left - base) >= num_core) {
         for (i = 0; i < pipe_length; i++) {
-          request_array[i] = smpi_mpi_irecv((char *) buf + (i * increment), segment, datatype,
+          request_array[i] = Request::irecv((char *) buf + (i * increment), segment, datatype,
                     from_intra, (tag + i), comm);
         }
-        smpi_mpi_waitall((pipe_length), request_array, status_array);
+        Request::waitall((pipe_length), request_array, status_array);
       }
       // case intermediate
       else {
         for (i = 0; i < pipe_length; i++) {
-          request_array[i] = smpi_mpi_irecv((char *) buf + (i * increment), segment, datatype,
+          request_array[i] = Request::irecv((char *) buf + (i * increment), segment, datatype,
                     from_intra, (tag + i), comm);
         }
         for (i = 0; i < pipe_length; i++) {
-          smpi_mpi_wait(&request_array[i], &status);
-          smpi_mpi_send((char *) buf + (i * increment), segment, datatype,
+          Request::wait(&request_array[i], &status);
+          Request::send((char *) buf + (i * increment), segment, datatype,
                    to_intra_left, (tag + i), comm);
           if ((to_intra_right - base) < num_core)
-            smpi_mpi_send((char *) buf + (i * increment), segment, datatype,
+            Request::send((char *) buf + (i * increment), segment, datatype,
                      to_intra_right, (tag + i), comm);
         }
       }