]> AND Public Git Repository - simgrid.git/blobdiff - src/smpi/colls/reduce-binomial.cpp
Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[EXAMPLES] Added an example for the HostLoad plugin
[simgrid.git] / src / smpi / colls / reduce-binomial.cpp
index c35390d5c8b755124ebc3f5b91d332c180662798..ebf0c1e1e707ddf49e336ebe63bbc4892de22608 100644 (file)
@@ -25,10 +25,10 @@ int smpi_coll_tuned_reduce_binomial(void *sendbuf, void *recvbuf, int count,
   rank = comm->rank();
   comm_size = comm->size();
 
-  extent = smpi_datatype_get_extent(datatype);
+  extent = datatype->get_extent();
 
   tmp_buf = (void *) smpi_get_tmp_sendbuffer(count * extent);
-  int is_commutative = smpi_op_is_commute(op);
+  int is_commutative =  (op==MPI_OP_NULL || op->is_commutative());
   mask = 1;
   
   int lroot;
@@ -38,7 +38,7 @@ int smpi_coll_tuned_reduce_binomial(void *sendbuf, void *recvbuf, int count,
         lroot   = 0;
   relrank = (rank - lroot + comm_size) % comm_size;
 
-  smpi_datatype_extent(datatype, &true_lb, &true_extent);
+  datatype->extent(&true_lb, &true_extent);
 
   /* adjust for potential negative lower bound in datatype */
   tmp_buf = (void *)((char*)tmp_buf - true_lb);
@@ -50,7 +50,7 @@ int smpi_coll_tuned_reduce_binomial(void *sendbuf, void *recvbuf, int count,
       recvbuf = (void *)((char*)recvbuf - true_lb);
   }
    if ((rank != root) || (sendbuf != MPI_IN_PLACE)) {
-      smpi_datatype_copy(sendbuf, count, datatype, recvbuf,count, datatype);
+      Datatype::copy(sendbuf, count, datatype, recvbuf,count, datatype);
   }
 
   while (mask < comm_size) {
@@ -62,10 +62,10 @@ int smpi_coll_tuned_reduce_binomial(void *sendbuf, void *recvbuf, int count,
         Request::recv(tmp_buf, count, datatype, source, tag, comm, &status);
         
         if (is_commutative) {
-          smpi_op_apply(op, tmp_buf, recvbuf, &count, &datatype);
+          if(op!=MPI_OP_NULL) op->apply( tmp_buf, recvbuf, &count, datatype);
         } else {
-          smpi_op_apply(op, recvbuf, tmp_buf, &count, &datatype);
-          smpi_datatype_copy(tmp_buf, count, datatype,recvbuf, count, datatype);
+          if(op!=MPI_OP_NULL) op->apply( recvbuf, tmp_buf, &count, datatype);
+          Datatype::copy(tmp_buf, count, datatype,recvbuf, count, datatype);
         }
       }
     } else {