Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Update copyright lines with new year.
[simgrid.git] / src / smpi / colls / gather / gather-ompi.cpp
index b3083b8..7ee16c2 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2013-2017. The SimGrid Team.
+/* Copyright (c) 2013-2019. The SimGrid Team.
  * All rights reserved.                                                     */
 
 /* This program is free software; you can redistribute it and/or modify it
@@ -19,8 +19,8 @@
  * Additional copyrights may follow
  */
 
-#include "../colls_private.hpp"
 #include "../coll_tuned_topo.hpp"
+#include "../colls_private.hpp"
 
 namespace simgrid{
 namespace smpi{
@@ -181,7 +181,7 @@ int Coll_gather_ompi_binomial::gather(void* sbuf, int scount, MPI_Datatype sdtyp
       /* other non-leaf nodes */
       smpi_free_tmp_buffer(tempbuf);
     }
-    xbt_free(bmtree);
+    ompi_coll_tuned_topo_destroy_tree(&bmtree);
     return MPI_SUCCESS;
 
  err_hndl:
@@ -266,8 +266,8 @@ int Coll_gather_ompi_linear_sync::gather(void *sbuf, int scount,
          - Waitall for all the second segments to complete.
 */
       char* ptmp;
-      MPI_Request *reqs = NULL, first_segment_req;
-      reqs              = (MPI_Request*)calloc(size, sizeof(MPI_Request));
+      MPI_Request first_segment_req;
+      MPI_Request* reqs = new (std::nothrow) MPI_Request[size];
       if (NULL == reqs) {
         ret  = -1;
         line = __LINE__;
@@ -319,7 +319,7 @@ int Coll_gather_ompi_linear_sync::gather(void *sbuf, int scount,
         ret = Request::waitall(size, reqs, MPI_STATUSES_IGNORE);
         if (ret != MPI_SUCCESS) { line = __LINE__; goto error_hndl; }
 
-        free(reqs);
+        delete[] reqs;
     }
 
     /* All done */