Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Another bunch of int -> size_t conversion.
[simgrid.git] / src / smpi / plugins / ampi / ampi.cpp
index 852bf1c..4242dc5 100644 (file)
@@ -1,9 +1,8 @@
-/* Copyright (c) 2018-2019. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2018-2021. The SimGrid Team. All rights reserved.          */
 
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
-#include <simgrid/plugins/load_balancer.h>
 #include <simgrid/s4u/Actor.hpp>
 #include <src/instr/instr_smpi.hpp>
 #include <src/smpi/include/smpi_actor.hpp>
@@ -15,8 +14,6 @@
 #include "ampi.hpp"
 #include <smpi/sampi.h>
 
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(plugin_pampi, smpi, "Logging specific to the AMPI functions");
-
 static std::vector<size_t> memory_size(500, 0); // FIXME cheinrich This needs to be dynamic
 static std::map</*address*/ void*, size_t> alloc_table; // Keep track of all allocations
 
@@ -33,7 +30,7 @@ extern "C" void* _sampi_malloc(size_t size)
 extern "C" void _sampi_free(void* ptr)
 {
   size_t alloc_size = alloc_table.at(ptr);
-  int my_proc_id    = simgrid::s4u::this_actor::get_pid();
+  aid_t my_proc_id  = simgrid::s4u::this_actor::get_pid();
   memory_size[my_proc_id] -= alloc_size;
   xbt_free(ptr);
 }
@@ -50,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()) {
@@ -63,12 +60,12 @@ namespace simgrid {
 namespace smpi {
 namespace plugin {
 namespace ampi {
-simgrid::xbt::signal<void(simgrid::s4u::Actor const&)> on_iteration_in;
-simgrid::xbt::signal<void(simgrid::s4u::Actor const&)> on_iteration_out;
-}
-}
-}
-}
+xbt::signal<void(s4u::Actor const&)> on_iteration_in;
+xbt::signal<void(s4u::Actor const&)> on_iteration_out;
+} // namespace ampi
+} // namespace plugin
+} // namespace smpi
+} // namespace simgrid
 
 /* FIXME The following contains several times "rank() + 1". This works for one
  * instance, but we need to find a way to deal with this for several instances and
@@ -94,7 +91,7 @@ int APMPI_Iteration_out(MPI_Comm comm)
 void APMPI_Migrate(MPI_Comm comm)
 {
   smpi_bench_end();
-  int my_proc_id = simgrid::s4u::this_actor::get_pid();
+  aid_t my_proc_id = simgrid::s4u::this_actor::get_pid();
   TRACE_migration_call(comm->rank() + 1, new simgrid::instr::AmpiMigrateTIData(memory_size[my_proc_id]));
   smpi_bench_begin();
 }