Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Fix dead assignments.
[simgrid.git] / src / smpi / smpi_coll.c
index 70fdb14..3bca49d 100644 (file)
@@ -1,6 +1,6 @@
 /* smpi_coll.c -- various optimized routing for collectives                   */
 
-/* Copyright (c) 2009-2013. The SimGrid Team.
+/* Copyright (c) 2009-2014. The SimGrid Team.
  * All rights reserved.                                                     */
 
 /* This program is free software; you can redistribute it and/or modify it
@@ -274,6 +274,9 @@ static void tree_bcast(void *buf, int count, MPI_Datatype datatype,
   }
   smpi_mpi_startall(tree->numChildren, requests);
   smpi_mpi_waitall(tree->numChildren, requests, MPI_STATUS_IGNORE);
+  for(i = 0; i < tree->numChildren; i++) {
+    if(requests[i]!=MPI_REQUEST_NULL) smpi_mpi_request_free(&requests[i]);
+  }
   xbt_free(requests);
 }
 
@@ -312,6 +315,9 @@ static void tree_antibcast(void *buf, int count, MPI_Datatype datatype,
   }
   smpi_mpi_startall(tree->numChildren, requests);
   smpi_mpi_waitall(tree->numChildren, requests, MPI_STATUS_IGNORE);
+  for(i = 0; i < tree->numChildren; i++) {
+    if(requests[i]!=MPI_REQUEST_NULL) smpi_mpi_request_free(&requests[i]);
+  }
   xbt_free(requests);
 }
 
@@ -397,8 +403,8 @@ int smpi_coll_tuned_alltoall_bruck(void *sendbuf, int sendcount,
   rank = smpi_comm_rank(comm);
   size = smpi_comm_size(comm);
   XBT_DEBUG("<%d> algorithm alltoall_bruck() called.", rank);
-  err = smpi_datatype_extent(sendtype, &lb, &sendext);
-  err = smpi_datatype_extent(recvtype, &lb, &recvext);
+  smpi_datatype_extent(sendtype, &lb, &sendext);
+  smpi_datatype_extent(recvtype, &lb, &recvext);
   /* Local copy from self */
   err =
       smpi_datatype_copy((char *)sendbuf + rank * sendcount * sendext, 
@@ -437,6 +443,9 @@ int smpi_coll_tuned_alltoall_bruck(void *sendbuf, int sendcount,
     smpi_mpi_startall(count, requests);
     XBT_DEBUG("<%d> wait for %d requests", rank, count);
     smpi_mpi_waitall(count, requests, MPI_STATUS_IGNORE);
+    for(i = 0; i < count; i++) {
+      if(requests[i]!=MPI_REQUEST_NULL) smpi_mpi_request_free(&requests[i]);
+    }
     xbt_free(requests);
   }
   return MPI_SUCCESS;
@@ -460,8 +469,8 @@ int smpi_coll_tuned_alltoall_basic_linear(void *sendbuf, int sendcount,
   rank = smpi_comm_rank(comm);
   size = smpi_comm_size(comm);
   XBT_DEBUG("<%d> algorithm alltoall_basic_linear() called.", rank);
-  err = smpi_datatype_extent(sendtype, &lb, &sendext);
-  err = smpi_datatype_extent(recvtype, &lb, &recvext);
+  smpi_datatype_extent(sendtype, &lb, &sendext);
+  smpi_datatype_extent(recvtype, &lb, &recvext);
   /* simple optimization */
   err = smpi_datatype_copy((char *)sendbuf + rank * sendcount * sendext, 
                            sendcount, sendtype, 
@@ -493,6 +502,9 @@ int smpi_coll_tuned_alltoall_basic_linear(void *sendbuf, int sendcount,
     smpi_mpi_startall(count, requests);
     XBT_DEBUG("<%d> wait for %d requests", rank, count);
     smpi_mpi_waitall(count, requests, MPI_STATUS_IGNORE);
+    for(i = 0; i < count; i++) {
+      if(requests[i]!=MPI_REQUEST_NULL) smpi_mpi_request_free(&requests[i]);
+    }
     xbt_free(requests);
   }
   return err;
@@ -513,8 +525,8 @@ int smpi_coll_basic_alltoallv(void *sendbuf, int *sendcounts,
   rank = smpi_comm_rank(comm);
   size = smpi_comm_size(comm);
   XBT_DEBUG("<%d> algorithm basic_alltoallv() called.", rank);
-  err = smpi_datatype_extent(sendtype, &lb, &sendext);
-  err = smpi_datatype_extent(recvtype, &lb, &recvext);
+  smpi_datatype_extent(sendtype, &lb, &sendext);
+  smpi_datatype_extent(recvtype, &lb, &recvext);
   /* Local copy from self */
   err =
       smpi_datatype_copy((char *)sendbuf + senddisps[rank] * sendext, 
@@ -555,6 +567,9 @@ int smpi_coll_basic_alltoallv(void *sendbuf, int *sendcounts,
     smpi_mpi_startall(count, requests);
     XBT_DEBUG("<%d> wait for %d requests", rank, count);
     smpi_mpi_waitall(count, requests, MPI_STATUS_IGNORE);
+    for(i = 0; i < count; i++) {
+      if(requests[i]!=MPI_REQUEST_NULL) smpi_mpi_request_free(&requests[i]);
+    }
     xbt_free(requests);
   }
   return err;