Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Update copyright lines with new year.
[simgrid.git] / src / smpi / internals / smpi_global.cpp
index ab1ebfb..9a4bd79 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2007-2019. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2007-2020. 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. */
@@ -132,13 +132,14 @@ void smpi_comm_set_copy_data_callback(void (*callback) (smx_activity_t, void*, s
   };
 }
 
-static void memcpy_private(void* dest, const void* src, std::vector<std::pair<size_t, size_t>>& private_blocks)
+static void memcpy_private(void* dest, const void* src, const std::vector<std::pair<size_t, size_t>>& private_blocks)
 {
   for (auto const& block : private_blocks)
     memcpy((uint8_t*)dest+block.first, (uint8_t*)src+block.first, block.second-block.first);
 }
 
-static void check_blocks(std::vector<std::pair<size_t, size_t>> &private_blocks, size_t buff_size) {
+static void check_blocks(const std::vector<std::pair<size_t, size_t>>& private_blocks, size_t buff_size)
+{
   for (auto const& block : private_blocks)
     xbt_assert(block.first <= block.second && block.second <= buff_size, "Oops, bug in shared malloc.");
 }
@@ -252,17 +253,14 @@ static void smpi_init_papi()
       }
 
       // NOTE: We cannot use a map here, as we must obey the order of the counters
-      // This is important for PAPI: We need to map the values of counters back
-      // to the event_names (so, when PAPI_read() has finished)!
+      // This is important for PAPI: We need to map the values of counters back to the event_names (so, when PAPI_read()
+      // has finished)!
       papi_counter_t counters2values;
 
-      // Iterate over all counters that were specified for this specific
-      // unit.
-      // Note that we need to remove the name of the unit
-      // (that could also be the "default" value), which always comes first.
-      // Hence, we start at ++(events.begin())!
+      // Iterate over all counters that were specified for this specific unit.
+      // Note that we need to remove the name of the unit (that could also be the "default" value), which always comes
+      // first. Hence, we start at ++(events.begin())!
       for (Tokenizer::iterator events_it = ++(event_tokens.begin()); events_it != event_tokens.end(); ++events_it) {
-
         int event_code   = PAPI_NULL;
         char* event_name = const_cast<char*>((*events_it).c_str());
         if (PAPI_event_name_to_code(event_name, &event_code) != PAPI_OK) {
@@ -386,7 +384,7 @@ static void smpi_copy_file(const std::string& src, const std::string& target, of
     if (got == -1) {
       xbt_assert(errno == EINTR, "Cannot read from %s", src.c_str());
     } else {
-      char* p  = buf;
+      const char* p = buf;
       int todo = got;
       while (int done = write(fdout, p, todo)) {
         if (done == -1) {
@@ -560,7 +558,7 @@ int smpi_main(const char* executable, int argc, char* argv[])
 
   /* This is a ... heavy way to count the MPI ranks */
   int rank_counts = 0;
-  simgrid::s4u::Actor::on_creation.connect([&rank_counts](simgrid::s4u::Actor& actor) {
+  simgrid::s4u::Actor::on_creation.connect([&rank_counts](const simgrid::s4u::Actor& actor) {
     if (not actor.is_daemon())
       rank_counts++;
   });
@@ -576,7 +574,6 @@ int smpi_main(const char* executable, int argc, char* argv[])
   if (MC_is_active()) {
     MC_run();
   } else {
-
     SIMIX_run();
 
     xbt_os_walltimer_stop(global_timer);