X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/20180cf998fe77ea59e5dbffd7ba0515124c775d..6847a26d9973030337f6ef9f18464b1f04ce7452:/src/smpi/mpi/smpi_win.cpp diff --git a/src/smpi/mpi/smpi_win.cpp b/src/smpi/mpi/smpi_win.cpp index 5a2544d586..d56451151d 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. */ @@ -207,9 +207,9 @@ int Win::put( void *origin_addr, int origin_count, MPI_Datatype origin_datatype, return MPI_ERR_ARG; void* recv_addr = static_cast ( static_cast(recv_win->base_) + target_disp * recv_win->disp_unit_); - XBT_DEBUG("Entering MPI_Put to %d", target_rank); if (target_rank != comm_->rank()) { // This is not for myself, so we need to send messages + XBT_DEBUG("Entering MPI_Put to remote rank %d", target_rank); // prepare send_request MPI_Request sreq = // TODO cheinrich Check for rank / pid conversion @@ -239,6 +239,7 @@ int Win::put( void *origin_addr, int origin_count, MPI_Datatype origin_datatype, xbt_mutex_release(recv_win->mut_); }else{ + XBT_DEBUG("Entering MPI_Put from myself to myself, rank %d", target_rank); Datatype::copy(origin_addr, origin_count, origin_datatype, recv_addr, target_count, target_datatype); if(request!=nullptr) *request = MPI_REQUEST_NULL; @@ -634,9 +635,9 @@ int Win::unlock_all(){ int Win::flush(int rank){ MPI_Win target_win = connected_wins_[rank]; - int finished = finish_comms(rank); + int finished = finish_comms(rank_); XBT_DEBUG("Win_flush on local %d - Finished %d RMA calls", rank_, finished); - finished = target_win->finish_comms(rank_); + finished = target_win->finish_comms(rank); XBT_DEBUG("Win_flush on remote %d - Finished %d RMA calls", rank, finished); return MPI_SUCCESS; } @@ -693,8 +694,13 @@ int Win::finish_comms(int rank){ size = 0; std::vector myreqqs; std::vector::iterator iter = reqqs->begin(); + int proc_id = comm_->group()->actor(rank)->get_pid(); while (iter != reqqs->end()){ - if(((*iter)!=MPI_REQUEST_NULL) && (((*iter)->src() == rank) || ((*iter)->dst() == rank))){ + // Let's see if we're either the destination or the sender of this request + // because we only wait for requests that we are responsible for. + // Also use the process id here since the request itself returns from src() + // and dst() the process id, NOT the rank (which only exists in the context of a communicator). + if (((*iter) != MPI_REQUEST_NULL) && (((*iter)->src() == proc_id) || ((*iter)->dst() == proc_id))) { myreqqs.push_back(*iter); iter = reqqs->erase(iter); size++;