From: Augustin Degomme Date: Sat, 7 Aug 2021 17:28:23 +0000 (+0200) Subject: multiple fixes for replay X-Git-Tag: v3.29~156 X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/21314ed2ddb4a29b5b2b155ba9921978c759ba96 multiple fixes for replay in case of MPI_IN_PLACE or non relevant parameters, we could output nonsense to the ti trace --- diff --git a/src/instr/instr_private.hpp b/src/instr/instr_private.hpp index 59a9e6e992..f860972ee9 100644 --- a/src/instr/instr_private.hpp +++ b/src/instr/instr_private.hpp @@ -154,16 +154,16 @@ public: // VarCollTI: gatherv, scatterv, allgatherv, alltoallv (+ reducescatter out of laziness) class VarCollTIData : public TIData { int root_; - size_t send_size_; + long int send_size_; std::shared_ptr> sendcounts_; - size_t recv_size_; + long int recv_size_; std::shared_ptr> recvcounts_; std::string send_type_; std::string recv_type_; public: - VarCollTIData(const std::string& name, int root, size_t send_size, std::shared_ptr> sendcounts, - size_t recv_size, std::shared_ptr> recvcounts, const std::string& send_type, + VarCollTIData(const std::string& name, int root, long int send_size, std::shared_ptr> sendcounts, + long int recv_size, std::shared_ptr> recvcounts, const std::string& send_type, const std::string& recv_type) : TIData(name) , root_(root) @@ -178,12 +178,12 @@ public: { std::stringstream stream; stream << get_name() << " "; - if (send_size_ > 0) + if (send_size_ > -1) stream << send_size_ << " "; if (sendcounts_ != nullptr) for (auto count : *sendcounts_) stream << count << " "; - if (recv_size_ > 0) + if (recv_size_ > -1) stream << recv_size_ << " "; if (recvcounts_ != nullptr) for (auto count : *recvcounts_) diff --git a/src/smpi/bindings/smpi_pmpi_coll.cpp b/src/smpi/bindings/smpi_pmpi_coll.cpp index 6c990d4bb9..ad484c2e0e 100644 --- a/src/smpi/bindings/smpi_pmpi_coll.cpp +++ b/src/smpi/bindings/smpi_pmpi_coll.cpp @@ -198,12 +198,14 @@ int PMPI_Igatherv(const void* sendbuf, int sendcount, MPI_Datatype sendtype, voi auto trace_recvcounts = std::make_shared>(); if (rank == root) trace_recvcounts->insert(trace_recvcounts->end(), &recvcounts[0], &recvcounts[comm->size()]); + else //this is not significant outside of root, put 0 as we don't know if recvcounts is initialized + trace_recvcounts->insert(trace_recvcounts->end(), comm->size(), 0); TRACE_smpi_comm_in(pid, request == MPI_REQUEST_IGNORED ? "PMPI_Gatherv" : "PMPI_Igatherv", new simgrid::instr::VarCollTIData( request == MPI_REQUEST_IGNORED ? "gatherv" : "igatherv", root, - real_sendcount, - nullptr, recvtype->size(), trace_recvcounts, simgrid::smpi::Datatype::encode(real_sendtype), + sendcount, + nullptr, -1, trace_recvcounts, simgrid::smpi::Datatype::encode(real_sendtype), simgrid::smpi::Datatype::encode(recvtype))); if (request == MPI_REQUEST_IGNORED) simgrid::smpi::colls::gatherv(real_sendbuf, real_sendcount, real_sendtype, recvbuf, recvcounts, displs, recvtype, @@ -311,7 +313,7 @@ int PMPI_Iallgatherv(const void* sendbuf, int sendcount, MPI_Datatype sendtype, pid, request == MPI_REQUEST_IGNORED ? "PMPI_Allgatherv" : "PMPI_Iallgatherv", new simgrid::instr::VarCollTIData(request == MPI_REQUEST_IGNORED ? "allgatherv" : "iallgatherv", -1, sendcount, nullptr, - recvtype->size(), trace_recvcounts, simgrid::smpi::Datatype::encode(sendtype), + -1, trace_recvcounts, simgrid::smpi::Datatype::encode(sendtype), simgrid::smpi::Datatype::encode(recvtype))); if (request == MPI_REQUEST_IGNORED) simgrid::smpi::colls::allgatherv(sendbuf, sendcount, sendtype, recvbuf, recvcounts, displs, recvtype, comm); @@ -422,10 +424,13 @@ int PMPI_Iscatterv(const void* sendbuf, const int* sendcounts, const int* displs auto trace_sendcounts = std::make_shared>(); if (rank == root) trace_sendcounts->insert(trace_sendcounts->end(), &sendcounts[0], &sendcounts[comm->size()]); + else //this is not significant outside of root, put 0 as we don't know if sendcounts is initialized + trace_sendcounts->insert(trace_sendcounts->end(), comm->size(), 0); + TRACE_smpi_comm_in(pid, request == MPI_REQUEST_IGNORED ? "PMPI_Scatterv" : "PMPI_Iscatterv", new simgrid::instr::VarCollTIData( - request == MPI_REQUEST_IGNORED ? "scatterv" : "iscatterv", root, sendtype->size(), + request == MPI_REQUEST_IGNORED ? "scatterv" : "iscatterv", root, -1, trace_sendcounts, recvcount, nullptr, simgrid::smpi::Datatype::encode(sendtype), simgrid::smpi::Datatype::encode(recvtype))); @@ -554,8 +559,8 @@ int PMPI_Iscan(const void *sendbuf, void *recvbuf, int count, MPI_Datatype datat const void* real_sendbuf = smpi_get_in_place_buf(sendbuf, recvbuf, tmp_sendbuf, count, datatype); TRACE_smpi_comm_in(pid, request == MPI_REQUEST_IGNORED ? "PMPI_Scan" : "PMPI_Iscan", - new simgrid::instr::Pt2PtTIData(request == MPI_REQUEST_IGNORED ? "scan" : "iscan", -1, - count, simgrid::smpi::Datatype::encode(datatype))); + new simgrid::instr::CollTIData(request == MPI_REQUEST_IGNORED ? "scan" : "iscan", -1, -1.0, + count, 0, simgrid::smpi::Datatype::encode(datatype), "")); int retval; if (request == MPI_REQUEST_IGNORED) @@ -639,7 +644,7 @@ int PMPI_Ireduce_scatter(const void *sendbuf, void *recvbuf, const int *recvcoun TRACE_smpi_comm_in(pid, request == MPI_REQUEST_IGNORED ? "PMPI_Reduce_scatter" : "PMPI_Ireduce_scatter", new simgrid::instr::VarCollTIData( - request == MPI_REQUEST_IGNORED ? "reducescatter" : "ireducescatter", -1, datatype->size(), nullptr, + request == MPI_REQUEST_IGNORED ? "reducescatter" : "ireducescatter", -1, -1, nullptr, 0, trace_recvcounts, simgrid::smpi::Datatype::encode(datatype), "")); if (request == MPI_REQUEST_IGNORED) @@ -681,8 +686,8 @@ int PMPI_Ireduce_scatter_block(const void* sendbuf, void* recvbuf, int recvcount TRACE_smpi_comm_in( pid, request == MPI_REQUEST_IGNORED ? "PMPI_Reduce_scatter_block" : "PMPI_Ireduce_scatter_block", - new simgrid::instr::VarCollTIData(request == MPI_REQUEST_IGNORED ? "reducescatter" : "ireducescatter", -1, 0, - nullptr, 0, trace_recvcounts, simgrid::smpi::Datatype::encode(datatype), "")); + new simgrid::instr::VarCollTIData(request == MPI_REQUEST_IGNORED ? "reducescatter" : "ireducescatter", -1, -1, + nullptr, -1, trace_recvcounts, simgrid::smpi::Datatype::encode(datatype), "")); std::vector recvcounts(count); for (int i = 0; i < count; i++) diff --git a/src/smpi/internals/smpi_replay.cpp b/src/smpi/internals/smpi_replay.cpp index 87262080b2..d23817dcd1 100644 --- a/src/smpi/internals/smpi_replay.cpp +++ b/src/smpi/internals/smpi_replay.cpp @@ -371,11 +371,18 @@ void ReduceScatterArgParser::parse(simgrid::xbt::ReplayAction& action, const std datatype1 = parse_datatype(action, 3 + comm_size); for (unsigned int i = 0; i < comm_size; i++) { - recvcounts->push_back(std::stoi(action[i + 2])); + (*recvcounts)[i]= std::stoi(action[i + 2]); } recv_size_sum = std::accumulate(recvcounts->begin(), recvcounts->end(), 0); } +void ScanArgParser::parse(simgrid::xbt::ReplayAction& action, const std::string&) +{ + CHECK_ACTION_PARAMS(action, 1, 1) + size = parse_integer(action[2]); + datatype1 = parse_datatype(action, 3); +} + void AllToAllVArgParser::parse(simgrid::xbt::ReplayAction& action, const std::string&) { /* The structure of the alltoallv action for the rank 0 (total 4 processes) is the following: @@ -673,7 +680,7 @@ void GatherVAction::kernel(simgrid::xbt::ReplayAction&) const GatherVArgParser& args = get_args(); TRACE_smpi_comm_in(get_pid(), get_name().c_str(), new simgrid::instr::VarCollTIData( - get_name(), (get_name() == "gatherv") ? args.root : -1, args.send_size, nullptr, 0, + get_name(), (get_name() == "gatherv") ? args.root : -1, args.send_size, nullptr, -1, args.recvcounts, Datatype::encode(args.datatype1), Datatype::encode(args.datatype2))); if (get_name() == "gatherv") { @@ -710,7 +717,7 @@ void ScatterVAction::kernel(simgrid::xbt::ReplayAction&) int rank = MPI_COMM_WORLD->rank(); const ScatterVArgParser& args = get_args(); TRACE_smpi_comm_in(get_pid(), "action_scatterv", - new simgrid::instr::VarCollTIData(get_name(), args.root, 0, args.sendcounts, args.recv_size, + new simgrid::instr::VarCollTIData(get_name(), args.root, -1, args.sendcounts, args.recv_size, nullptr, Datatype::encode(args.datatype1), Datatype::encode(args.datatype2))); @@ -727,7 +734,7 @@ void ReduceScatterAction::kernel(simgrid::xbt::ReplayAction&) const ReduceScatterArgParser& args = get_args(); TRACE_smpi_comm_in( get_pid(), "action_reducescatter", - new simgrid::instr::VarCollTIData("reducescatter", -1, 0, nullptr, 0, args.recvcounts, + new simgrid::instr::VarCollTIData(get_name(), -1, -1, nullptr, -1, args.recvcounts, std::to_string(args.comp_size), /* ugly hack to print comp_size */ Datatype::encode(args.datatype1)));