Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'master' of framagit.org:simgrid/simgrid
authorArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Mon, 23 Dec 2019 13:55:49 +0000 (14:55 +0100)
committerArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Mon, 23 Dec 2019 13:55:49 +0000 (14:55 +0100)
47 files changed:
examples/s4u/dht-chord/s4u-dht-chord.hpp
include/simgrid/kernel/future.hpp
include/simgrid/s4u/Barrier.hpp
include/xbt/Extendable.hpp
src/instr/instr_platform.cpp
src/instr/instr_private.hpp
src/instr/jedule/jedule_platform.cpp
src/kernel/activity/MailboxImpl.hpp
src/kernel/lmm/maxmin.cpp
src/kernel/lmm/maxmin.hpp
src/mc/AddressSpace.hpp
src/mc/ModelChecker.cpp
src/mc/ModelChecker.hpp
src/mc/VisitedState.cpp
src/mc/VisitedState.hpp
src/mc/inspect/DwarfExpression.hpp
src/mc/inspect/Frame.hpp
src/mc/inspect/LocationList.hpp
src/mc/mc_state.cpp
src/mc/remote/Channel.hpp
src/mc/remote/RemotePtr.hpp
src/mc/sosp/ChunkedData.cpp
src/mc/sosp/ChunkedData.hpp
src/mc/sosp/PageStore.cpp
src/mc/sosp/Snapshot.cpp
src/mc/sosp/Snapshot.hpp
src/plugins/host_dvfs.cpp
src/plugins/host_energy.cpp
src/s4u/s4u_Barrier.cpp
src/simdag/sd_dotloader.cpp
src/smpi/bindings/smpi_pmpi_coll.cpp
src/smpi/bindings/smpi_pmpi_request.cpp
src/smpi/include/smpi_comm.hpp
src/smpi/include/smpi_datatype.hpp
src/smpi/include/smpi_f2c.hpp
src/smpi/include/smpi_win.hpp
src/smpi/mpi/smpi_comm.cpp
src/smpi/mpi/smpi_datatype.cpp
src/smpi/mpi/smpi_datatype_derived.cpp
src/smpi/mpi/smpi_f2c.cpp
src/smpi/mpi/smpi_win.cpp
src/surf/cpu_ti.cpp
src/surf/cpu_ti.hpp
src/surf/network_ib.hpp
src/surf/sg_platf.cpp
src/surf/surf_interface.cpp
src/xbt/backtrace.cpp

index eea1f2f..dd3c7b2 100644 (file)
@@ -37,16 +37,13 @@ enum e_message_type_t {
 class ChordMessage {
 public:
   e_message_type_t type;              // type of message
-  std::string issuer_host_name;       // used for logging
+  std::string issuer_host_name     = simgrid::s4u::this_actor::get_host()->get_name(); // used for logging
   int request_id     = -1;            // id (used by some types of messages)
   int request_finger = 1;             // finger parameter (used by some types of messages)
   int answer_id      = -1;            // answer (used by some types of messages)
   simgrid::s4u::Mailbox* answer_to = nullptr;       // mailbox to send an answer to (if any)
 
-  explicit ChordMessage(e_message_type_t type)
-      : type(type), issuer_host_name(simgrid::s4u::this_actor::get_host()->get_name())
-  {
-  }
+  explicit ChordMessage(e_message_type_t type) : type(type) {}
 
   static void destroy(void* message);
 };
index d938b44..c55f741 100644 (file)
@@ -445,17 +445,13 @@ template <class T> Future<T> unwrap_future(Future<Future<T>> future)
 template<class T>
 class Promise {
 public:
-  Promise() : state_(std::make_shared<FutureState<T>>()) {}
+  Promise() = default;
   explicit Promise(std::shared_ptr<FutureState<T>> state) : state_(std::move(state)) {}
 
   // Move type
   Promise(Promise const&) = delete;
   Promise& operator=(Promise const&) = delete;
-  Promise(Promise&& that) :
-    state_(std::move(that.state_)), future_get_(that.future_get_)
-  {
-    that.future_get_ = false;
-  }
+  Promise(Promise&& that) : state_(std::move(that.state_)) { std::swap(future_get_, that.future_get_); }
 
   Promise& operator=(Promise&& that)
   {
@@ -493,14 +489,14 @@ public:
   }
 
 private:
-  std::shared_ptr<FutureState<T>> state_;
+  std::shared_ptr<FutureState<T>> state_{new FutureState<T>()};
   bool future_get_ = false;
 };
 
 template<>
 class Promise<void> {
 public:
-  Promise() : state_(std::make_shared<FutureState<void>>()) {}
+  Promise() = default;
   explicit Promise(std::shared_ptr<FutureState<void>> state) : state_(std::move(state)) {}
   ~Promise()
   {
@@ -512,11 +508,7 @@ public:
   // Move type
   Promise(Promise const&) = delete;
   Promise& operator=(Promise const&) = delete;
-  Promise(Promise&& that) :
-    state_(std::move(that.state_)), future_get_(that.future_get_)
-  {
-    that.future_get_ = false;
-  }
+  Promise(Promise&& that) : state_(std::move(that.state_)) { std::swap(future_get_, that.future_get_); }
   Promise& operator=(Promise&& that)
   {
     this->state_ = std::move(that.state_);
@@ -548,7 +540,7 @@ public:
   }
 
 private:
-  std::shared_ptr<FutureState<void>> state_;
+  std::shared_ptr<FutureState<void>> state_{new FutureState<void>()};
   bool future_get_ = false;
 };
 
index db8e05e..2076155 100644 (file)
@@ -20,8 +20,8 @@ namespace s4u {
 
 class XBT_PUBLIC Barrier {
 private:
-  MutexPtr mutex_;
-  ConditionVariablePtr cond_;
+  MutexPtr mutex_            = Mutex::create();
+  ConditionVariablePtr cond_ = ConditionVariable::create();
   unsigned int expected_actors_;
   unsigned int arrived_actors_ = 0;
 
@@ -30,7 +30,7 @@ private:
 
 public:
   /** Creates a barrier for the given amount of actors */
-  explicit Barrier(unsigned int count);
+  explicit Barrier(unsigned int expected_processes) : expected_actors_(expected_processes) {}
 #ifndef DOXYGEN
   ~Barrier()              = default;
   Barrier(Barrier const&) = delete;
index 66c2aba..369e3a3 100644 (file)
@@ -19,8 +19,8 @@ template<class T>          class Extendable;
 
 template<class T, class U>
 class Extension {
-  static const std::size_t INVALID_ID = std::numeric_limits<std::size_t>::max();
-  std::size_t id_                     = INVALID_ID;
+  static constexpr std::size_t INVALID_ID = std::numeric_limits<std::size_t>::max();
+  std::size_t id_                         = INVALID_ID;
   friend class Extendable<T>;
   explicit constexpr Extension(std::size_t id) : id_(id) {}
 public:
@@ -48,7 +48,8 @@ template<class T>
 class Extendable {
 private:
   static std::vector<void(*)(void*)> deleters_;
-  std::vector<void*> extensions_;
+  std::vector<void*> extensions_{(deleters_.size() > 0 ? deleters_.size() : 1), nullptr};
+
 public:
   static size_t extension_create(void (*deleter)(void*))
   {
@@ -68,7 +69,7 @@ public:
   {
     return Extension<T, U>(extension_create([](void* p) { delete static_cast<U*>(p); }));
   }
-  Extendable() : extensions_((deleters_.size() > 0 ? deleters_.size() : 1), nullptr) {}
+  Extendable() {}
   Extendable(const Extendable&) = delete;
   Extendable& operator=(const Extendable&) = delete;
   ~Extendable()
index f0dd78a..ef07fe1 100644 (file)
@@ -138,8 +138,8 @@ static void recursiveGraphExtraction(simgrid::s4u::NetZone* netzone, container_t
   }
 
   xbt_graph_t graph                        = xbt_graph_new_graph(0, nullptr);
-  std::map<std::string, xbt_node_t>* nodes = new std::map<std::string, xbt_node_t>;
-  std::map<std::string, xbt_edge_t>* edges = new std::map<std::string, xbt_edge_t>;
+  std::map<std::string, xbt_node_t>* nodes = new std::map<std::string, xbt_node_t>();
+  std::map<std::string, xbt_edge_t>* edges = new std::map<std::string, xbt_edge_t>();
 
   netzone->get_impl()->get_graph(graph, nodes, edges);
   for (auto elm : *edges) {
@@ -278,7 +278,7 @@ static void instr_netpoint_on_creation(simgrid::kernel::routing::NetPoint const&
 static void instr_on_platform_created()
 {
   currentContainer.clear();
-  std::set<std::string>* filter = new std::set<std::string>;
+  std::set<std::string>* filter = new std::set<std::string>();
   XBT_DEBUG("Starting graph extraction.");
   recursiveGraphExtraction(simgrid::s4u::Engine::get_instance()->get_netzone_root(),
                            simgrid::instr::Container::get_root(), filter);
@@ -508,8 +508,8 @@ static void recursiveXBTGraphExtraction(xbt_graph_t graph, std::map<std::string,
 xbt_graph_t instr_routing_platform_graph()
 {
   xbt_graph_t ret                          = xbt_graph_new_graph(0, nullptr);
-  std::map<std::string, xbt_node_t>* nodes = new std::map<std::string, xbt_node_t>;
-  std::map<std::string, xbt_edge_t>* edges = new std::map<std::string, xbt_edge_t>;
+  std::map<std::string, xbt_node_t>* nodes = new std::map<std::string, xbt_node_t>();
+  std::map<std::string, xbt_edge_t>* edges = new std::map<std::string, xbt_edge_t>();
   recursiveXBTGraphExtraction(ret, nodes, edges, simgrid::s4u::Engine::get_instance()->get_netzone_root(),
                               simgrid::instr::Container::get_root());
   delete nodes;
index 5d1b98c..228d6fa 100644 (file)
@@ -115,13 +115,14 @@ public:
 };
 
 class Pt2PtTIData : public TIData {
-  int tag;
+  int tag = 0;
+
 public:
   explicit Pt2PtTIData(const std::string& name, int endpoint, int size, int tag, const std::string& datatype)
       : TIData(name, endpoint, size, datatype), tag(tag){};
 
   explicit Pt2PtTIData(const std::string& name, int endpoint, int size, const std::string& datatype)
-      : TIData(name, endpoint, size, datatype), tag(0){};
+      : TIData(name, endpoint, size, datatype){};
   std::string print() override
   {
     std::stringstream stream;
index fd24898..3c6a591 100644 (file)
@@ -19,9 +19,8 @@ std::unordered_map<std::string, jed_container_t> container_name2container;
 namespace simgrid {
 namespace jedule {
 Subset::Subset(int start_idx, int end_idx, Container* parent)
-: start_idx(start_idx), parent(parent)
+    : start_idx(start_idx), nres(end_idx - start_idx + 1), parent(parent)
 {
-  nres=end_idx-start_idx+1;
 }
 
 Container::Container(const std::string& name) : name(name)
index 5cb5a9f..55b5656 100644 (file)
@@ -29,10 +29,7 @@ class MailboxImpl {
   friend s4u::Mailbox* s4u::Mailbox::by_name(const std::string& name);
   friend mc::CommunicationDeterminismChecker;
 
-  explicit MailboxImpl(const std::string& name)
-      : piface_(this), name_(name), comm_queue_(MAX_MAILBOX_SIZE), done_comm_queue_(MAX_MAILBOX_SIZE)
-  {
-  }
+  explicit MailboxImpl(const std::string& name) : piface_(this), name_(name) {}
 
 public:
   const xbt::string& get_name() const { return name_; }
@@ -47,9 +44,9 @@ public:
                                  const CommImplPtr& my_synchro, bool done, bool remove_matching);
 
   actor::ActorImplPtr permanent_receiver_; // actor to which the mailbox is attached
-  boost::circular_buffer_space_optimized<CommImplPtr> comm_queue_;
-  boost::circular_buffer_space_optimized<CommImplPtr> done_comm_queue_; // messages already received in the permanent
-                                                                        // receive mode
+  boost::circular_buffer_space_optimized<CommImplPtr> comm_queue_{MAX_MAILBOX_SIZE};
+  // messages already received in the permanent receive mode
+  boost::circular_buffer_space_optimized<CommImplPtr> done_comm_queue_{MAX_MAILBOX_SIZE};
 };
 } // namespace activity
 } // namespace kernel
index 96cc184..d0a9f1f 100644 (file)
@@ -4,7 +4,6 @@
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
 #include "src/kernel/lmm/maxmin.hpp"
-#include "src/surf/surf_interface.hpp"
 #include "xbt/backtrace.hpp"
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_maxmin, surf, "Logging specific to SURF (maxmin)");
@@ -172,17 +171,6 @@ void System::cnst_free(Constraint* cnst)
 Constraint::Constraint(resource::Resource* id_value, double bound_value) : bound_(bound_value), id_(id_value)
 {
   rank_ = next_rank_++;
-
-  remaining_           = 0.0;
-  usage_               = 0.0;
-  concurrency_limit_   = sg_concurrency_limit;
-  concurrency_current_ = 0;
-  concurrency_maximum_ = 0;
-  sharing_policy_      = s4u::Link::SharingPolicy::SHARED;
-
-  lambda_     = 0.0;
-  new_lambda_ = 0.0;
-  cnst_light_ = nullptr;
 }
 
 Constraint* System::constraint_new(resource::Resource* id, double bound_value)
index 670e24a..4244c99 100644 (file)
@@ -8,6 +8,7 @@
 
 #include "simgrid/kernel/resource/Action.hpp"
 #include "simgrid/s4u/Link.hpp"
+#include "src/surf/surf_interface.hpp"
 #include "xbt/asserts.h"
 #include "xbt/mallocator.h"
 
@@ -260,24 +261,24 @@ public:
   boost::intrusive::list<Element, boost::intrusive::member_hook<Element, boost::intrusive::list_member_hook<>,
                                                                 &Element::active_element_set_hook>>
       active_element_set_;
-  double remaining_;
-  double usage_;
+  double remaining_ = 0.0;
+  double usage_     = 0.0;
   double bound_;
   // TODO MARTIN Check maximum value across resources at the end of simulation and give a warning is more than e.g. 500
-  int concurrency_current_; /* The current concurrency */
-  int concurrency_maximum_; /* The maximum number of (enabled and disabled) variables associated to the constraint at
-                             * any given time (essentially for tracing)*/
+  int concurrency_current_ = 0; /* The current concurrency */
+  int concurrency_maximum_ = 0; /* The maximum number of (enabled and disabled) variables associated to the constraint
+                                 * at any given time (essentially for tracing)*/
 
-  s4u::Link::SharingPolicy sharing_policy_;
+  s4u::Link::SharingPolicy sharing_policy_ = s4u::Link::SharingPolicy::SHARED;
   int rank_; // Only used in debug messages to identify the constraint
-  double lambda_;
-  double new_lambda_;
-  ConstraintLight* cnst_light_;
+  double lambda_               = 0.0;
+  double new_lambda_           = 0.0;
+  ConstraintLight* cnst_light_ = nullptr;
 
 private:
   static int next_rank_;  // To give a separate rank_ to each constraint
-  int concurrency_limit_; /* The maximum number of variables that may be enabled at any time (stage variables if
-                           * necessary) */
+  int concurrency_limit_ = sg_concurrency_limit; /* The maximum number of variables that may be enabled at any time
+                                                  * (stage variables if necessary) */
   resource::Resource* id_;
 };
 
index d14040e..847ee77 100644 (file)
@@ -19,10 +19,10 @@ namespace mc {
  *  integers are not allowed.
  */
 class ReadOptions {
-  std::uint32_t value_;
+  std::uint32_t value_ = 0;
   constexpr explicit ReadOptions(std::uint32_t value) : value_(value) {}
 public:
-  constexpr ReadOptions() : value_(0) {}
+  constexpr ReadOptions() {}
 
   explicit constexpr operator bool() const { return value_ != 0; }
   constexpr bool operator!() const { return value_ == 0; }
index 52c7796..f5ef3b4 100644 (file)
@@ -32,14 +32,7 @@ using simgrid::mc::remote;
 namespace simgrid {
 namespace mc {
 
-ModelChecker::ModelChecker(std::unique_ptr<RemoteClient> process)
-    : base_(nullptr)
-    , socket_event_(nullptr)
-    , signal_event_(nullptr)
-    , page_store_(500)
-    , process_(std::move(process))
-{
-}
+ModelChecker::ModelChecker(std::unique_ptr<RemoteClient> process) : process_(std::move(process)) {}
 
 ModelChecker::~ModelChecker()
 {
index d5016d3..fcbff13 100644 (file)
@@ -21,14 +21,14 @@ namespace mc {
 /** State of the model-checker (global variables for the model checker)
  */
 class ModelChecker {
-  struct event_base *base_;
-  struct event* socket_event_;
-  struct event* signal_event_;
+  struct event_base* base_    = nullptr;
+  struct event* socket_event_ = nullptr;
+  struct event* signal_event_ = nullptr;
   /** String pool for host names */
   // TODO, use std::set with heterogeneous comparison lookup (C++14)?
   std::set<std::string> hostnames_;
   // This is the parent snapshot of the current state:
-  PageStore page_store_;
+  PageStore page_store_{500};
   std::unique_ptr<RemoteClient> process_;
   Checker* checker_ = nullptr;
 public:
index cb4d2d9..5b8919b 100644 (file)
@@ -27,7 +27,6 @@ VisitedState::VisitedState(unsigned long state_number) : num(state_number)
   this->actors_count = mc_model_checker->process().actors().size();
 
   this->system_state = std::make_shared<simgrid::mc::Snapshot>(state_number);
-  this->original_num = -1;
 }
 
 void VisitedStates::prune()
index ea116d9..6926485 100644 (file)
@@ -21,7 +21,7 @@ public:
   std::size_t heap_bytes_used = 0;
   int actors_count            = 0;
   int num          = 0; // unique id of that state in the storage of all stored IDs
-  int original_num = 0; // num field of the VisitedState to which I was declared equal to (used for dot_output)
+  int original_num = -1; // num field of the VisitedState to which I was declared equal to (used for dot_output)
 
   explicit VisitedState(unsigned long state_number);
   ~VisitedState() = default;
index efb089e..0f695ee 100644 (file)
@@ -42,21 +42,12 @@ typedef std::vector<Dwarf_Op> DwarfExpression;
  *  the process memory, etc. All those informations are gathered in
  *  the evaluation context.
  */
-class ExpressionContext {
-public:
-  ExpressionContext()
-      : cursor(nullptr)
-      , frame_base(nullptr)
-      , address_space(nullptr)
-      , object_info(nullptr)
-  {
-  }
+struct ExpressionContext {
   /** CPU state (registers) */
-  unw_cursor_t* cursor;
-  void* frame_base;
-  /** Address space used to read memory */
-  const simgrid::mc::AddressSpace* address_space;
-  simgrid::mc::ObjectInformation* object_info;
+  unw_cursor_t* cursor                           = nullptr;
+  void* frame_base                               = nullptr;
+  const simgrid::mc::AddressSpace* address_space = nullptr; /** Address space used to read memory */
+  simgrid::mc::ObjectInformation* object_info    = nullptr;
 };
 
 /** When an error happens in the execution of a DWARF expression */
@@ -77,11 +68,9 @@ public:
 private:
   // Values of the stack (the top is stack_[size_ - 1]):
   uintptr_t stack_[max_size]{0};
-  size_t size_;
+  size_t size_ = 0;
 
 public:
-  ExpressionStack() : size_(0) {}
-
   // Access:
   std::size_t size() const { return size_; }
   bool empty() const { return size_ == 0; }
index 51ca562..385eca6 100644 (file)
@@ -23,8 +23,6 @@ namespace mc {
 /** Debug information about a given function or scope within a function */
 class Frame {
 public:
-  Frame() = default;
-
   /** Kind of scope (DW_TAG_subprogram, DW_TAG_inlined_subroutine, etc.) */
   int tag = DW_TAG_invalid;
 
@@ -32,7 +30,7 @@ public:
   std::string name;
 
   /** Range of instruction addresses for which this scope is valid */
-  simgrid::xbt::Range<std::uint64_t> range = {0, 0};
+  simgrid::xbt::Range<std::uint64_t> range{0, 0};
 
   simgrid::dwarf::LocationList frame_base_location;
 
index 07dcb7c..adb4b4e 100644 (file)
@@ -49,12 +49,12 @@ typedef std::vector<LocationListEntry> LocationList;
  */
 class Location {
 private:
-  void* memory_;
+  void* memory_    = nullptr;
   int register_id_ = 0;
 
 public:
   explicit Location(void* x) : memory_(x) {}
-  explicit Location(int register_id) : memory_(nullptr), register_id_(register_id) {}
+  explicit Location(int register_id) : register_id_(register_id) {}
   // Type of location:
   bool in_register() const { return memory_ == nullptr; }
   bool in_memory() const { return memory_ != nullptr; }
index 9669200..5670d07 100644 (file)
@@ -19,8 +19,6 @@ namespace mc {
 State::State(unsigned long state_number) : num_(state_number)
 {
   this->internal_comm_.clear();
-  this->internal_req_ = s_smx_simcall();
-  this->executed_req_ = s_smx_simcall();
 
   actor_states_.resize(MC_smx_get_maxpid());
   /* Stateful model checking */
index a3e2344..0acbf15 100644 (file)
@@ -38,8 +38,7 @@ public:
   Channel(Channel&& that) : socket_(that.socket_) { that.socket_ = -1; }
   Channel& operator=(Channel&& that)
   {
-    this->socket_ = that.socket_;
-    that.socket_  = -1;
+    std::swap(this->socket_, that.socket_);
     return *this;
   }
 
index 5da8005..f4f38ef 100644 (file)
@@ -59,11 +59,11 @@ public:
  *  as a `uint64_t`.
  */
 template <class T> class RemotePtr {
-  std::uint64_t address_;
+  std::uint64_t address_ = 0;
 
 public:
-  RemotePtr() : address_(0) {}
-  explicit RemotePtr(std::nullptr_t) : address_(0) {}
+  RemotePtr() = default;
+  explicit RemotePtr(std::nullptr_t) {}
   explicit RemotePtr(std::uint64_t address) : address_(address) {}
   explicit RemotePtr(T* address) : address_((std::uintptr_t)address) {}
   explicit RemotePtr(Remote<T*> p) : address_((std::uintptr_t)*p.get_buffer()) {}
index 808fc60..14796c4 100644 (file)
@@ -16,8 +16,8 @@ namespace mc {
  *  @return                Snapshot page numbers of this new snapshot
  */
 ChunkedData::ChunkedData(PageStore& store, AddressSpace& as, RemotePtr<void> addr, std::size_t page_count)
+    : store_(&store)
 {
-  store_ = &store;
   this->pagenos_.resize(page_count);
   std::vector<char> buffer(xbt_pagesize);
 
index 2545954..8d5f1ba 100644 (file)
@@ -46,9 +46,9 @@ public:
     for (std::size_t const& pageno : pagenos_)
       store_->ref_page(pageno);
   }
-  ChunkedData(ChunkedData&& that) : store_(that.store_), pagenos_(std::move(that.pagenos_))
+  ChunkedData(ChunkedData&& that) : pagenos_(std::move(that.pagenos_))
   {
-    that.store_ = nullptr;
+    std::swap(store_, that.store_);
     that.pagenos_.clear();
   }
   ChunkedData& operator=(ChunkedData const& that)
index e3702c8..149e36d 100644 (file)
@@ -50,7 +50,7 @@ static XBT_ALWAYS_INLINE PageStore::hash_type mc_hash_page(const void* data)
 
 // ***** snapshot_page_manager
 
-PageStore::PageStore(std::size_t size) : memory_(nullptr), capacity_(size), top_index_(0)
+PageStore::PageStore(std::size_t size) : capacity_(size)
 {
   // Using mmap in order to be able to expand the region by relocating it somewhere else in the virtual memory space:
   void* memory =
index e42e3d3..de20ddd 100644 (file)
@@ -197,8 +197,7 @@ static void snapshot_ignore_restore(simgrid::mc::Snapshot* snapshot)
     snapshot->process()->write_bytes(ignored_data.data.data(), ignored_data.data.size(), remote(ignored_data.start));
 }
 
-Snapshot::Snapshot(int num_state, RemoteClient* process)
-    : AddressSpace(process), num_state_(num_state), heap_bytes_used_(0), enabled_processes_(), hash_(0)
+Snapshot::Snapshot(int num_state, RemoteClient* process) : AddressSpace(process), num_state_(num_state)
 {
   XBT_DEBUG("Taking snapshot %i", num_state);
 
index f227fe7..6741084 100644 (file)
@@ -78,7 +78,7 @@ public:
 
   // To be private
   int num_state_;
-  std::size_t heap_bytes_used_;
+  std::size_t heap_bytes_used_ = 0;
   std::vector<std::unique_ptr<Region>> snapshot_regions_;
   std::set<pid_t> enabled_processes_;
   std::vector<std::size_t> stack_sizes_;
index af145fb..f477c5f 100644 (file)
@@ -85,15 +85,15 @@ namespace dvfs {
 class Governor {
   simgrid::s4u::Host* const host_;
   double sampling_rate_;
-  int min_pstate; //< Never use a pstate less than this one
-  int max_pstate; //< Never use a pstate larger than this one
+  int min_pstate = cfg_min_pstate; //< Never use a pstate less than this one
+  int max_pstate = cfg_max_pstate; //< Never use a pstate larger than this one
 
 public:
   explicit Governor(simgrid::s4u::Host* ptr)
       : host_(ptr)
-      , min_pstate(cfg_min_pstate)
-      , max_pstate(cfg_max_pstate == max_pstate_not_limited ? host_->get_pstate_count() - 1 : cfg_max_pstate)
   {
+    if (cfg_max_pstate == max_pstate_not_limited)
+      max_pstate = host_->get_pstate_count() - 1;
     init();
   }
   virtual ~Governor() = default;
index c7ea340..6eac380 100644 (file)
@@ -160,7 +160,7 @@ public:
 
   double watts_off_    = 0.0; /*< Consumption when the machine is turned off (shutdown) */
   double total_energy_ = 0.0; /*< Total energy consumed by the host */
-  double last_updated_;       /*< Timestamp of the last energy update event*/
+  double last_updated_ = surf_get_clock(); /*< Timestamp of the last energy update event*/
 };
 
 simgrid::xbt::Extension<simgrid::s4u::Host, HostEnergy> HostEnergy::EXTENSION_ID;
@@ -198,7 +198,7 @@ void HostEnergy::update()
   this->pstate_ = host_->is_on() ? host_->get_pstate() : pstate_off_;
 }
 
-HostEnergy::HostEnergy(simgrid::s4u::Host* ptr) : host_(ptr), last_updated_(surf_get_clock())
+HostEnergy::HostEnergy(simgrid::s4u::Host* ptr) : host_(ptr)
 {
   init_watts_range_list();
 
index 7289a6c..5002e6f 100644 (file)
@@ -17,11 +17,6 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(s4u_barrier, s4u, "S4U barrier");
 namespace simgrid {
 namespace s4u {
 
-Barrier::Barrier(unsigned int expected_processes)
-    : mutex_(Mutex::create()), cond_(ConditionVariable::create()), expected_actors_(expected_processes)
-{
-}
-
 /** @brief Create a new barrier
  *
  * See @ref s4u_raii.
index 90d8662..bfd0ddb 100644 (file)
@@ -99,7 +99,7 @@ xbt_dynar_t SD_dotload_generic(const char* filename, bool sequential, bool sched
           if (comp != computers.end()) {
             computer = comp->second;
           } else {
-            computer = new std::vector<SD_task_t>;
+            computer = new std::vector<SD_task_t>();
             computers.insert({char_performer, computer});
           }
           if (static_cast<unsigned int>(order) < computer->size()) {
index 0a97fa0..dd38bb4 100644 (file)
@@ -176,7 +176,7 @@ int PMPI_Igatherv(const void* sendbuf, int sendcount, MPI_Datatype sendtype, voi
   int rank         = simgrid::s4u::this_actor::get_pid();
   int dt_size_recv = recvtype->is_replayable() ? 1 : recvtype->size();
 
-  std::vector<int>* trace_recvcounts = new std::vector<int>;
+  std::vector<int>* trace_recvcounts = new std::vector<int>();
   if (comm->rank() == root) {
     for (int i = 0; i < comm->size(); i++) // copy data to avoid bad free
       trace_recvcounts->push_back(recvcounts[i] * dt_size_recv);
@@ -275,7 +275,7 @@ int PMPI_Iallgatherv(const void* sendbuf, int sendcount, MPI_Datatype sendtype,
   int rank         = simgrid::s4u::this_actor::get_pid();
   int dt_size_recv = recvtype->is_replayable() ? 1 : recvtype->size();
 
-  std::vector<int>* trace_recvcounts = new std::vector<int>;
+  std::vector<int>* trace_recvcounts = new std::vector<int>();
   for (int i = 0; i < comm->size(); i++) { // copy data to avoid bad free
     trace_recvcounts->push_back(recvcounts[i] * dt_size_recv);
   }
@@ -377,7 +377,7 @@ int PMPI_Iscatterv(const void* sendbuf, const int* sendcounts, const int* displs
   int rank         = simgrid::s4u::this_actor::get_pid();
   int dt_size_send = sendtype->is_replayable() ? 1 : sendtype->size();
 
-  std::vector<int>* trace_sendcounts = new std::vector<int>;
+  std::vector<int>* trace_sendcounts = new std::vector<int>();
   if (comm->rank() == root) {
     for (int i = 0; i < comm->size(); i++) { // copy data to avoid bad free
       trace_sendcounts->push_back(sendcounts[i] * dt_size_send);
@@ -576,7 +576,7 @@ int PMPI_Ireduce_scatter(const void *sendbuf, void *recvbuf, const int *recvcoun
 
   smpi_bench_end();
   int rank                           = simgrid::s4u::this_actor::get_pid();
-  std::vector<int>* trace_recvcounts = new std::vector<int>;
+  std::vector<int>* trace_recvcounts = new std::vector<int>();
   int dt_send_size                   = datatype->is_replayable() ? 1 : datatype->size();
   int totalcount                     = 0;
 
@@ -733,8 +733,8 @@ int PMPI_Ialltoallv(const void* sendbuf, const int* sendcounts, const int* sendd
   smpi_bench_end();
   int send_size                      = 0;
   int recv_size                      = 0;
-  std::vector<int>* trace_sendcounts = new std::vector<int>;
-  std::vector<int>* trace_recvcounts = new std::vector<int>;
+  std::vector<int>* trace_sendcounts = new std::vector<int>();
+  std::vector<int>* trace_recvcounts = new std::vector<int>();
   int dt_size_recv                   = recvtype->size();
 
   const int* real_sendcounts = sendcounts;
@@ -824,8 +824,8 @@ int PMPI_Ialltoallw(const void* sendbuf, const int* sendcounts, const int* sendd
 
   int send_size                      = 0;
   int recv_size                      = 0;
-  std::vector<int>* trace_sendcounts = new std::vector<int>;
-  std::vector<int>* trace_recvcounts = new std::vector<int>;
+  std::vector<int>* trace_sendcounts = new std::vector<int>();
+  std::vector<int>* trace_recvcounts = new std::vector<int>();
 
   const int* real_sendcounts         = sendcounts;
   const int* real_senddispls          = senddispls;
index 88a4c98..dc9f48e 100644 (file)
@@ -427,8 +427,8 @@ int PMPI_Sendrecv(const void* sendbuf, int sendcount, MPI_Datatype sendtype, int
     int src_traced         = getPid(comm, src);
 
     // FIXME: Hack the way to trace this one
-    std::vector<int>* dst_hack = new std::vector<int>;
-    std::vector<int>* src_hack = new std::vector<int>;
+    std::vector<int>* dst_hack = new std::vector<int>();
+    std::vector<int>* src_hack = new std::vector<int>();
     dst_hack->push_back(dst_traced);
     src_hack->push_back(src_traced);
     TRACE_smpi_comm_in(my_proc_id, __func__,
index 5c9c915..06280b2 100644 (file)
@@ -21,18 +21,18 @@ class Comm : public F2C, public Keyval{
   MPI_Group group_;
   SMPI_Topo_type topoType_ = MPI_INVALID_TOPO;
   MPI_Topology topo_; // to be replaced by an union
-  int refcount_ = 1;
-  MPI_Comm leaders_comm_; // inter-node communicator
-  MPI_Comm intra_comm_;   // intra-node communicator . For MPI_COMM_WORLD this can't be used, as var is global.
-  // use an intracomm stored in the process data instead
-  int* leaders_map_     = nullptr; // who is the leader of each process
+  int refcount_          = 1;
+  MPI_Comm leaders_comm_ = MPI_COMM_NULL; // inter-node communicator
+  MPI_Comm intra_comm_   = MPI_COMM_NULL; // intra-node communicator. For MPI_COMM_WORLD this can't be used, as var is
+                                          // global. Use an intracomm stored in the process data instead
+  int* leaders_map_     = nullptr;        // who is the leader of each process
   int is_uniform_       = 1;
   int* non_uniform_map_ = nullptr; // set if smp nodes have a different number of processes allocated
   int is_blocked_       = 0;       // are ranks allocated on the same smp node contiguous ?
   int is_smp_comm_;             // set to 0 in case this is already an intra-comm or a leader-comm to avoid recursion
   std::list<MPI_Win> rma_wins_; // attached windows for synchronization.
   std::string name_;
-  MPI_Info info_;
+  MPI_Info info_ = MPI_INFO_NULL;
   int id_;
   MPI_Errhandler errhandler_ = MPI_ERRORS_ARE_FATAL;
 
index 09a821b..196ab80 100644 (file)
@@ -77,7 +77,7 @@ namespace simgrid{
 namespace smpi{
 
 class Datatype : public F2C, public Keyval{
-  char* name_;
+  char* name_ = nullptr;
   /* The id here is the (unique) datatype id used for this datastructure.
    * It's default value is set to -1 since some code expects this return value
    * when no other id has been assigned
@@ -87,7 +87,7 @@ class Datatype : public F2C, public Keyval{
   MPI_Aint lb_;
   MPI_Aint ub_;
   int flags_;
-  int refcount_;
+  int refcount_ = 1;
 
 public:
   static std::unordered_map<int, smpi_key_elem> keyvals_;
index 455973c..867800f 100644 (file)
@@ -23,7 +23,7 @@ class F2C {
     // Beware of collisions if id in mpif.h is not unique
     static std::unordered_map<std::string, F2C*>* f2c_lookup_;
     static int f2c_id_;
-    int my_f2c_id_;
+    int my_f2c_id_ = -1;
 
   protected:
     static std::unordered_map<std::string, F2C*>* f2c_lookup();
@@ -36,7 +36,6 @@ class F2C {
     static char* get_key(char* key, int id);
     static void delete_lookup();
     static std::unordered_map<std::string, F2C*>* lookup();
-    F2C() : my_f2c_id_(-1){}
     virtual ~F2C() = default;
 
     //Override these to handle specific values.
index 5486297..242c7ef 100644 (file)
@@ -23,7 +23,7 @@ class Win : public F2C, public Keyval {
   void* base_;
   MPI_Aint size_;
   int disp_unit_;
-  int assert_;
+  int assert_ = 0;
   MPI_Info info_;
   MPI_Comm comm_;
   std::vector<MPI_Request> *requests_;
index b9cee01..85267e8 100644 (file)
@@ -30,9 +30,6 @@ int Comm::keyval_id_=0;
 
 Comm::Comm(MPI_Group group, MPI_Topology topo, int smp, int in_id) : group_(group), topo_(topo),is_smp_comm_(smp), id_(in_id)
 {
-  intra_comm_      = MPI_COMM_NULL;
-  leaders_comm_    = MPI_COMM_NULL;
-  info_            = MPI_INFO_NULL;
   errhandler_->ref();
   //First creation of comm is done before SIMIX_run, so only do comms for others
   if(in_id==MPI_UNDEFINED && smp==0 && this->rank()!=MPI_UNDEFINED ){
index 3829b15..8a7773c 100644 (file)
@@ -107,14 +107,16 @@ Datatype::Datatype(int ident, int size, MPI_Aint lb, MPI_Aint ub, int flags) : D
 {
   id = std::to_string(ident);
 }
-Datatype::Datatype(int size,MPI_Aint lb, MPI_Aint ub, int flags) : name_(nullptr), size_(size), lb_(lb), ub_(ub), flags_(flags), refcount_(1){
+
+Datatype::Datatype(int size, MPI_Aint lb, MPI_Aint ub, int flags) : size_(size), lb_(lb), ub_(ub), flags_(flags)
+{
 #if SIMGRID_HAVE_MC
   if(MC_is_active())
     MC_ignore(&(refcount_), sizeof(refcount_));
 #endif
 }
 
-//for predefined types, so in_use = 0.
+// for predefined types, so refcount_ = 0.
 Datatype::Datatype(char* name, int ident, int size, MPI_Aint lb, MPI_Aint ub, int flags)
     : name_(name), id(std::to_string(ident)), size_(size), lb_(lb), ub_(ub), flags_(flags), refcount_(0)
 {
@@ -125,7 +127,8 @@ Datatype::Datatype(char* name, int ident, int size, MPI_Aint lb, MPI_Aint ub, in
 #endif
 }
 
-Datatype::Datatype(Datatype *datatype, int* ret) : name_(nullptr), size_(datatype->size_), lb_(datatype->lb_), ub_(datatype->ub_), flags_(datatype->flags_), refcount_(1)
+Datatype::Datatype(Datatype* datatype, int* ret)
+    : size_(datatype->size_), lb_(datatype->lb_), ub_(datatype->ub_), flags_(datatype->flags_)
 {
   flags_ &= ~DT_FLAG_PREDEFINED;
   *ret = MPI_SUCCESS;
index 9b1140d..dcfbdee 100644 (file)
@@ -93,11 +93,13 @@ Type_Vector::Type_Vector(int size, MPI_Aint lb, MPI_Aint ub, int flags, int coun
 
 Type_Hindexed::Type_Hindexed(int size, MPI_Aint lb, MPI_Aint ub, int flags, int count, const int* block_lengths,
                              const MPI_Aint* block_indices, MPI_Datatype old_type)
-    : Datatype(size, lb, ub, flags), block_count_(count), old_type_(old_type)
+    : Datatype(size, lb, ub, flags)
+    , block_count_(count)
+    , block_lengths_(new int[count])
+    , block_indices_(new MPI_Aint[count])
+    , old_type_(old_type)
 {
   old_type_->ref();
-  block_lengths_ = new int[count];
-  block_indices_ = new MPI_Aint[count];
   for (int i = 0; i < count; i++) {
     block_lengths_[i] = block_lengths[i];
     block_indices_[i] = block_indices[i];
@@ -106,11 +108,13 @@ Type_Hindexed::Type_Hindexed(int size, MPI_Aint lb, MPI_Aint ub, int flags, int
 
 Type_Hindexed::Type_Hindexed(int size, MPI_Aint lb, MPI_Aint ub, int flags, int count, const int* block_lengths,
                              const int* block_indices, MPI_Datatype old_type, MPI_Aint factor)
-    : Datatype(size, lb, ub, flags), block_count_(count), old_type_(old_type)
+    : Datatype(size, lb, ub, flags)
+    , block_count_(count)
+    , block_lengths_(new int[count])
+    , block_indices_(new MPI_Aint[count])
+    , old_type_(old_type)
 {
   old_type_->ref();
-  block_lengths_ = new int[count];
-  block_indices_ = new MPI_Aint[count];
   for (int i = 0; i < count; i++) {
     block_lengths_[i] = block_lengths[i];
     block_indices_[i] = block_indices[i] * factor;
@@ -177,10 +181,14 @@ Type_Indexed::Type_Indexed(int size, MPI_Aint lb, MPI_Aint ub, int flags, int co
 {
 }
 
-Type_Struct::Type_Struct(int size,MPI_Aint lb, MPI_Aint ub, int flags, int count, const int* block_lengths, const MPI_Aint* block_indices, const MPI_Datatype* old_types): Datatype(size, lb, ub, flags), block_count_(count){
-  block_lengths_= new int[count];
-  block_indices_= new MPI_Aint[count];
-  old_types_=  new MPI_Datatype[count];
+Type_Struct::Type_Struct(int size, MPI_Aint lb, MPI_Aint ub, int flags, int count, const int* block_lengths,
+                         const MPI_Aint* block_indices, const MPI_Datatype* old_types)
+    : Datatype(size, lb, ub, flags)
+    , block_count_(count)
+    , block_lengths_(new int[count])
+    , block_indices_(new MPI_Aint[count])
+    , old_types_(new MPI_Datatype[count])
+{
   for (int i = 0; i < count; i++) {
     block_lengths_[i]=block_lengths[i];
     block_indices_[i]=block_indices[i];
index 0c0cab3..bb8e9cf 100644 (file)
@@ -66,7 +66,7 @@ void F2C::free_f(int id)
 int F2C::add_f()
 {
   if (f2c_lookup_ == nullptr)
-    f2c_lookup_ = new std::unordered_map<std::string, F2C*>;
+    f2c_lookup_ = new std::unordered_map<std::string, F2C*>();
 
   char key[KEY_SIZE];
   my_f2c_id_=f2c_id_;
@@ -78,7 +78,7 @@ int F2C::add_f()
 int F2C::c2f()
 {
   if (f2c_lookup_ == nullptr) {
-    f2c_lookup_ = new std::unordered_map<std::string, F2C*>;
+    f2c_lookup_ = new std::unordered_map<std::string, F2C*>();
   }
 
   if(my_f2c_id_==-1)
@@ -91,7 +91,7 @@ int F2C::c2f()
 F2C* F2C::f2c(int id)
 {
   if (f2c_lookup_ == nullptr)
-    f2c_lookup_ = new std::unordered_map<std::string, F2C*>;
+    f2c_lookup_ = new std::unordered_map<std::string, F2C*>();
 
   if(id >= 0){
     char key[KEY_SIZE];
index c745029..19ca7be 100644 (file)
@@ -22,12 +22,20 @@ namespace smpi{
 std::unordered_map<int, smpi_key_elem> Win::keyvals_;
 int Win::keyval_id_=0;
 
-Win::Win(void *base, MPI_Aint size, int disp_unit, MPI_Info info, MPI_Comm comm, int allocated, int dynamic): base_(base), size_(size), disp_unit_(disp_unit), assert_(0), info_(info), comm_(comm), allocated_(allocated), dynamic_(dynamic){
-  int comm_size = comm->size();
-  rank_         = comm->rank();
+Win::Win(void* base, MPI_Aint size, int disp_unit, MPI_Info info, MPI_Comm comm, int allocated, int dynamic)
+    : base_(base)
+    , size_(size)
+    , disp_unit_(disp_unit)
+    , info_(info)
+    , comm_(comm)
+    , rank_(comm->rank())
+    , allocated_(allocated)
+    , dynamic_(dynamic)
+{
   XBT_DEBUG("Creating window");
   if(info!=MPI_INFO_NULL)
     info->ref();
+  int comm_size          = comm->size();
   name_                  = nullptr;
   opened_                = 0;
   group_                 = MPI_GROUP_NULL;
index b97d8fa..53da8a2 100644 (file)
@@ -222,7 +222,6 @@ CpuTiTmgr::CpuTiTmgr(kernel::profile::Profile* speed_profile, double value) : sp
 
   /* no availability file, fixed trace */
   if (not speed_profile) {
-    type_  = Type::FIXED;
     value_ = value;
     XBT_DEBUG("No availability trace. Constant value = %f", value);
     return;
@@ -230,7 +229,6 @@ CpuTiTmgr::CpuTiTmgr(kernel::profile::Profile* speed_profile, double value) : sp
 
   /* only one point available, fixed trace */
   if (speed_profile->event_list.size() == 1) {
-    type_  = Type::FIXED;
     value_ = speed_profile->event_list.front().value_;
     return;
   }
index d2cfa0e..823149a 100644 (file)
@@ -45,7 +45,7 @@ class CpuTiTmgr {
   };
 
 public:
-  explicit CpuTiTmgr(double value) : type_(Type::FIXED), value_(value){};
+  explicit CpuTiTmgr(double value) : value_(value){};
   CpuTiTmgr(profile::Profile* speed_profile, double value);
   CpuTiTmgr(const CpuTiTmgr&) = delete;
   CpuTiTmgr& operator=(const CpuTiTmgr&) = delete;
@@ -55,7 +55,7 @@ public:
   double get_power_scale(double a);
 
 private:
-  Type type_;
+  Type type_ = Type::FIXED;
   double value_;                 /*< Percentage of cpu speed available. Value fixed between 0 and 1 */
 
   /* Dynamic */
index b2eed0f..2d843a7 100644 (file)
@@ -19,13 +19,10 @@ namespace resource {
 
 class XBT_PRIVATE IBNode;
 
-class XBT_PRIVATE ActiveComm {
-public:
+struct XBT_PRIVATE ActiveComm {
   IBNode* destination   = nullptr;
   NetworkAction* action = nullptr;
   double init_rate      = -1;
-  ActiveComm()          = default;
-  virtual ~ActiveComm() = default;
 };
 
 class IBNode {
index 98b7b87..c4f452e 100644 (file)
@@ -196,7 +196,7 @@ void sg_platf_new_cluster(simgrid::kernel::routing::ClusterCreationArgs* cluster
     simgrid::kernel::routing::HostCreationArgs host;
     host.id = host_id;
     if ((cluster->properties != nullptr) && (not cluster->properties->empty())) {
-      host.properties = new std::unordered_map<std::string, std::string>;
+      host.properties = new std::unordered_map<std::string, std::string>();
 
       for (auto const& elm : *cluster->properties)
         host.properties->insert({elm.first, elm.second});
index 05ea270..134ba2d 100644 (file)
@@ -48,7 +48,7 @@ static void XBT_ATTRIB_DESTRUCTOR(800) simgrid_free_plugin_description()
 XBT_PUBLIC void simgrid_add_plugin_description(const char* name, const char* description, void_f_void_t init_fun)
 {
   if (not surf_plugin_description)
-    surf_plugin_description = new std::vector<surf_model_description_t>;
+    surf_plugin_description = new std::vector<surf_model_description_t>();
   surf_plugin_description->emplace_back(surf_model_description_t{name, description, init_fun});
 }
 
index 17f5e9c..5ed2b0a 100644 (file)
@@ -83,17 +83,16 @@ Backtrace::Backtrace()
   impl_->st = boost::stacktrace::stacktrace();
 #endif
 }
-Backtrace::Backtrace(const Backtrace& bt)
+
+Backtrace::Backtrace(const Backtrace& bt) : impl_(bt.impl_)
 {
-  impl_ = bt.impl_;
   if (impl_)
     impl_->ref();
 }
 
 Backtrace::Backtrace(Backtrace&& bt)
 {
-  impl_    = bt.impl_;
-  bt.impl_ = nullptr;
+  std::swap(impl_, bt.impl_);
 }
 
 Backtrace& Backtrace::operator=(const Backtrace& rhs)