From: Christian Heinrich Date: Thu, 14 Jun 2018 15:22:10 +0000 (+0200) Subject: [SMPI/INSTR] Trace MPI_Wait() calls correctly X-Git-Tag: v3.20~50 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/90c0a75f04928e253fa0bf0b61b18698fba500a8 [SMPI/INSTR] Trace MPI_Wait() calls correctly We need to identify the request we want to wait for when replaying with TI-traces; so we need to trace additional information that we use for exactly that. --- diff --git a/src/instr/instr_private.hpp b/src/instr/instr_private.hpp index be709da8f0..46ac112896 100644 --- a/src/instr/instr_private.hpp +++ b/src/instr/instr_private.hpp @@ -196,6 +196,29 @@ public: } std::string display_size() override { return std::to_string(send_size > 0 ? send_size : recv_size); } }; + +/** + * If we want to wait for a request of asynchronous communication, we need to be able + * to identify this request. We do this by searching for a request identified by (src, dest, tag). + */ +class WaitTIData : public TIData { + int src; + int dest; + int tag; + +public: + explicit WaitTIData(int src, int dest, int tag) : TIData("wait"), src(src), dest(dest), tag(tag){}; + + std::string print() override + { + std::stringstream stream; + stream << getName() << " " << src << " " << dest << " " << tag; + + return stream.str(); + } + + std::string display_size() override { return ""; } +}; } } diff --git a/src/smpi/bindings/smpi_pmpi_request.cpp b/src/smpi/bindings/smpi_pmpi_request.cpp index e1a2e34bce..f8e4612425 100644 --- a/src/smpi/bindings/smpi_pmpi_request.cpp +++ b/src/smpi/bindings/smpi_pmpi_request.cpp @@ -670,7 +670,8 @@ int PMPI_Wait(MPI_Request * request, MPI_Status * status) int my_proc_id = (*request)->comm() != MPI_COMM_NULL ? simgrid::s4u::this_actor::get_pid() : -1; // TODO: cheinrich: Check if this correct or if it should be MPI_UNDEFINED - TRACE_smpi_comm_in(my_proc_id, __func__, new simgrid::instr::NoOpTIData("wait")); + TRACE_smpi_comm_in(my_proc_id, __func__, + new simgrid::instr::WaitTIData((*request)->src(), (*request)->dst(), (*request)->tag())); simgrid::smpi::Request::wait(request, status); retval = MPI_SUCCESS; diff --git a/src/smpi/internals/smpi_replay.cpp b/src/smpi/internals/smpi_replay.cpp index 671ed7ced7..2c5c920dfd 100644 --- a/src/smpi/internals/smpi_replay.cpp +++ b/src/smpi/internals/smpi_replay.cpp @@ -424,7 +424,7 @@ void WaitAction::kernel(simgrid::xbt::ReplayAction& action) // MPI_REQUEST_NULL by Request::wait! bool is_wait_for_receive = (request->flags() & MPI_REQ_RECV); // TODO: Here we take the rank while we normally take the process id (look for my_proc_id) - TRACE_smpi_comm_in(rank, __func__, new simgrid::instr::NoOpTIData("wait")); + TRACE_smpi_comm_in(rank, __func__, new simgrid::instr::WaitTIData(args.src, args.dst, args.tag)); MPI_Status status; Request::wait(&request, &status);