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

Public GIT Repository
Update copyright lines for 2023.
[simgrid.git] / src / smpi / colls / gather / gather-ompi.cpp
index 812ec45d94995cbebf451f15735defcb1fc15e66..d3c9be8e8bac97c9420302fc2b9146a9b1bb3cd7 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2013-2019. The SimGrid Team.
+/* Copyright (c) 2013-2023. The SimGrid Team.
  * All rights reserved.                                                     */
 
 /* This program is free software; you can redistribute it and/or modify it
 #include "../coll_tuned_topo.hpp"
 #include "../colls_private.hpp"
 
-namespace simgrid{
-namespace smpi{
+namespace simgrid::smpi {
 
-int Coll_gather_ompi_binomial::gather(const void* sbuf, int scount, MPI_Datatype sdtype, void* rbuf, int rcount,
-                                      MPI_Datatype rdtype, int root, MPI_Comm comm)
+int gather__ompi_binomial(const void* sbuf, int scount, MPI_Datatype sdtype, void* rbuf, int rcount,
+                          MPI_Datatype rdtype, int root, MPI_Comm comm)
 {
     int line = -1;
     int i;
@@ -76,7 +75,7 @@ int Coll_gather_ompi_binomial::gather(const void* sbuf, int scount, MPI_Datatype
           /* root is not on 0, allocate temp buffer for recv,
            * rotate data at the end */
           tempbuf = smpi_get_tmp_recvbuffer(rtrue_extent + (rcount * size - 1) * rextent);
-          if (NULL == tempbuf) {
+          if (nullptr == tempbuf) {
             err  = MPI_ERR_OTHER;
             line = __LINE__;
             goto err_hndl;
@@ -104,9 +103,9 @@ int Coll_gather_ompi_binomial::gather(const void* sbuf, int scount, MPI_Datatype
     } else if (!(vrank % 2)) {
       /* other non-leaf nodes, allocate temp buffer for data received from
        * children, the most we need is half of the total data elements due
-       * to the property of binimoal tree */
+       * to the property of binomial tree */
       tempbuf = smpi_get_tmp_sendbuffer(strue_extent + (scount * size - 1) * sextent);
-      if (NULL == tempbuf) {
+      if (nullptr == tempbuf) {
         err  = MPI_ERR_OTHER;
         line = __LINE__;
         goto err_hndl;
@@ -188,11 +187,11 @@ int Coll_gather_ompi_binomial::gather(const void* sbuf, int scount, MPI_Datatype
     return MPI_SUCCESS;
 
  err_hndl:
-    if (NULL != tempbuf)
-      smpi_free_tmp_buffer(tempbuf);
+   if (nullptr != tempbuf)
+     smpi_free_tmp_buffer(tempbuf);
 
-    XBT_DEBUG("%s:%4d\tError occurred %d, rank %2d", __FILE__, line, err, rank);
-    return err;
+   XBT_DEBUG("%s:%4d\tError occurred %d, rank %2d", __FILE__, line, err, rank);
+   return err;
 }
 
 /*
@@ -202,12 +201,12 @@ int Coll_gather_ompi_binomial::gather(const void* sbuf, int scount, MPI_Datatype
  *  Accepts:  - same arguments as MPI_Gather(), first segment size
  *  Returns:  - MPI_SUCCESS or error code
  */
-int Coll_gather_ompi_linear_sync::gather(const void *sbuf, int scount,
-                                         MPI_Datatype sdtype,
-                                         void *rbuf, int rcount,
-                                         MPI_Datatype rdtype,
-                                         int root,
-                                         MPI_Comm comm)
+int gather__ompi_linear_sync(const void *sbuf, int scount,
+                             MPI_Datatype sdtype,
+                             void *rbuf, int rcount,
+                             MPI_Datatype rdtype,
+                             int root,
+                             MPI_Comm comm)
 {
     int i;
     int ret, line;
@@ -270,11 +269,12 @@ int Coll_gather_ompi_linear_sync::gather(const void *sbuf, int scount,
 */
       char* ptmp;
       MPI_Request first_segment_req;
-      MPI_Request* reqs = new (std::nothrow) MPI_Request[size];
-      if (NULL == reqs) {
+      auto* reqs = new (std::nothrow) MPI_Request[size];
+      if (nullptr == reqs) {
         ret  = -1;
         line = __LINE__;
-        goto error_hndl; }
+        goto error_hndl;
+      }
 
         typelng=rdtype->size();
         rdtype->extent(&lb, &extent);
@@ -355,8 +355,8 @@ int Coll_gather_ompi_linear_sync::gather(const void *sbuf, int scount,
  *  Accepts:  - same arguments as MPI_Gather()
  *  Returns:  - MPI_SUCCESS or error code
  */
-int Coll_gather_ompi_basic_linear::gather(const void* sbuf, int scount, MPI_Datatype sdtype, void* rbuf, int rcount,
-                                          MPI_Datatype rdtype, int root, MPI_Comm comm)
+int gather__ompi_basic_linear(const void* sbuf, int scount, MPI_Datatype sdtype, void* rbuf, int rcount,
+                              MPI_Datatype rdtype, int root, MPI_Comm comm)
 {
     int i;
     int err;
@@ -408,5 +408,4 @@ int Coll_gather_ompi_basic_linear::gather(const void* sbuf, int scount, MPI_Data
     return MPI_SUCCESS;
 }
 
-}
-}
+} // namespace simgrid::smpi