From 7512e5156110bb8ee68adcb64b1da833528412b5 Mon Sep 17 00:00:00 2001 From: Arnaud Giersch Date: Tue, 20 Apr 2021 14:58:05 +0200 Subject: [PATCH] Another bunch of int -> size_t conversion. --- src/instr/instr_private.hpp | 8 ++++---- src/smpi/bindings/smpi_pmpi_coll.cpp | 8 ++++---- src/smpi/include/private.hpp | 2 +- src/smpi/internals/smpi_memory.cpp | 4 ++-- src/smpi/internals/smpi_replay.cpp | 16 ++++++++-------- src/smpi/plugins/ampi/ampi.cpp | 2 +- 6 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/instr/instr_private.hpp b/src/instr/instr_private.hpp index 61f2e6890f..41f04678ba 100644 --- a/src/instr/instr_private.hpp +++ b/src/instr/instr_private.hpp @@ -119,13 +119,13 @@ public: // CollTI: bcast, reduce, allreduce, gather, scatter, allgather, alltoall class CollTIData : public TIData { int root_; - int send_size_; - int recv_size_; + size_t send_size_; + size_t recv_size_; std::string send_type_; std::string recv_type_; public: - CollTIData(const std::string& name, int root, double amount, int send_size, int recv_size, + CollTIData(const std::string& name, int root, double amount, size_t send_size, size_t recv_size, const std::string& send_type, const std::string& recv_type) : TIData(name, amount) , root_(root) @@ -138,7 +138,7 @@ public: { std::stringstream stream; stream << get_name() << " " << send_size_ << " "; - if (recv_size_ >= 0) + if (recv_size_ > 0) stream << recv_size_ << " "; if (get_amount() >= 0.0) stream << get_amount() << " "; diff --git a/src/smpi/bindings/smpi_pmpi_coll.cpp b/src/smpi/bindings/smpi_pmpi_coll.cpp index 61a41d7dea..e52ae3b6d5 100644 --- a/src/smpi/bindings/smpi_pmpi_coll.cpp +++ b/src/smpi/bindings/smpi_pmpi_coll.cpp @@ -74,7 +74,7 @@ int PMPI_Ibcast(void *buf, int count, MPI_Datatype datatype, aid_t pid = simgrid::s4u::this_actor::get_pid(); TRACE_smpi_comm_in(pid, request == MPI_REQUEST_IGNORED ? "PMPI_Bcast" : "PMPI_Ibcast", new simgrid::instr::CollTIData(request == MPI_REQUEST_IGNORED ? "bcast" : "ibcast", root, -1.0, - datatype->is_replayable() ? count : count * datatype->size(), -1, + datatype->is_replayable() ? count : count * datatype->size(), 0, simgrid::smpi::Datatype::encode(datatype), "")); if (comm->size() > 1) { if (request == MPI_REQUEST_IGNORED) @@ -486,8 +486,8 @@ int PMPI_Ireduce(const void *sendbuf, void *recvbuf, int count, MPI_Datatype dat aid_t pid = simgrid::s4u::this_actor::get_pid(); TRACE_smpi_comm_in(pid, request == MPI_REQUEST_IGNORED ? "PMPI_Reduce" : "PMPI_Ireduce", - new simgrid::instr::CollTIData(request == MPI_REQUEST_IGNORED ? "reduce" : "ireduce", root, 0, - datatype->is_replayable() ? count : count * datatype->size(), -1, + new simgrid::instr::CollTIData(request == MPI_REQUEST_IGNORED ? "reduce" : "ireduce", root, 0, + datatype->is_replayable() ? count : count * datatype->size(), 0, simgrid::smpi::Datatype::encode(datatype), "")); if (request == MPI_REQUEST_IGNORED) simgrid::smpi::colls::reduce(sendbuf, recvbuf, count, datatype, op, root, comm); @@ -542,7 +542,7 @@ int PMPI_Iallreduce(const void *sendbuf, void *recvbuf, int count, MPI_Datatype TRACE_smpi_comm_in(pid, request == MPI_REQUEST_IGNORED ? "PMPI_Allreduce" : "PMPI_Iallreduce", new simgrid::instr::CollTIData(request == MPI_REQUEST_IGNORED ? "allreduce" : "iallreduce", -1, 0, - datatype->is_replayable() ? count : count * datatype->size(), -1, + datatype->is_replayable() ? count : count * datatype->size(), 0, simgrid::smpi::Datatype::encode(datatype), "")); if (request == MPI_REQUEST_IGNORED) diff --git a/src/smpi/include/private.hpp b/src/smpi/include/private.hpp index fb1f518af6..d344df8144 100644 --- a/src/smpi/include/private.hpp +++ b/src/smpi/include/private.hpp @@ -115,7 +115,7 @@ XBT_PRIVATE bool smpi_cfg_display_alloc(); // utilities extern XBT_PRIVATE char* smpi_data_exe_start; // start of the data+bss segment of the executable -extern XBT_PRIVATE int smpi_data_exe_size; // size of the data+bss segment of the executable +extern XBT_PRIVATE size_t smpi_data_exe_size; // size of the data+bss segment of the executable XBT_PRIVATE void smpi_switch_data_segment(simgrid::s4u::ActorPtr actor); diff --git a/src/smpi/internals/smpi_memory.cpp b/src/smpi/internals/smpi_memory.cpp index 02d93cfc44..c7a62bb134 100644 --- a/src/smpi/internals/smpi_memory.cpp +++ b/src/smpi/internals/smpi_memory.cpp @@ -30,7 +30,7 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_memory, smpi, "Memory layout support for SM int smpi_loaded_page = -1; char* smpi_data_exe_start = nullptr; -int smpi_data_exe_size = 0; +size_t smpi_data_exe_size = 0; SmpiPrivStrategies smpi_privatize_global_variables; static void* smpi_data_exe_copy; @@ -210,7 +210,7 @@ void smpi_backup_global_memory_segment() initial_vm_map.clear(); initial_vm_map.shrink_to_fit(); - XBT_DEBUG("bss+data segment found : size %d starting at %p", smpi_data_exe_size, smpi_data_exe_start); + XBT_DEBUG("bss+data segment found : size %zu starting at %p", smpi_data_exe_size, smpi_data_exe_start); if (smpi_data_exe_size == 0) { // no need to do anything as global variables don't exist smpi_privatize_global_variables = SmpiPrivStrategies::NONE; diff --git a/src/smpi/internals/smpi_replay.cpp b/src/smpi/internals/smpi_replay.cpp index 41cca338ce..75852d52eb 100644 --- a/src/smpi/internals/smpi_replay.cpp +++ b/src/smpi/internals/smpi_replay.cpp @@ -61,9 +61,6 @@ public: }; } -using req_key_t = std::tuple; -using req_storage_t = std::unordered_map>>; - void log_timed_action(const simgrid::xbt::ReplayAction& action, double clock) { if (XBT_LOG_ISENABLED(smpi_replay, xbt_log_priority_verbose)){ @@ -86,11 +83,14 @@ MPI_Datatype MPI_DEFAULT_TYPE; class RequestStorage { private: - req_storage_t store; + using req_key_t = std::tuple; + using req_storage_t = std::unordered_map>>; + + req_storage_t store; public: RequestStorage() = default; - int size() const { return store.size(); } + size_t size() const { return store.size(); } req_storage_t& get_store() { return store; } @@ -587,7 +587,7 @@ void BcastAction::kernel(simgrid::xbt::ReplayAction&) const BcastArgParser& args = get_args(); TRACE_smpi_comm_in(get_pid(), "action_bcast", new simgrid::instr::CollTIData("bcast", MPI_COMM_WORLD->group()->actor(args.root), -1.0, args.size, - -1, Datatype::encode(args.datatype1), "")); + 0, Datatype::encode(args.datatype1), "")); colls::bcast(send_buffer(args.size * args.datatype1->size()), args.size, args.datatype1, args.root, MPI_COMM_WORLD); @@ -599,7 +599,7 @@ void ReduceAction::kernel(simgrid::xbt::ReplayAction&) const ReduceArgParser& args = get_args(); TRACE_smpi_comm_in(get_pid(), "action_reduce", new simgrid::instr::CollTIData("reduce", MPI_COMM_WORLD->group()->actor(args.root), args.comp_size, - args.comm_size, -1, Datatype::encode(args.datatype1), "")); + args.comm_size, 0, Datatype::encode(args.datatype1), "")); colls::reduce(send_buffer(args.comm_size * args.datatype1->size()), recv_buffer(args.comm_size * args.datatype1->size()), args.comm_size, args.datatype1, MPI_OP_NULL, @@ -613,7 +613,7 @@ void AllReduceAction::kernel(simgrid::xbt::ReplayAction&) { const AllReduceArgParser& args = get_args(); TRACE_smpi_comm_in(get_pid(), "action_allreduce", - new simgrid::instr::CollTIData("allreduce", -1, args.comp_size, args.comm_size, -1, + new simgrid::instr::CollTIData("allreduce", -1, args.comp_size, args.comm_size, 0, Datatype::encode(args.datatype1), "")); colls::allreduce(send_buffer(args.comm_size * args.datatype1->size()), diff --git a/src/smpi/plugins/ampi/ampi.cpp b/src/smpi/plugins/ampi/ampi.cpp index 40bab092d8..4242dc5a91 100644 --- a/src/smpi/plugins/ampi/ampi.cpp +++ b/src/smpi/plugins/ampi/ampi.cpp @@ -47,7 +47,7 @@ extern "C" void* _sampi_calloc(size_t num_elm, size_t elem_size) extern "C" void* _sampi_realloc(void* ptr, size_t size) { void* result = xbt_realloc(ptr, size); - int old_size = alloc_table.at(ptr); + size_t old_size = alloc_table.at(ptr); alloc_table.erase(ptr); alloc_table.insert({result, size}); if (not simgrid::s4u::this_actor::is_maestro()) { -- 2.20.1