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

Public GIT Repository
correct/remove include of rename xbt/replay.h
[simgrid.git] / src / smpi / colls / reduce_scatter-ompi.cpp
index 2838220cea991af8889da15b083a5885a2f61803..0afa9b72cce52fc869edab21e6c418cc0470b98b 100644 (file)
@@ -23,7 +23,6 @@
 
 #include "colls_private.h"
 #include "coll_tuned_topo.h"
-#include "xbt/replay.h"
 
 /*
  * Recursive-halving function is (*mostly*) copied from the BASIC coll module.
@@ -62,7 +61,7 @@ smpi_coll_tuned_reduce_scatter_ompi_basic_recursivehalving(void *sbuf,
     size = comm->size();
    
     XBT_DEBUG("coll:tuned:reduce_scatter_ompi_basic_recursivehalving, rank %d", rank);
-    if(!smpi_op_is_commute(op))
+    if( (op!=MPI_OP_NULL && !op->is_commutative()))
       THROWF(arg_error,0, " reduce_scatter ompi_basic_recursivehalving can only be used for commutative operations! ");
 
     /* Find displacements and the like */
@@ -82,8 +81,8 @@ smpi_coll_tuned_reduce_scatter_ompi_basic_recursivehalving(void *sbuf,
     }
 
     /* get datatype information */
-    smpi_datatype_extent(dtype, &lb, &extent);
-    smpi_datatype_extent(dtype, &true_lb, &true_extent);
+    dtype->extent(&lb, &extent);
+    dtype->extent(&true_lb, &true_extent);
     buf_size = true_extent + (ptrdiff_t)(count - 1) * extent;
 
     /* Handle MPI_IN_PLACE */
@@ -106,7 +105,7 @@ smpi_coll_tuned_reduce_scatter_ompi_basic_recursivehalving(void *sbuf,
     result_buf = result_buf_free - lb;
    
     /* copy local buffer into the temporary results */
-    err =smpi_datatype_copy(sbuf, count, dtype, result_buf, count, dtype);
+    err =Datatype::copy(sbuf, count, dtype, result_buf, count, dtype);
     if (MPI_SUCCESS != err) goto cleanup;
    
     /* figure out power of two mapping: grow until larger than
@@ -132,7 +131,7 @@ smpi_coll_tuned_reduce_scatter_ompi_basic_recursivehalving(void *sbuf,
                                     comm, MPI_STATUS_IGNORE);
          
             /* integrate their results into our temp results */
-            smpi_op_apply(op, recv_buf, result_buf, &count, &dtype);
+            if(op!=MPI_OP_NULL) op->apply( recv_buf, result_buf, &count, dtype);
          
             /* adjust rank to be the bottom "remain" ranks */
             tmp_rank = rank / 2;
@@ -243,10 +242,10 @@ smpi_coll_tuned_reduce_scatter_ompi_basic_recursivehalving(void *sbuf,
             /* if we received something on this step, push it into
                the results buffer */
             if (recv_count > 0) {
-                smpi_op_apply(op, 
+                if(op!=MPI_OP_NULL) op->apply( 
                                recv_buf + (ptrdiff_t)tmp_disps[recv_index] * extent, 
                                result_buf + (ptrdiff_t)tmp_disps[recv_index] * extent,
-                               &recv_count, &dtype);
+                               &recv_count, dtype);
             }
 
             /* update for next iteration */
@@ -257,7 +256,7 @@ smpi_coll_tuned_reduce_scatter_ompi_basic_recursivehalving(void *sbuf,
 
         /* copy local results from results buffer into real receive buffer */
         if (0 != rcounts[rank]) {
-            err = smpi_datatype_copy(result_buf + disps[rank] * extent,
+            err = Datatype::copy(result_buf + disps[rank] * extent,
                                        rcounts[rank], dtype, 
                                        rbuf, rcounts[rank], dtype);
             if (MPI_SUCCESS != err) {
@@ -397,7 +396,7 @@ smpi_coll_tuned_reduce_scatter_ompi_ring(void *sbuf, void *rbuf, int *rcounts,
     /* Special case for size == 1 */
     if (1 == size) {
         if (MPI_IN_PLACE != sbuf) {
-            ret = smpi_datatype_copy((char*)sbuf, total_count, dtype, (char*)rbuf, total_count, dtype);
+            ret = Datatype::copy((char*)sbuf, total_count, dtype, (char*)rbuf, total_count, dtype);
             if (ret < 0) { line = __LINE__; goto error_hndl; }
         }
         xbt_free(displs);
@@ -409,8 +408,8 @@ smpi_coll_tuned_reduce_scatter_ompi_ring(void *sbuf, void *rbuf, int *rcounts,
        rbuf can be of rcounts[rank] size.
        - up to two temporary buffers used for communication/computation overlap.
     */
-    smpi_datatype_extent(dtype, &lb, &extent);
-    smpi_datatype_extent(dtype, &true_lb, &true_extent);
+    dtype->extent(&lb, &extent);
+    dtype->extent(&true_lb, &true_extent);
 
     max_real_segsize = true_extent + (ptrdiff_t)(max_block_count - 1) * extent;
 
@@ -432,7 +431,7 @@ smpi_coll_tuned_reduce_scatter_ompi_ring(void *sbuf, void *rbuf, int *rcounts,
         sbuf = rbuf;
     }
 
-    ret = smpi_datatype_copy((char*)sbuf, total_count, dtype, accumbuf, total_count, dtype);
+    ret = Datatype::copy((char*)sbuf, total_count, dtype, accumbuf, total_count, dtype);
     if (ret < 0) { line = __LINE__; goto error_hndl; }
 
     /* Computation loop */
@@ -482,7 +481,7 @@ smpi_coll_tuned_reduce_scatter_ompi_ring(void *sbuf, void *rbuf, int *rcounts,
            rbuf[prevblock] = inbuf[inbi ^ 0x1] (op) rbuf[prevblock]
         */
         tmprecv = accumbuf + (ptrdiff_t)displs[prevblock] * extent;
-        smpi_op_apply(op, inbuf[inbi ^ 0x1], tmprecv, &(rcounts[prevblock]), &dtype);
+        if(op!=MPI_OP_NULL) op->apply( inbuf[inbi ^ 0x1], tmprecv, &(rcounts[prevblock]), dtype);
       
         /* send previous block to send_to */
         Request::send(tmprecv, rcounts[prevblock], dtype, send_to,
@@ -496,10 +495,10 @@ smpi_coll_tuned_reduce_scatter_ompi_ring(void *sbuf, void *rbuf, int *rcounts,
     /* Apply operation on the last block (my block)
        rbuf[rank] = inbuf[inbi] (op) rbuf[rank] */
     tmprecv = accumbuf + (ptrdiff_t)displs[rank] * extent;
-    smpi_op_apply(op, inbuf[inbi], tmprecv, &(rcounts[rank]), &dtype);
+    if(op!=MPI_OP_NULL) op->apply( inbuf[inbi], tmprecv, &(rcounts[rank]), dtype);
    
     /* Copy result from tmprecv to rbuf */
-    ret = smpi_datatype_copy(tmprecv, rcounts[rank], dtype, (char*)rbuf, rcounts[rank], dtype);
+    ret = Datatype::copy(tmprecv, rcounts[rank], dtype, (char*)rbuf, rcounts[rank], dtype);
     if (ret < 0) { line = __LINE__; goto error_hndl; }
 
     if (NULL != displs) xbt_free(displs);