Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
smpi: many classes died tonight, but that will save kitten on the long term.
[simgrid.git] / src / smpi / colls / barrier / barrier-ompi.cpp
index 727febc..802481f 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
 /*
  * Simple double ring version of barrier
  *
- * synchronous gurantee made by last ring of sends are synchronous
+ * synchronous guarantee made by last ring of sends are synchronous
  *
  */
-namespace simgrid{
-namespace smpi{
-int Coll_barrier_ompi_doublering::barrier(MPI_Comm comm)
+namespace simgrid {
+namespace smpi {
+int barrier__ompi_doublering(MPI_Comm comm)
 {
     int rank, size;
     int left, right;
@@ -104,7 +104,7 @@ int Coll_barrier_ompi_doublering::barrier(MPI_Comm comm)
  * To make synchronous, uses sync sends and sync sendrecvs
  */
 
-int Coll_barrier_ompi_recursivedoubling::barrier(MPI_Comm comm)
+int barrier__ompi_recursivedoubling(MPI_Comm comm)
 {
     int rank, size, adjsize;
     int mask, remote;
@@ -178,7 +178,7 @@ int Coll_barrier_ompi_recursivedoubling::barrier(MPI_Comm comm)
  * To make synchronous, uses sync sends and sync sendrecvs
  */
 
-int Coll_barrier_ompi_bruck::barrier(MPI_Comm comm)
+int barrier__ompi_bruck(MPI_Comm comm)
 {
     int rank, size;
     int distance, to, from;
@@ -210,7 +210,7 @@ int Coll_barrier_ompi_bruck::barrier(MPI_Comm comm)
  * To make synchronous, uses sync sends and sync sendrecvs
  */
 /* special case for two processes */
-int Coll_barrier_ompi_two_procs::barrier(MPI_Comm comm)
+int barrier__ompi_two_procs(MPI_Comm comm)
 {
     int remote;
 
@@ -242,7 +242,7 @@ int Coll_barrier_ompi_two_procs::barrier(MPI_Comm comm)
 
 /* copied function (with appropriate renaming) starts here */
 
-int Coll_barrier_ompi_basic_linear::barrier(MPI_Comm comm)
+int barrier__ompi_basic_linear(MPI_Comm comm)
 {
     int i;
     int size = comm->size();
@@ -265,11 +265,9 @@ int Coll_barrier_ompi_basic_linear::barrier(MPI_Comm comm)
     else {
         MPI_Request* requests;
 
-        requests = (MPI_Request*)malloc( size * sizeof(MPI_Request) );
+        requests = new MPI_Request[size];
         for (i = 1; i < size; ++i) {
-            requests[i] = Request::irecv(NULL, 0, MPI_BYTE, MPI_ANY_SOURCE,
-                                     COLL_TAG_BARRIER, comm
-                                     );
+          requests[i] = Request::irecv(NULL, 0, MPI_BYTE, i, COLL_TAG_BARRIER, comm);
         }
         Request::waitall( size-1, requests+1, MPI_STATUSES_IGNORE );
 
@@ -280,7 +278,7 @@ int Coll_barrier_ompi_basic_linear::barrier(MPI_Comm comm)
                                      );
         }
         Request::waitall( size-1, requests+1, MPI_STATUSES_IGNORE );
-        free( requests );
+        delete[] requests;
     }
 
     /* All done */
@@ -294,7 +292,7 @@ int Coll_barrier_ompi_basic_linear::barrier(MPI_Comm comm)
  * Another recursive doubling type algorithm, but in this case
  * we go up the tree and back down the tree.
  */
-int Coll_barrier_ompi_tree::barrier(MPI_Comm comm)
+int barrier__ompi_tree(MPI_Comm comm)
 {
     int rank, size, depth;
     int jump, partner;