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

Public GIT Repository
[EXAMPLES] Added an example for the HostLoad plugin
[simgrid.git] / src / smpi / colls / allreduce-mvapich-rs.cpp
index 3bc2d5b7b7ff0c93e057b2b49f7b58409911f167..e887175454d528cf86b2e1a6b05d2bdde292435a 100644 (file)
@@ -46,11 +46,11 @@ int smpi_coll_tuned_allreduce_mvapich2_rs(void *sendbuf,
     int comm_size =  comm->size();
     int rank = comm->rank();
 
-    is_commutative = smpi_op_is_commute(op);
+    is_commutative = (op==MPI_OP_NULL || op->is_commutative());
 
     /* need to allocate temporary buffer to store incoming data */
-    smpi_datatype_extent(datatype, &true_lb, &true_extent);
-    extent = smpi_datatype_get_extent(datatype);
+    datatype->extent(&true_lb, &true_extent);
+    extent = datatype->get_extent();
 
     tmp_buf_free= smpi_get_tmp_recvbuffer(count * (MAX(extent, true_extent)));
 
@@ -60,7 +60,7 @@ int smpi_coll_tuned_allreduce_mvapich2_rs(void *sendbuf,
     /* copy local data into recvbuf */
     if (sendbuf != MPI_IN_PLACE) {
         mpi_errno =
-            smpi_datatype_copy(sendbuf, count, datatype, recvbuf, count,
+            Datatype::copy(sendbuf, count, datatype, recvbuf, count,
                            datatype);
     }
 
@@ -94,7 +94,7 @@ int smpi_coll_tuned_allreduce_mvapich2_rs(void *sendbuf,
             /* do the reduction on received data. since the
                ordering is right, it doesn't matter whether
                the operation is commutative or not. */
-               smpi_op_apply(op, tmp_buf, recvbuf, &count, &datatype);
+               if(op!=MPI_OP_NULL) op->apply( tmp_buf, recvbuf, &count, datatype);
                 /* change the rank */
                 newrank = rank / 2;
         }
@@ -132,12 +132,12 @@ int smpi_coll_tuned_allreduce_mvapich2_rs(void *sendbuf,
 
                 if (is_commutative || (dst < rank)) {
                     /* op is commutative OR the order is already right */
-                     smpi_op_apply(op, tmp_buf, recvbuf, &count, &datatype);
+                     if(op!=MPI_OP_NULL) op->apply( tmp_buf, recvbuf, &count, datatype);
                 } else {
                     /* op is noncommutative and the order is not right */
-                    smpi_op_apply(op, recvbuf, tmp_buf, &count, &datatype);
+                    if(op!=MPI_OP_NULL) op->apply( recvbuf, tmp_buf, &count, datatype);
                     /* copy result back into recvbuf */
-                    mpi_errno = smpi_datatype_copy(tmp_buf, count, datatype,
+                    mpi_errno = Datatype::copy(tmp_buf, count, datatype,
                                                recvbuf, count, datatype);
                 }
                 mask <<= 1;
@@ -202,9 +202,9 @@ int smpi_coll_tuned_allreduce_mvapich2_rs(void *sendbuf,
                 /* This algorithm is used only for predefined ops
                    and predefined ops are always commutative. */
 
-                smpi_op_apply(op, (char *) tmp_buf + disps[recv_idx] * extent,
+                if(op!=MPI_OP_NULL) op->apply( (char *) tmp_buf + disps[recv_idx] * extent,
                         (char *) recvbuf + disps[recv_idx] * extent,
-                        &recv_cnt, &datatype);
+                        &recv_cnt, datatype);
 
                 /* update send_idx for next iteration */
                 send_idx = recv_idx;