From 42f80f7c0ce00e583f9c787127492afecd17419e Mon Sep 17 00:00:00 2001 From: Arnaud Giersch Date: Tue, 20 Apr 2021 10:03:15 +0200 Subject: [PATCH] Convert some int -> size_t. --- include/simgrid/smpi/smpi_replay.hpp | 4 ++-- src/instr/instr_private.hpp | 18 +++++++++--------- src/smpi/bindings/smpi_pmpi_coll.cpp | 4 ++-- src/smpi/internals/smpi_replay.cpp | 10 +++++----- 4 files changed, 18 insertions(+), 18 deletions(-) diff --git a/include/simgrid/smpi/smpi_replay.hpp b/include/simgrid/smpi/smpi_replay.hpp index cdc53f1f30..eabde00830 100644 --- a/include/simgrid/smpi/smpi_replay.hpp +++ b/include/simgrid/smpi/smpi_replay.hpp @@ -205,8 +205,8 @@ public: } virtual void kernel(simgrid::xbt::ReplayAction& action) = 0; - unsigned char* send_buffer(int size) { return smpi_get_tmp_sendbuffer(size); } - unsigned char* recv_buffer(int size) { return smpi_get_tmp_recvbuffer(size); } + unsigned char* send_buffer(size_t size) { return smpi_get_tmp_sendbuffer(size); } + unsigned char* recv_buffer(size_t size) { return smpi_get_tmp_recvbuffer(size); } }; class WaitAction : public ReplayAction { diff --git a/src/instr/instr_private.hpp b/src/instr/instr_private.hpp index 28725aba3c..61f2e6890f 100644 --- a/src/instr/instr_private.hpp +++ b/src/instr/instr_private.hpp @@ -97,14 +97,14 @@ public: // Pt2PtTI: send, isend, ssend, issend, recv, irecv class Pt2PtTIData : public TIData { int endpoint_; - int size_; + size_t size_; std::string type_; int tag_ = 0; public: - Pt2PtTIData(const std::string& name, int endpoint, int size, const std::string& datatype) + Pt2PtTIData(const std::string& name, int endpoint, size_t size, const std::string& datatype) : TIData(name), endpoint_(endpoint), size_(size), type_(datatype){}; - Pt2PtTIData(const std::string& name, int endpoint, int size, int tag, const std::string& datatype) + Pt2PtTIData(const std::string& name, int endpoint, size_t size, int tag, const std::string& datatype) : TIData(name), endpoint_(endpoint), size_(size), type_(datatype), tag_(tag){}; std::string print() override @@ -154,16 +154,16 @@ public: // VarCollTI: gatherv, scatterv, allgatherv, alltoallv (+ reducescatter out of laziness) class VarCollTIData : public TIData { int root_; - int send_size_; + size_t send_size_; std::shared_ptr> sendcounts_; - int recv_size_; + size_t recv_size_; std::shared_ptr> recvcounts_; std::string send_type_; std::string recv_type_; public: - VarCollTIData(const std::string& name, int root, int send_size, std::shared_ptr> sendcounts, - int recv_size, std::shared_ptr> recvcounts, const std::string& send_type, + 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, 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_ > 0) stream << send_size_ << " "; if (sendcounts_ != nullptr) for (auto count : *sendcounts_) stream << count << " "; - if (recv_size_ >= 0) + if (recv_size_ > 0) 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 b292a42f09..61a41d7dea 100644 --- a/src/smpi/bindings/smpi_pmpi_coll.cpp +++ b/src/smpi/bindings/smpi_pmpi_coll.cpp @@ -668,7 +668,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, dt_send_size, nullptr, - -1, trace_recvcounts, simgrid::smpi::Datatype::encode(datatype), "")); + 0, trace_recvcounts, simgrid::smpi::Datatype::encode(datatype), "")); if (request == MPI_REQUEST_IGNORED) simgrid::smpi::colls::reduce_scatter(real_sendbuf, recvbuf, recvcounts, datatype, op, comm); @@ -711,7 +711,7 @@ 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, -1, trace_recvcounts, simgrid::smpi::Datatype::encode(datatype), "")); + nullptr, 0, 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 f37bebe5bc..41cca338ce 100644 --- a/src/smpi/internals/smpi_replay.cpp +++ b/src/smpi/internals/smpi_replay.cpp @@ -553,7 +553,7 @@ void CommunicatorAction::kernel(simgrid::xbt::ReplayAction&) void WaitAllAction::kernel(simgrid::xbt::ReplayAction&) { - const unsigned int count_requests = req_storage.size(); + const size_t count_requests = req_storage.size(); if (count_requests > 0) { TRACE_smpi_comm_in(get_pid(), __func__, new simgrid::instr::Pt2PtTIData("waitall", -1, count_requests, "")); @@ -666,7 +666,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, -1, + get_name(), (get_name() == "gatherv") ? args.root : -1, args.send_size, nullptr, 0, args.recvcounts, Datatype::encode(args.datatype1), Datatype::encode(args.datatype2))); if (get_name() == "gatherv") { @@ -703,7 +703,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, -1, args.sendcounts, args.recv_size, + new simgrid::instr::VarCollTIData(get_name(), args.root, 0, args.sendcounts, args.recv_size, nullptr, Datatype::encode(args.datatype1), Datatype::encode(args.datatype2))); @@ -720,7 +720,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, -1, args.recvcounts, + new simgrid::instr::VarCollTIData("reducescatter", -1, 0, nullptr, 0, args.recvcounts, std::to_string(args.comp_size), /* ugly hack to print comp_size */ Datatype::encode(args.datatype1))); @@ -737,7 +737,7 @@ void AllToAllVAction::kernel(simgrid::xbt::ReplayAction&) const AllToAllVArgParser& args = get_args(); TRACE_smpi_comm_in(get_pid(), __func__, new simgrid::instr::VarCollTIData( - "alltoallv", -1, args.send_size_sum, args.sendcounts, args.recv_size_sum, args.recvcounts, + "alltoallv", 0, args.send_size_sum, args.sendcounts, args.recv_size_sum, args.recvcounts, Datatype::encode(args.datatype1), Datatype::encode(args.datatype2))); colls::alltoallv(send_buffer(args.send_buf_size * args.datatype1->size()), args.sendcounts->data(), -- 2.20.1