From 8192acecf44818a829583724900211221500a718 Mon Sep 17 00:00:00 2001 From: Augustin Degomme Date: Tue, 24 Sep 2013 15:11:08 +0200 Subject: [PATCH] more leaks --- src/smpi/colls/allgatherv-mpich-rdb.c | 3 ++- src/smpi/colls/alltoallv-ompi-basic-linear.c | 1 + src/smpi/colls/bcast-ompi-pipeline.c | 1 + src/smpi/colls/bcast-ompi-split-bintree.c | 1 + src/smpi/colls/reduce-binomial.c | 15 +++++++++------ src/smpi/colls/reduce-ompi.c | 1 + src/smpi/colls/reduce-scatter-gather.c | 2 ++ src/smpi/colls/reduce_scatter-mpich.c | 10 ++++++++-- teshsuite/smpi/reduce_scatter_coll.c | 6 +++++- 9 files changed, 30 insertions(+), 10 deletions(-) diff --git a/src/smpi/colls/allgatherv-mpich-rdb.c b/src/smpi/colls/allgatherv-mpich-rdb.c index 454288d7e7..83918079cb 100644 --- a/src/smpi/colls/allgatherv-mpich-rdb.c +++ b/src/smpi/colls/allgatherv-mpich-rdb.c @@ -206,5 +206,6 @@ int smpi_coll_tuned_allgatherv_mpich_rdb ( position += recvcounts[j]; } } -return MPI_SUCCESS; + free(tmp_buf); + return MPI_SUCCESS; } diff --git a/src/smpi/colls/alltoallv-ompi-basic-linear.c b/src/smpi/colls/alltoallv-ompi-basic-linear.c index abc29f5082..fe035aedea 100644 --- a/src/smpi/colls/alltoallv-ompi-basic-linear.c +++ b/src/smpi/colls/alltoallv-ompi-basic-linear.c @@ -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; } diff --git a/src/smpi/colls/bcast-ompi-pipeline.c b/src/smpi/colls/bcast-ompi-pipeline.c index cd0e3ce3ab..70855627ab 100644 --- a/src/smpi/colls/bcast-ompi-pipeline.c +++ b/src/smpi/colls/bcast-ompi-pipeline.c @@ -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); } diff --git a/src/smpi/colls/bcast-ompi-split-bintree.c b/src/smpi/colls/bcast-ompi-split-bintree.c index 58bf387c82..a0f1876ebb 100644 --- a/src/smpi/colls/bcast-ompi-split-bintree.c +++ b/src/smpi/colls/bcast-ompi-split-bintree.c @@ -291,6 +291,7 @@ smpi_coll_tuned_bcast_ompi_split_bintree ( void* buffer, comm, MPI_STATUS_IGNORE); } } + xbt_free(tree); return (MPI_SUCCESS); diff --git a/src/smpi/colls/reduce-binomial.c b/src/smpi/colls/reduce-binomial.c index a7ece3e238..c3b406741d 100644 --- a/src/smpi/colls/reduce-binomial.c +++ b/src/smpi/colls/reduce-binomial.c @@ -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; diff --git a/src/smpi/colls/reduce-ompi.c b/src/smpi/colls/reduce-ompi.c index 25353aa4b4..0b71d60ea3 100644 --- a/src/smpi/colls/reduce-ompi.c +++ b/src/smpi/colls/reduce-ompi.c @@ -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 */ diff --git a/src/smpi/colls/reduce-scatter-gather.c b/src/smpi/colls/reduce-scatter-gather.c index 24ad911264..19c67947a1 100644 --- a/src/smpi/colls/reduce-scatter-gather.c +++ b/src/smpi/colls/reduce-scatter-gather.c @@ -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) diff --git a/src/smpi/colls/reduce_scatter-mpich.c b/src/smpi/colls/reduce_scatter-mpich.c index 586142bbe0..76cbf0ffdd 100644 --- a/src/smpi/colls/reduce_scatter-mpich.c +++ b/src/smpi/colls/reduce_scatter-mpich.c @@ -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); diff --git a/teshsuite/smpi/reduce_scatter_coll.c b/teshsuite/smpi/reduce_scatter_coll.c index cba19bc43f..f8d9fb332f 100644 --- a/teshsuite/smpi/reduce_scatter_coll.c +++ b/teshsuite/smpi/reduce_scatter_coll.c @@ -28,7 +28,7 @@ int main( int argc, char **argv ) for (i=0; i