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

Public GIT Repository
Merge branch 'pikachuyann/simgrid-stoprofiles'
[simgrid.git] / src / smpi / colls / reduce / reduce-ompi.cpp
index ce4d8d5f68ab162d2680c17fc6aef3d40c079681..8f87360b094eef797cd65e19c037d3782bf7ecd6 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2013-2019. The SimGrid Team.
+/* Copyright (c) 2013-2020. The SimGrid Team.
  * All rights reserved.                                                     */
 
 /* This program is free software; you can redistribute it and/or modify it
@@ -80,7 +80,7 @@ int smpi_coll_tuned_ompi_reduce_generic(const void* sendbuf, void* recvbuf, int
         ptrdiff_t true_extent, real_segment_size;
         true_extent=datatype->get_extent();
 
-        /* handle non existant recv buffer (i.e. its NULL) and
+        /* handle non existent recv buffer (i.e. its NULL) and
            protect the recv buffer on non-root nodes */
         accumbuf = static_cast<unsigned char*>(recvbuf);
         if (nullptr == accumbuf || root != rank) {
@@ -95,7 +95,7 @@ int smpi_coll_tuned_ompi_reduce_generic(const void* sendbuf, void* recvbuf, int
         }
 
         /* If this is a non-commutative operation we must copy
-           sendbuf to the accumbuf, in order to simplfy the loops */
+           sendbuf to the accumbuf, in order to simplify the loops */
         if ((op != MPI_OP_NULL && not op->is_commutative())) {
           Datatype::copy(sendtmpbuf, original_count, datatype, accumbuf, original_count, datatype);
         }
@@ -235,7 +235,7 @@ int smpi_coll_tuned_ompi_reduce_generic(const void* sendbuf, void* recvbuf, int
     */
     else {
 
-        /* If the number of segments is less than a maximum number of oustanding
+        /* If the number of segments is less than a maximum number of outstanding
            requests or there is no limit on the maximum number of outstanding
            requests, we send data to the parent using blocking send */
         if ((0 == max_outstanding_reqs) ||
@@ -266,8 +266,12 @@ int smpi_coll_tuned_ompi_reduce_generic(const void* sendbuf, void* recvbuf, int
         else {
 
             int creq = 0;
-            MPI_Request* sreq = new (std::nothrow) MPI_Request[max_outstanding_reqs];
-            if (NULL == sreq) { line = __LINE__; ret = -1; goto error_hndl; }
+            auto* sreq = new (std::nothrow) MPI_Request[max_outstanding_reqs];
+            if (nullptr == sreq) {
+              line = __LINE__;
+              ret  = -1;
+              goto error_hndl;
+            }
 
             /* post first group of requests */
             for (segindex = 0; segindex < max_outstanding_reqs; segindex++) {
@@ -328,11 +332,11 @@ int smpi_coll_tuned_ompi_reduce_generic(const void* sendbuf, void* recvbuf, int
 */
 
 
-int Coll_reduce_ompi_chain::reduce(const void *sendbuf, void *recvbuf, int count,
-                                        MPI_Datatype datatype,
-                                        MPI_Op  op, int root,
-                                        MPI_Comm  comm
-                                        )
+int reduce__ompi_chain(const void *sendbuf, void *recvbuf, int count,
+                       MPI_Datatype datatype,
+                       MPI_Op  op, int root,
+                       MPI_Comm  comm
+                       )
 {
     uint32_t segsize=64*1024;
     int segcount = count;
@@ -356,10 +360,10 @@ int Coll_reduce_ompi_chain::reduce(const void *sendbuf, void *recvbuf, int count
 }
 
 
-int Coll_reduce_ompi_pipeline::reduce(const void *sendbuf, void *recvbuf,
-                                           int count, MPI_Datatype datatype,
-                                           MPI_Op  op, int root,
-                                           MPI_Comm  comm  )
+int reduce__ompi_pipeline(const void *sendbuf, void *recvbuf,
+                          int count, MPI_Datatype datatype,
+                          MPI_Op  op, int root,
+                          MPI_Comm  comm  )
 {
 
     uint32_t segsize;
@@ -400,10 +404,10 @@ int Coll_reduce_ompi_pipeline::reduce(const void *sendbuf, void *recvbuf,
                                            segcount, 0);
 }
 
-int Coll_reduce_ompi_binary::reduce(const void *sendbuf, void *recvbuf,
-                                         int count, MPI_Datatype datatype,
-                                         MPI_Op  op, int root,
-                                         MPI_Comm  comm)
+int reduce__ompi_binary(const void *sendbuf, void *recvbuf,
+                        int count, MPI_Datatype datatype,
+                        MPI_Op  op, int root,
+                        MPI_Comm  comm)
 {
     uint32_t segsize;
     int segcount = count;
@@ -430,10 +434,10 @@ int Coll_reduce_ompi_binary::reduce(const void *sendbuf, void *recvbuf,
                                            segcount, 0);
 }
 
-int Coll_reduce_ompi_binomial::reduce(const void *sendbuf, void *recvbuf,
-                                           int count, MPI_Datatype datatype,
-                                           MPI_Op  op, int root,
-                                           MPI_Comm  comm)
+int reduce__ompi_binomial(const void *sendbuf, void *recvbuf,
+                          int count, MPI_Datatype datatype,
+                          MPI_Op  op, int root,
+                          MPI_Comm  comm)
 {
 
     uint32_t segsize=0;
@@ -474,14 +478,14 @@ int Coll_reduce_ompi_binomial::reduce(const void *sendbuf, void *recvbuf,
  * reduce_intra_in_order_binary
  *
  * Function:      Logarithmic reduce operation for non-commutative operations.
- * Acecpts:       same as MPI_Reduce()
+ * Accepts:       same as MPI_Reduce()
  * Returns:       MPI_SUCCESS or error code
  */
-int Coll_reduce_ompi_in_order_binary::reduce(const void *sendbuf, void *recvbuf,
-                                                  int count,
-                                                  MPI_Datatype datatype,
-                                                  MPI_Op  op, int root,
-                                                  MPI_Comm  comm)
+int reduce__ompi_in_order_binary(const void *sendbuf, void *recvbuf,
+                                 int count,
+                                 MPI_Datatype datatype,
+                                 MPI_Op  op, int root,
+                                 MPI_Comm  comm)
 {
     uint32_t segsize=0;
     int ret;
@@ -520,14 +524,14 @@ int Coll_reduce_ompi_in_order_binary::reduce(const void *sendbuf, void *recvbuf,
 
         if ((root == rank) && (MPI_IN_PLACE == sendbuf)) {
           tmp_sendbuf = smpi_get_tmp_sendbuffer(text + (count - 1) * ext);
-          if (NULL == tmp_sendbuf) {
+          if (nullptr == tmp_sendbuf) {
             return MPI_ERR_INTERN;
           }
           Datatype::copy(recvbuf, count, datatype, tmp_sendbuf, count, datatype);
           use_this_sendbuf = tmp_sendbuf;
         } else if (io_root == rank) {
           tmp_recvbuf = smpi_get_tmp_recvbuffer(text + (count - 1) * ext);
-          if (NULL == tmp_recvbuf) {
+          if (nullptr == tmp_recvbuf) {
             return MPI_ERR_INTERN;
           }
           use_this_recvbuf = tmp_recvbuf;
@@ -586,12 +590,11 @@ int Coll_reduce_ompi_in_order_binary::reduce(const void *sendbuf, void *recvbuf,
  *  Returns:    - MPI_SUCCESS or error code
  */
 
-int
-Coll_reduce_ompi_basic_linear::reduce(const void *sbuf, void *rbuf, int count,
-                                          MPI_Datatype dtype,
-                                          MPI_Op op,
-                                          int root,
-                                          MPI_Comm comm)
+int reduce__ompi_basic_linear(const void *sbuf, void *rbuf, int count,
+                              MPI_Datatype dtype,
+                              MPI_Op op,
+                              int root,
+                              MPI_Comm comm)
 {
     int i, rank, size;
     ptrdiff_t true_extent, lb, extent;