Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Another bunch of int -> size_t conversion.
authorArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Tue, 20 Apr 2021 12:58:05 +0000 (14:58 +0200)
committerArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Tue, 20 Apr 2021 13:40:36 +0000 (15:40 +0200)
src/instr/instr_private.hpp
src/smpi/bindings/smpi_pmpi_coll.cpp
src/smpi/include/private.hpp
src/smpi/internals/smpi_memory.cpp
src/smpi/internals/smpi_replay.cpp
src/smpi/plugins/ampi/ampi.cpp

index 61f2e68..41f0467 100644 (file)
@@ -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() << " ";
index 61a41d7..e52ae3b 100644 (file)
@@ -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)
index fb1f518..d344df8 100644 (file)
@@ -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);
 
index 02d93cf..c7a62bb 100644 (file)
@@ -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;
index 41cca33..75852d5 100644 (file)
@@ -61,9 +61,6 @@ public:
 };
 }
 
-using req_key_t     = std::tuple</*sender*/ int, /* receiver */ int, /* tag */ int>;
-using req_storage_t = std::unordered_map<req_key_t, MPI_Request, hash_tuple::hash<std::tuple<int, int, int>>>;
-
 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</*sender*/ int, /* receiver */ int, /* tag */ int>;
+  using req_storage_t = std::unordered_map<req_key_t, MPI_Request, hash_tuple::hash<std::tuple<int, int, int>>>;
+
+  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()),
index 40bab09..4242dc5 100644 (file)
@@ -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()) {