From f00ffb4ea8272126f9a81ec6b8adc6e021182bde Mon Sep 17 00:00:00 2001 From: degomme Date: Sat, 30 Apr 2016 02:30:04 +0200 Subject: [PATCH] Yet another batch of fixes --- src/smpi/colls/bcast-mvapich-smp.c | 3 ++- src/smpi/smpi_base.cpp | 10 ++++++---- src/smpi/smpi_comm.cpp | 1 + src/smpi/smpi_f77.cpp | 12 +++++++++--- src/smpi/smpi_pmpi.cpp | 1 + tools/simgrid.supp | 3 --- 6 files changed, 19 insertions(+), 11 deletions(-) diff --git a/src/smpi/colls/bcast-mvapich-smp.c b/src/smpi/colls/bcast-mvapich-smp.c index 8dd8594063..54ea0fc8f7 100644 --- a/src/smpi/colls/bcast-mvapich-smp.c +++ b/src/smpi/colls/bcast-mvapich-smp.c @@ -238,7 +238,8 @@ int smpi_coll_tuned_bcast_mvapich2_knomial_intra_node(void *buffer, mask /= mv2_intra_node_knomial_factor; } } - + xbt_free(reqarray); + xbt_free(starray); return mpi_errno; } diff --git a/src/smpi/smpi_base.cpp b/src/smpi/smpi_base.cpp index 82cc5a9bc7..e892f89f3b 100644 --- a/src/smpi/smpi_base.cpp +++ b/src/smpi/smpi_base.cpp @@ -1306,10 +1306,7 @@ void smpi_mpi_reduce(void *sendbuf, void *recvbuf, int count, MPI_Datatype datat void **tmpbufs; char* sendtmpbuf = (char*) sendbuf; - if( sendbuf == MPI_IN_PLACE ) { - sendtmpbuf = (char *)smpi_get_tmp_sendbuffer(count*smpi_datatype_get_extent(datatype)); - smpi_datatype_copy(recvbuf, count, datatype,sendtmpbuf, count, datatype); - } + rank = smpi_comm_rank(comm); size = smpi_comm_size(comm); @@ -1318,6 +1315,11 @@ void smpi_mpi_reduce(void *sendbuf, void *recvbuf, int count, MPI_Datatype datat smpi_coll_tuned_reduce_ompi_basic_linear(sendtmpbuf, recvbuf, count, datatype, op, root, comm); return; } + + if( sendbuf == MPI_IN_PLACE ) { + sendtmpbuf = (char *)smpi_get_tmp_sendbuffer(count*smpi_datatype_get_extent(datatype)); + smpi_datatype_copy(recvbuf, count, datatype,sendtmpbuf, count, datatype); + } if(rank != root) { // Send buffer to root diff --git a/src/smpi/smpi_comm.cpp b/src/smpi/smpi_comm.cpp index c7a50b41ac..3513ba66ff 100644 --- a/src/smpi/smpi_comm.cpp +++ b/src/smpi/smpi_comm.cpp @@ -325,6 +325,7 @@ void smpi_comm_cleanup_attributes(MPI_Comm comm){ if(elem && elem->delete_fn) elem->delete_fn(comm, *key, value, &flag); } + xbt_dict_free(&comm->attributes); } } diff --git a/src/smpi/smpi_f77.cpp b/src/smpi/smpi_f77.cpp index 9b2aaac760..09cb2100a7 100644 --- a/src/smpi/smpi_f77.cpp +++ b/src/smpi/smpi_f77.cpp @@ -787,9 +787,15 @@ void mpi_info_get_ (int* info,char *key,int* valuelen, char *value, int *flag, i tkey[keylen]='\0'; *ierr = MPI_Info_get(smpi_info_f2c(*info),tkey,*valuelen, value, flag); xbt_free(tkey); - int i = 0; - for (i=strlen(value); i<*valuelen; i++) - value[i]=' '; + if(*flag==true){ + int replace=0, i=0; + for (i=0; i<*valuelen; i++){ + if(value[i]=='\0') + replace=1; + if(replace) + value[i]=' '; + } + } } void mpi_info_free_(int* info, int* ierr){ diff --git a/src/smpi/smpi_pmpi.cpp b/src/smpi/smpi_pmpi.cpp index ad2111a8ee..22637d7489 100644 --- a/src/smpi/smpi_pmpi.cpp +++ b/src/smpi/smpi_pmpi.cpp @@ -3167,6 +3167,7 @@ int PMPI_Info_get(MPI_Info info,char *key,int valuelen, char *value, int *flag){ return MPI_ERR_INFO_VALUE; char* tmpvalue=(char*)xbt_dict_get_or_null(info->info_dict, key); if(tmpvalue){ + memset(value, 0, valuelen); memcpy(value,tmpvalue, (strlen(tmpvalue) + 1 < static_cast(valuelen)) ? strlen(tmpvalue) + 1 : valuelen); *flag=true; } diff --git a/tools/simgrid.supp b/tools/simgrid.supp index 2c3e47b691..ce06e6bb5c 100644 --- a/tools/simgrid.supp +++ b/tools/simgrid.supp @@ -67,7 +67,6 @@ { Memory leak in Netcards Memcheck:Leak - match-leak-kinds: definite ... fun:sg_platf_new_router fun:STag_surfxml_router @@ -75,8 +74,6 @@ ... fun:parse_platform_file fun:SIMIX_create_environment - fun:smpi_main - fun:main } { -- 2.20.1