Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
more leaks
authorAugustin Degomme <degomme@idpann.imag.fr>
Tue, 24 Sep 2013 13:11:08 +0000 (15:11 +0200)
committerAugustin Degomme <degomme@idpann.imag.fr>
Tue, 24 Sep 2013 13:11:08 +0000 (15:11 +0200)
src/smpi/colls/allgatherv-mpich-rdb.c
src/smpi/colls/alltoallv-ompi-basic-linear.c
src/smpi/colls/bcast-ompi-pipeline.c
src/smpi/colls/bcast-ompi-split-bintree.c
src/smpi/colls/reduce-binomial.c
src/smpi/colls/reduce-ompi.c
src/smpi/colls/reduce-scatter-gather.c
src/smpi/colls/reduce_scatter-mpich.c
teshsuite/smpi/reduce_scatter_coll.c

index 454288d..8391807 100644 (file)
@@ -206,5 +206,6 @@ int smpi_coll_tuned_allgatherv_mpich_rdb (
                 position += recvcounts[j];
             }
         }
-return MPI_SUCCESS;
+  free(tmp_buf);
+  return MPI_SUCCESS;
 }
index abc29f5..fe035ae 100644 (file)
@@ -93,6 +93,7 @@ smpi_coll_tuned_alltoallv_ompi_basic_linear(void *sbuf, int *scounts, int *sdisp
     for (i = 0; i < nreqs; ++i) {
       if(ireqs[i]!=MPI_REQUEST_NULL)smpi_mpi_request_free(&ireqs[i]);
     }
+    free(ireqs);
 
     return MPI_SUCCESS;
 }
index cd0e3ce..7085562 100644 (file)
@@ -199,6 +199,7 @@ int smpi_coll_tuned_bcast_ompi_pipeline( void* buffer,
     }
 
     if( NULL != send_reqs ) free(send_reqs);
+    xbt_free(tree);
 
     return (MPI_SUCCESS);
 }
index 58bf387..a0f1876 100644 (file)
@@ -291,6 +291,7 @@ smpi_coll_tuned_bcast_ompi_split_bintree ( void* buffer,
                                             comm, MPI_STATUS_IGNORE); 
         }
     }
+    xbt_free(tree);
     return (MPI_SUCCESS);
   
 
index a7ece3e..c3b4067 100644 (file)
@@ -70,14 +70,17 @@ int smpi_coll_tuned_reduce_binomial(void *sendbuf, void *recvbuf, int count,
     mask <<= 1;
   }
 
-if (!is_commutative && (root != 0)){
-  if (rank == 0){
-    smpi_mpi_send(recvbuf, count, datatype, root,tag, comm);
-  }else if (rank == root){
-    smpi_mpi_recv(recvbuf, count, datatype, 0, tag, comm, &status);
+  if (!is_commutative && (root != 0)){
+    if (rank == 0){
+      smpi_mpi_send(recvbuf, count, datatype, root,tag, comm);
+    }else if (rank == root){
+      smpi_mpi_recv(recvbuf, count, datatype, 0, tag, comm, &status);
+    }
   }
-}
 
+  if (rank != root) {
+        xbt_free(recvbuf);
+  }
   free(tmp_buf);
 
   return 0;
index 25353aa..0b71d60 100644 (file)
@@ -302,6 +302,7 @@ int smpi_coll_tuned_ompi_reduce_generic( void* sendbuf, void* recvbuf, int origi
             free(sreq);
         }
     }
+    free(tree);
     return MPI_SUCCESS;
 
  error_hndl:  /* error handler */
index 24ad911..19c6794 100644 (file)
@@ -387,6 +387,8 @@ int smpi_coll_tuned_reduce_scatter_gather(void *sendbuf, void *recvbuf,
       }
     }
   }
+  if (tmp_buf)
+    free(tmp_buf);
   if (cnts)
     free(cnts);
   if (disps)
index 586142b..76cbf0f 100644 (file)
@@ -182,6 +182,9 @@ int smpi_coll_tuned_reduce_scatter_mpich_noncomm(void *sendbuf, void *recvbuf, i
 
     tmp_buf0=( void *)xbt_malloc( true_extent * total_count);
     tmp_buf1=( void *)xbt_malloc( true_extent * total_count);
+    void *tmp_buf0_save=tmp_buf0;
+    void *tmp_buf1_save=tmp_buf1;
+
     /* adjust for potential negative lower bound in datatype */
     tmp_buf0 = (void *)((char*)tmp_buf0 - true_lb);
     tmp_buf1 = (void *)((char*)tmp_buf1 - true_lb);
@@ -249,6 +252,8 @@ int smpi_coll_tuned_reduce_scatter_mpich_noncomm(void *sendbuf, void *recvbuf, i
     result_ptr = (char *)(buf0_was_inout ? tmp_buf0 : tmp_buf1) + recv_offset * true_extent;
     mpi_errno = smpi_datatype_copy(result_ptr, size, datatype,
                                recvbuf, size, datatype);
+    xbt_free(tmp_buf0_save);
+    xbt_free(tmp_buf1_save);
     if (mpi_errno) return(mpi_errno);
     return MPI_SUCCESS;
 }
@@ -469,8 +474,8 @@ int smpi_coll_tuned_reduce_scatter_mpich_rdb(void *sendbuf, void *recvbuf, int r
                     }
                 }
 
-                //smpi_datatype_free(&sendtype);
-                //smpi_datatype_free(&recvtype);
+                smpi_datatype_free(&sendtype);
+                smpi_datatype_free(&recvtype);
 
                 mask <<= 1;
                 i++;
@@ -481,6 +486,7 @@ int smpi_coll_tuned_reduce_scatter_mpich_rdb(void *sendbuf, void *recvbuf, int r
                                        recvcounts[rank], datatype, recvbuf,
                                        recvcounts[rank], datatype);
             if (mpi_errno) return(mpi_errno);
+
     xbt_free(disps);
     xbt_free(tmp_recvbuf);
     xbt_free(tmp_results);
index cba19bc..f8d9fb3 100644 (file)
@@ -28,7 +28,7 @@ int main( int argc, char **argv )
     for (i=0; i<size; i++) 
        sendbuf[i] = rank + i;
     recvcounts = (int *)malloc( size * sizeof(int) );
-        recvbuf = (int *)malloc( size * sizeof(int) );
+    recvbuf = (int *)malloc( size * sizeof(int) );
     for (i=0; i<size; i++) 
     recvcounts[i] = 1;
     MPI_Reduce_scatter( sendbuf, recvbuf, recvcounts, MPI_INT, MPI_SUM, comm );
@@ -44,6 +44,10 @@ int main( int argc, char **argv )
     if (rank == 0 && toterr == 0) {
        printf( " No Errors\n" );
     }
+    free(sendbuf);
+    free(recvcounts);
+    free(recvbuf);
+    
     MPI_Finalize( );
 
     return toterr;