Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Use simgrid function instead of MPI in collectives
[simgrid.git] / src / smpi / colls / reduce-binomial.c
index 580e3db..76fef91 100644 (file)
@@ -1,4 +1,4 @@
-#include "colls.h"
+#include "colls_private.h"
 
 //#include <star-reduction.c>
 
@@ -16,14 +16,14 @@ int smpi_coll_tuned_reduce_binomial(void *sendbuf, void *recvbuf, int count,
 
   if (count == 0)
     return 0;
-  MPI_Comm_rank(comm, &rank);
-  MPI_Comm_size(comm, &comm_size);
+  rank = smpi_comm_rank(comm);
+  comm_size = smpi_comm_size(comm);
 
-  MPI_Type_extent(datatype, &extent);
+  extent = smpi_datatype_get_extent(datatype);
 
-  tmp_buf = (void *) malloc(count * extent);
+  tmp_buf = (void *) xbt_malloc(count * extent);
 
-  MPI_Sendrecv(sendbuf, count, datatype, rank, tag,
+  smpi_mpi_sendrecv(sendbuf, count, datatype, rank, tag,
                recvbuf, count, datatype, rank, tag, comm, &status);
   mask = 1;
   relrank = (rank - root + comm_size) % comm_size;
@@ -34,12 +34,12 @@ int smpi_coll_tuned_reduce_binomial(void *sendbuf, void *recvbuf, int count,
       source = (relrank | mask);
       if (source < comm_size) {
         source = (source + root) % comm_size;
-        MPI_Recv(tmp_buf, count, datatype, source, tag, comm, &status);
+        smpi_mpi_recv(tmp_buf, count, datatype, source, tag, comm, &status);
         star_reduction(op, tmp_buf, recvbuf, &count, &datatype);
       }
     } else {
       dst = ((relrank & (~mask)) + root) % comm_size;
-      MPI_Send(recvbuf, count, datatype, dst, tag, comm);
+      smpi_mpi_send(recvbuf, count, datatype, dst, tag, comm);
       break;
     }
     mask <<= 1;