Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Add mpi_info support for rma calls
authorAugustin Degomme <augustin.degomme@imag.fr>
Thu, 6 Nov 2014 10:07:01 +0000 (11:07 +0100)
committerAugustin Degomme <augustin.degomme@imag.fr>
Thu, 6 Nov 2014 10:07:01 +0000 (11:07 +0100)
src/smpi/private.h
src/smpi/smpi_pmpi.c
src/smpi/smpi_rma.c

index c0d051f..c9b7b8d 100644 (file)
@@ -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; 
 
 
index 0e3b7f2..2c7686c 100644 (file)
@@ -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;
 }
index 653131a..356ab58 100644 (file)
@@ -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;