Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Add mpi_info support for rma calls
[simgrid.git] / src / smpi / smpi_rma.c
index 7c7d867..356ab58 100644 (file)
@@ -18,11 +18,12 @@ 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;
   MPI_Win* connected_wins;
+  char* name;
 } s_smpi_mpi_win_t;
 
 
@@ -39,8 +40,11 @@ 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);
   win->connected_wins = xbt_malloc0(comm_size*sizeof(MPI_Win));
   win->connected_wins[rank] = win;
@@ -74,11 +78,36 @@ int smpi_mpi_win_free( MPI_Win* win){
   xbt_barrier_wait((*win)->bar);
   xbt_dynar_free(&(*win)->requests);
   xbt_free((*win)->connected_wins);
+  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;
 }
 
+void smpi_mpi_win_get_name(MPI_Win win, char* name, int* length){
+  if(win->name==NULL){
+    *length=0;
+    name=NULL;
+    return;
+  }
+  *length = strlen(win->name);
+  strcpy(name, win->name);
+}
+
+void smpi_mpi_win_get_group(MPI_Win win, MPI_Group* group){
+  if(win->comm != MPI_COMM_NULL)
+    *group = smpi_comm_group(win->comm);
+}
+
+void smpi_mpi_win_set_name(MPI_Win win, char* name){
+  win->name = strdup(name);;
+}
+
 
 int smpi_mpi_win_fence( int assert,  MPI_Win win){
 
@@ -165,7 +194,10 @@ int smpi_mpi_get( void *origin_addr, int origin_count, MPI_Datatype origin_datat
     //prepare receiver request
     MPI_Request rreq = smpi_rma_recv_init(origin_addr, origin_count, origin_datatype,
         smpi_group_index(smpi_comm_group(win->comm),target_rank), smpi_process_index(), RMA_TAG+2, win->comm, MPI_OP_NULL);
-
+        
+    //start the send, with another process than us as sender. 
+    smpi_mpi_start(sreq);
+    
     //push request to receiver's win
     xbt_dynar_push_as(send_win->requests, MPI_Request, sreq);