Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
please sonar on recent SMPI++ code
[simgrid.git] / src / smpi / smpi_base.cpp
index d363f8d..141d8e9 100644 (file)
@@ -1,5 +1,4 @@
-/* Copyright (c) 2007-2015. The SimGrid Team.
- * All rights reserved.                                                     */
+/* Copyright (c) 2007-2017. The SimGrid Team. All rights reserved.          */
 
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
@@ -97,7 +96,7 @@ void smpi_mpi_gather(void *sendbuf, int sendcount, MPI_Datatype sendtype,
     Request::startall(size - 1, requests);
     Request::waitall(size - 1, requests, MPI_STATUS_IGNORE);
     for (int src = 0; src < size-1; src++) {
-      Request::unuse(&requests[src]);
+      Request::unref(&requests[src]);
     }
     xbt_free(requests);
   }
@@ -155,7 +154,7 @@ void smpi_mpi_gatherv(void *sendbuf, int sendcount, MPI_Datatype sendtype, void
     Request::startall(size - 1, requests);
     Request::waitall(size - 1, requests, MPI_STATUS_IGNORE);
     for (int src = 0; src < size-1; src++) {
-      Request::unuse(&requests[src]);
+      Request::unref(&requests[src]);
     }
     xbt_free(requests);
   }
@@ -192,7 +191,7 @@ void smpi_mpi_allgather(void *sendbuf, int sendcount, MPI_Datatype sendtype,
   Request::startall(2 * (size - 1), requests);
   Request::waitall(2 * (size - 1), requests, MPI_STATUS_IGNORE);
   for (int other = 0; other < 2*(size-1); other++) {
-    Request::unuse(&requests[other]);
+    Request::unref(&requests[other]);
   }
   xbt_free(requests);
 }
@@ -227,7 +226,7 @@ void smpi_mpi_allgatherv(void *sendbuf, int sendcount, MPI_Datatype sendtype, vo
   Request::startall(2 * (size - 1), requests);
   Request::waitall(2 * (size - 1), requests, MPI_STATUS_IGNORE);
   for (int other = 0; other < 2*(size-1); other++) {
-    Request::unuse(&requests[other]);
+    Request::unref(&requests[other]);
   }
   xbt_free(requests);
 }
@@ -266,7 +265,7 @@ void smpi_mpi_scatter(void *sendbuf, int sendcount, MPI_Datatype sendtype,
     Request::startall(size - 1, requests);
     Request::waitall(size - 1, requests, MPI_STATUS_IGNORE);
     for (int dst = 0; dst < size-1; dst++) {
-      Request::unuse(&requests[dst]);
+      Request::unref(&requests[dst]);
     }
     xbt_free(requests);
   }
@@ -305,7 +304,7 @@ void smpi_mpi_scatterv(void *sendbuf, int *sendcounts, int *displs, MPI_Datatype
     Request::startall(size - 1, requests);
     Request::waitall(size - 1, requests, MPI_STATUS_IGNORE);
     for (int dst = 0; dst < size-1; dst++) {
-      Request::unuse(&requests[dst]);
+      Request::unref(&requests[dst]);
     }
     xbt_free(requests);
   }
@@ -364,10 +363,10 @@ void smpi_mpi_reduce(void *sendbuf, void *recvbuf, int count, MPI_Datatype datat
       if(index == MPI_UNDEFINED) {
         break;
       }else{
-        Request::unuse(&requests[index]);
+        Request::unref(&requests[index]);
       }
-      if(op) /* op can be MPI_OP_NULL that does nothing */
-        if(op!=MPI_OP_NULL) op->apply( tmpbufs[index], recvbuf, &count, datatype);
+      if (op != MPI_OP_NULL) /* op can be MPI_OP_NULL that does nothing */
+        op->apply(tmpbufs[index], recvbuf, &count, datatype);
     }
       for(index = 0; index < size - 1; index++) {
         smpi_free_tmp_buffer(tmpbufs[index]);
@@ -423,25 +422,23 @@ void smpi_mpi_scan(void *sendbuf, void *recvbuf, int count, MPI_Datatype datatyp
       if(index == MPI_UNDEFINED) {
         break;
       }
-      if(index < rank) {
-        // #Request is below rank: it's a irecv
-        if(op!=MPI_OP_NULL) op->apply( tmpbufs[index], recvbuf, &count, datatype);
-      }
+      if (index < rank)
+        // #Request is below rank: it's a irecv.
+        op->apply(tmpbufs[index], recvbuf, &count, datatype);
     }
   }else{
     //non commutative case, wait in order
     for (int other = 0; other < size - 1; other++) {
       Request::wait(&(requests[other]), MPI_STATUS_IGNORE);
-      if(index < rank) {
-        if(op!=MPI_OP_NULL) op->apply( tmpbufs[other], recvbuf, &count, datatype);
-      }
+      if (index < rank && op != MPI_OP_NULL)
+        op->apply(tmpbufs[other], recvbuf, &count, datatype);
     }
   }
   for(index = 0; index < rank; index++) {
     smpi_free_tmp_buffer(tmpbufs[index]);
   }
   for(index = 0; index < size-1; index++) {
-    Request::unuse(&requests[index]);
+    Request::unref(&requests[index]);
   }
   xbt_free(tmpbufs);
   xbt_free(requests);
@@ -506,7 +503,7 @@ void smpi_mpi_exscan(void *sendbuf, void *recvbuf, int count, MPI_Datatype datat
     smpi_free_tmp_buffer(tmpbufs[index]);
   }
   for(index = 0; index < size-1; index++) {
-    Request::unuse(&requests[index]);
+    Request::unref(&requests[index]);
   }
   xbt_free(tmpbufs);
   xbt_free(requests);