X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/4ff3a4cf6e03165421f65616a22be86b8f528e21..c4000f89d4644c3d7ff6187a62a0930c4d53e683:/src/smpi/mpi/smpi_win.cpp diff --git a/src/smpi/mpi/smpi_win.cpp b/src/smpi/mpi/smpi_win.cpp index a7a61117a4..c082e48014 100644 --- a/src/smpi/mpi/smpi_win.cpp +++ b/src/smpi/mpi/smpi_win.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2007-2017. The SimGrid Team. All rights reserved. */ +/* Copyright (c) 2007-2018. The SimGrid Team. All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ @@ -44,6 +44,7 @@ Win::Win(void *base, MPI_Aint size, int disp_unit, MPI_Info info, MPI_Comm comm, mode_=0; comm->add_rma_win(this); + comm->ref(); Colls::allgather(&(connected_wins_[rank_]), sizeof(MPI_Win), MPI_BYTE, connected_wins_, sizeof(MPI_Win), MPI_BYTE, comm); @@ -72,6 +73,8 @@ Win::~Win(){ comm_->remove_rma_win(this); Colls::barrier(comm_); + Comm::unref(comm_); + if (rank_ == 0) MSG_barrier_destroy(bar_); xbt_mutex_destroy(mut_); @@ -718,6 +721,22 @@ int Win::finish_comms(int rank){ return size; } - +int Win::shared_query(int rank, MPI_Aint* size, int* disp_unit, void* baseptr) +{ + MPI_Win target_win = rank != MPI_PROC_NULL ? connected_wins_[rank] : nullptr; + for (int i = 0; not target_win && i < comm_->size(); i++) { + if (connected_wins_[i]->size_ > 0) + target_win = connected_wins_[i]; + } + if (target_win) { + *size = target_win->size_; + *disp_unit = target_win->disp_unit_; + *static_cast(baseptr) = target_win->base_; + } else { + *size = 0; + *static_cast(baseptr) = xbt_malloc(0); + } + return MPI_SUCCESS; +} } }