From: Augustin Degomme Date: Thu, 6 Nov 2014 10:07:01 +0000 (+0100) Subject: Add mpi_info support for rma calls X-Git-Tag: v3_12~732^2~227 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/74430cd04d3de487fb936817266b3af0df7638c0 Add mpi_info support for rma calls --- diff --git a/src/smpi/private.h b/src/smpi/private.h index c0d051fc83..c9b7b8da8f 100644 --- a/src/smpi/private.h +++ b/src/smpi/private.h @@ -128,6 +128,7 @@ typedef struct s_smpi_mpi_type_key_elem *smpi_type_key_elem; typedef struct s_smpi_mpi_info { xbt_dict_t info_dict; + int refcount; } s_smpi_mpi_info_t; diff --git a/src/smpi/smpi_pmpi.c b/src/smpi/smpi_pmpi.c index 0e3b7f204e..2c7686cc7f 100644 --- a/src/smpi/smpi_pmpi.c +++ b/src/smpi/smpi_pmpi.c @@ -3110,6 +3110,7 @@ int PMPI_Info_create( MPI_Info *info){ return MPI_ERR_ARG; *info = xbt_new(s_smpi_mpi_info_t, 1); (*info)->info_dict= xbt_dict_new_homogeneous(NULL); + (*info)->refcount=1; return MPI_SUCCESS; } @@ -3124,8 +3125,11 @@ int PMPI_Info_set( MPI_Info info, char *key, char *value){ int PMPI_Info_free( MPI_Info *info){ if (info == NULL || *info==NULL) return MPI_ERR_ARG; - xbt_dict_free(&((*info)->info_dict)); - xbt_free(*info); + (*info)->refcount--; + if((*info)->refcount==0){ + xbt_dict_free(&((*info)->info_dict)); + xbt_free(*info); + } *info=MPI_INFO_NULL; return MPI_SUCCESS; } diff --git a/src/smpi/smpi_rma.c b/src/smpi/smpi_rma.c index 653131aba0..356ab585e0 100644 --- a/src/smpi/smpi_rma.c +++ b/src/smpi/smpi_rma.c @@ -18,7 +18,7 @@ typedef struct s_smpi_mpi_win{ MPI_Aint size; int disp_unit; MPI_Comm comm; - //MPI_Info info + MPI_Info info; int assert; xbt_dynar_t requests; xbt_bar_t bar; @@ -40,7 +40,9 @@ MPI_Win smpi_mpi_win_create( void *base, MPI_Aint size, int disp_unit, MPI_Info win->size = size; win->disp_unit = disp_unit; win->assert = 0; - //win->info = info; + win->info = info; + if(info!=MPI_INFO_NULL) + info->refcount++; win->comm = comm; win->name = NULL; win->requests = xbt_dynar_new(sizeof(MPI_Request), NULL); @@ -79,6 +81,9 @@ int smpi_mpi_win_free( MPI_Win* win){ if ((*win)->name != NULL){ xbt_free((*win)->name); } + if((*win)->info!=MPI_INFO_NULL){ + MPI_Info_free(&(*win)->info); + } xbt_free(*win); win = MPI_WIN_NULL; return MPI_SUCCESS;