Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'master' of framagit.org:simgrid/simgrid
authorMartin Quinson <martin.quinson@ens-rennes.fr>
Mon, 8 Mar 2021 21:38:29 +0000 (22:38 +0100)
committerMartin Quinson <martin.quinson@ens-rennes.fr>
Mon, 8 Mar 2021 21:38:29 +0000 (22:38 +0100)
71 files changed:
.gitignore
ChangeLog
MANIFEST.in
examples/cpp/CMakeLists.txt
examples/cpp/app-chainsend/s4u-app-chainsend.cpp
examples/cpp/dht-kademlia/answer.hpp
examples/cpp/exec-ptask-multicore/s4u-exec-ptask-multicore.cpp [new file with mode: 0644]
examples/cpp/exec-ptask-multicore/s4u-exec-ptask-multicore.tesh [new file with mode: 0644]
include/simgrid/kernel/future.hpp
include/simgrid/kernel/resource/Resource.hpp
include/simgrid/kernel/routing/NetPoint.hpp
include/simgrid/kernel/routing/VivaldiZone.hpp
include/simgrid/kernel/routing/WifiZone.hpp
include/simgrid/s4u/Barrier.hpp
include/simgrid/s4u/Exec.hpp
include/simgrid/s4u/Io.hpp
include/simgrid/simix.h
src/instr/instr_paje_types.hpp
src/kernel/activity/ConditionVariableImpl.hpp
src/kernel/activity/MutexImpl.cpp
src/kernel/activity/SemaphoreImpl.hpp
src/kernel/routing/NetZoneImpl.cpp
src/mc/VisitedState.hpp
src/mc/api.cpp
src/mc/checker/CommunicationDeterminismChecker.cpp
src/mc/checker/LivenessChecker.hpp
src/mc/checker/SafetyChecker.cpp
src/mc/checker/SafetyChecker.hpp
src/mc/checker/SimcallObserver.cpp
src/mc/checker/SimcallObserver.hpp
src/mc/checker/UdporChecker.hpp
src/mc/mc_base.cpp
src/mc/mc_state.cpp
src/mc/remote/RemoteSimulation.hpp
src/mc/sosp/Region.hpp
src/mc/sosp/Snapshot.hpp
src/mc/udpor_global.hpp
src/msg/msg_private.hpp
src/plugins/dirty_page_tracking.cpp
src/plugins/host_load.cpp
src/plugins/link_energy.cpp
src/plugins/link_energy_wifi.cpp
src/plugins/link_load.cpp
src/plugins/vm/VmHostExt.hpp
src/plugins/vm/VmLiveMigration.hpp
src/plugins/vm/s4u_VirtualMachine.cpp
src/s4u/s4u_Mutex.cpp
src/simix/libsmx.cpp
src/simix/popping_accessors.hpp
src/simix/popping_bodies.cpp
src/simix/popping_enum.hpp
src/simix/popping_generated.cpp
src/simix/simcalls.in
src/smpi/bindings/smpi_pmpi_type.cpp
src/smpi/include/smpi_host.hpp
src/smpi/include/smpi_info.hpp
src/surf/cpu_cas01.cpp
src/surf/cpu_cas01.hpp
src/surf/cpu_interface.cpp
src/surf/cpu_interface.hpp
src/surf/cpu_ti.cpp
src/surf/cpu_ti.hpp
src/surf/network_cm02.hpp
src/surf/network_ib.hpp
src/surf/network_interface.hpp
src/surf/network_ns3.hpp
src/surf/network_smpi.hpp
src/surf/ptask_L07.cpp
src/surf/ptask_L07.hpp
src/xbt/config.cpp
teshsuite/mc/random-bug/random-bug.cpp

index b46ee9c..ac8438a 100644 (file)
@@ -195,6 +195,7 @@ examples/cpp/exec-basic/s4u-exec-basic
 examples/cpp/exec-dependent/s4u-exec-dependent
 examples/cpp/exec-dvfs/s4u-exec-dvfs
 examples/cpp/exec-ptask/s4u-exec-ptask
+examples/cpp/exec-ptask-multicore/s4u-exec-ptask-multicore
 examples/cpp/exec-remote/s4u-exec-remote
 examples/cpp/exec-unassigned/s4u-exec-unassigned
 examples/cpp/exec-waitany/s4u-exec-waitany
index 782c65f..3e1a6ae 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -29,6 +29,10 @@ Documentation:
  - New section: Configuring the logs from the command line.
  - New section: Programming API of logs.
 
+Fixed bugs (FG#.. -> FramaGit bugs; FG!.. -> FG merge requests)
+ (FG: issues on Framagit; GF: issues on GForge; GH: issues on GitHub)
+- FG#37: Parallel tasks are limited to 1 core per host
+
 ----------------------------------------------------------------------------
 
 SimGrid (3.26) December 15. 2020
index b8f9628..c4d738f 100644 (file)
@@ -237,6 +237,8 @@ include examples/cpp/exec-dependent/s4u-exec-dependent.cpp
 include examples/cpp/exec-dependent/s4u-exec-dependent.tesh
 include examples/cpp/exec-dvfs/s4u-exec-dvfs.cpp
 include examples/cpp/exec-dvfs/s4u-exec-dvfs.tesh
+include examples/cpp/exec-ptask-multicore/s4u-exec-ptask-multicore.cpp
+include examples/cpp/exec-ptask-multicore/s4u-exec-ptask-multicore.tesh
 include examples/cpp/exec-ptask/s4u-exec-ptask.cpp
 include examples/cpp/exec-ptask/s4u-exec-ptask.tesh
 include examples/cpp/exec-remote/s4u-exec-remote.cpp
index 393f3f8..15af769 100644 (file)
@@ -68,10 +68,11 @@ foreach (example actor-create actor-daemon actor-exiting actor-join actor-kill
                  dht-chord dht-kademlia
                  energy-exec energy-boot energy-link energy-vm energy-exec-ptask energy-wifi
                  engine-filtering
-                 exec-async exec-basic exec-dvfs exec-ptask exec-remote exec-waitany exec-waitfor exec-dependent exec-unassigned
+                 exec-async exec-basic exec-dvfs exec-remote exec-waitany exec-waitfor exec-dependent exec-unassigned
+                 exec-ptask exec-ptask-multicore
                  maestro-set
                  mc-bugged1 mc-bugged2 mc-electric-fence mc-failing-assert
-                network-wifi
+                                network-wifi
                  io-async io-file-system io-file-remote io-disk-raw io-dependent
                  platform-failures platform-profile platform-properties
                  plugin-host-load plugin-link-load
index 040dcb0..2a38069 100644 (file)
@@ -21,13 +21,11 @@ public:
       : prev_(prev), next_(next), num_pieces(num_pieces)
   {
   }
-  ~ChainMessage() = default;
 };
 
 class FilePiece {
 public:
   FilePiece()  = default;
-  ~FilePiece() = default;
 };
 
 class Peer {
@@ -43,7 +41,6 @@ public:
   unsigned int total_pieces         = 0;
 
   Peer() { me = simgrid::s4u::Mailbox::by_name(simgrid::s4u::Host::current()->get_cname()); }
-  ~Peer()     = default;
 
   void joinChain()
   {
@@ -130,8 +127,6 @@ public:
       mailboxes.push_back(simgrid::s4u::Mailbox::by_name(name));
     }
   }
-
-  ~Broadcaster() = default;
 };
 
 static void peer()
index 6595284..7228312 100644 (file)
@@ -19,7 +19,6 @@ class Answer {
 
 public:
   explicit Answer(unsigned int destination_id) : destination_id_(destination_id) {}
-  virtual ~Answer() = default;
   unsigned int getDestinationId() const { return destination_id_; }
   size_t getSize() const { return nodes_.size(); }
   const std::vector<std::pair<unsigned int, unsigned int>>& getNodes() const { return nodes_; }
diff --git a/examples/cpp/exec-ptask-multicore/s4u-exec-ptask-multicore.cpp b/examples/cpp/exec-ptask-multicore/s4u-exec-ptask-multicore.cpp
new file mode 100644 (file)
index 0000000..1062709
--- /dev/null
@@ -0,0 +1,56 @@
+/* Copyright (c) 2017-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/s4u.hpp>
+
+XBT_LOG_NEW_DEFAULT_CATEGORY(s4u_ptask_multicore, "Messages specific for this s4u example");
+
+namespace sg4 = simgrid::s4u;
+
+static void runner()
+{
+  auto e = sg4::Engine::get_instance();
+  std::vector<double> comp(2, 1e9);
+  std::vector<double> comm(4, 0.0);
+  // Different hosts.
+  std::vector<sg4::Host*> hosts_diff = {e->host_by_name("MyHost2"), e->host_by_name("MyHost3")};
+  double start_time                  = e->get_clock();
+  sg4::this_actor::parallel_execute(hosts_diff, comp, comm);
+  XBT_INFO("Computed 2-core activity on two different hosts. Took %g s", e->get_clock() - start_time);
+
+  // Same host, monocore.
+  std::vector<sg4::Host*> monocore_hosts = {e->host_by_name("MyHost2"), e->host_by_name("MyHost2")};
+  start_time                             = e->get_clock();
+  sg4::this_actor::parallel_execute(monocore_hosts, comp, comm);
+  XBT_INFO("Computed 2-core activity one 1-core host. Took %g s", e->get_clock() - start_time);
+
+  // Same host, multicore.
+  std::vector<sg4::Host*> multicore_host = {e->host_by_name("MyHost1"), e->host_by_name("MyHost1")};
+  start_time                             = e->get_clock();
+  sg4::this_actor::parallel_execute(multicore_host, comp, comm);
+  XBT_INFO("Computed 2-core activity on one 2-core host. Took %g s", e->get_clock() - start_time);
+
+  // Same host, using too many cores
+  std::vector<double> comp6(6, 1e9);
+  std::vector<double> comm6(36, 0.0);
+  std::vector<sg4::Host*> multicore_overload(6, e->host_by_name("MyHost1"));
+  start_time = e->get_clock();
+  sg4::this_actor::parallel_execute(multicore_overload, comp6, comm6);
+  XBT_INFO("Computed 6-core activity of a 4-core host. Took %g s", e->get_clock() - start_time);
+}
+
+int main(int argc, char* argv[])
+{
+  sg4::Engine e(&argc, argv);
+
+  xbt_assert(argc == 2, "Usage: %s <platform file>", argv[0]);
+
+  e.load_platform(argv[1]);
+  sg4::Actor::create("test", sg4::Host::by_name("MyHost1"), runner);
+
+  e.run();
+  XBT_INFO("Simulation done.");
+  return 0;
+}
diff --git a/examples/cpp/exec-ptask-multicore/s4u-exec-ptask-multicore.tesh b/examples/cpp/exec-ptask-multicore/s4u-exec-ptask-multicore.tesh
new file mode 100644 (file)
index 0000000..2dadba2
--- /dev/null
@@ -0,0 +1,10 @@
+#!/usr/bin/env tesh
+
+$ ${bindir:=.}/s4u-exec-ptask-multicore ${platfdir}/energy_platform.xml --cfg=host/model:ptask_L07 --log=no_loc "--log=root.fmt:[%10.6r]%e%m%n"
+> [  0.000000] Configuration change: Set 'host/model' to 'ptask_L07'
+> [  0.000000] Switching to the L07 model to handle parallel tasks.
+> [ 10.000000] Computed 2-core activity on two different hosts. Took 10 s
+> [ 30.000000] Computed 2-core activity one 1-core host. Took 20 s
+> [ 40.000000] Computed 2-core activity on one 2-core host. Took 10 s
+> [ 55.000000] Computed 6-core activity of a 4-core host. Took 15 s
+> [ 55.000000] Simulation done.
\ No newline at end of file
index ec2c7a4..897e4c2 100644 (file)
@@ -279,7 +279,6 @@ class Future {
 public:
   Future() = default;
   explicit Future(std::shared_ptr<FutureState<T>> state) : state_(std::move(state)) {}
-  ~Future() = default;
 
   // Move type:
   Future(Future&) = delete;
index 9be92f6..c377153 100644 (file)
@@ -36,7 +36,7 @@ protected:
   profile::Event* state_event_ = nullptr;
 
 public:
-  Resource(const std::string& name) : name_(name){};
+  explicit Resource(const std::string& name) : name_(name){};
   virtual ~Resource() = default;
   virtual void seal() { sealed_ = true; }
 
index fd1bcb2..e6cc4b3 100644 (file)
@@ -29,7 +29,6 @@ public:
   enum class Type { Host, Router, NetZone };
 
   NetPoint(const std::string& name, NetPoint::Type component_type, NetZoneImpl* netzone_p);
-  ~NetPoint() = default;
 
   // Our rank in the vertices_ array of the netzone that contains us.
   unsigned int id() const { return id_; }
index 2f05dfb..943c27e 100644 (file)
@@ -57,7 +57,6 @@ class XBT_PRIVATE Coords {
 public:
   static xbt::Extension<NetPoint, Coords> EXTENSION_ID;
   explicit Coords(NetPoint* host, const std::string& str);
-  virtual ~Coords() = default;
 
   std::vector<double> coords;
 };
index 23728e8..15cc9b0 100644 (file)
@@ -23,7 +23,6 @@ public:
   explicit WifiZone(NetZoneImpl* father, const std::string& name, resource::NetworkModel* netmodel);
   WifiZone(const WifiZone&) = delete;
   WifiZone& operator=(const WifiZone) = delete;
-  ~WifiZone() override                = default;
 
   void seal() override;
   void get_local_route(NetPoint* src, NetPoint* dst, RouteCreationArgs* into, double* latency) override;
index a1f5770..f5d3fa5 100644 (file)
@@ -32,7 +32,6 @@ public:
   /** Creates a barrier for the given amount of actors */
   explicit Barrier(unsigned int expected_actors) : expected_actors_(expected_actors) {}
 #ifndef DOXYGEN
-  ~Barrier()              = default;
   Barrier(Barrier const&) = delete;
   Barrier& operator=(Barrier const&) = delete;
 #endif
index 566d601..0ae3e32 100644 (file)
@@ -45,11 +45,9 @@ protected:
   explicit Exec(kernel::activity::ExecImplPtr pimpl);
 
 public:
-  ~Exec() override = default;
 #ifndef DOXYGEN
   Exec(Exec const&) = delete;
   Exec& operator=(Exec const&) = delete;
-
 #endif
   static xbt::signal<void(Exec const&)> on_start;
   static xbt::signal<void(Exec const&)> on_completion;
index 832631d..a4423ba 100644 (file)
@@ -33,8 +33,6 @@ private:
 public:
 #ifndef DOXYGEN
   friend Disk;    // Factory of IOs
-
-  ~Io() override = default;
 #endif
 
   static xbt::signal<void(Io const&)> on_start;
index 2c80e72..f01edbf 100644 (file)
@@ -200,8 +200,8 @@ XBT_ATTRIB_DEPRECATED_v330("Please use an ActivityImpl* for first parameter") in
 SG_BEGIN_DECL
 XBT_ATTRIB_DEPRECATED_v330("Please use sg_mutex_init()") XBT_PUBLIC smx_mutex_t simcall_mutex_init();
 XBT_PUBLIC void simcall_mutex_lock(smx_mutex_t mutex);
-XBT_PUBLIC int simcall_mutex_trylock(smx_mutex_t mutex);
-XBT_ATTRIB_DEPRECATED_v331("Please use s4u::Mutex::unlock()") XBT_PUBLIC void simcall_mutex_unlock(smx_mutex_t mutex);
+XBT_ATTRIB_DEPRECATED_v331("Please use sg_mutex_try_lock()") XBT_PUBLIC int simcall_mutex_trylock(smx_mutex_t mutex);
+XBT_ATTRIB_DEPRECATED_v331("Please use sg_mutex_unlock()") XBT_PUBLIC void simcall_mutex_unlock(smx_mutex_t mutex);
 
 XBT_ATTRIB_DEPRECATED_v330("Please use sg_cond_init()") XBT_PUBLIC smx_cond_t simcall_cond_init();
 XBT_PUBLIC void simcall_cond_wait(smx_cond_t cond, smx_mutex_t mutex);
@@ -224,7 +224,7 @@ XBT_ATTRIB_DEPRECATED_v330("Please use s4u::Io::test()") XBT_PUBLIC
 #endif
 /************************** MC simcalls   **********************************/
 SG_BEGIN_DECL
-XBT_ATTRIB_DEPRECATED_v331("Please use MC_random") XBT_PUBLIC int simcall_mc_random(int min, int max);
+XBT_ATTRIB_DEPRECATED_v331("Please use MC_random()") XBT_PUBLIC int simcall_mc_random(int min, int max);
 SG_END_DECL
 
 #endif
index 77632c1..e932eb9 100644 (file)
@@ -88,7 +88,6 @@ public:
       : Type(event_type, name, alias, "", father){};
   ValueType(PajeEventType event_type, const std::string& name, Type* father)
       : Type(event_type, name, name, "", father){};
-  ~ValueType() override = default;
   void add_entity_value(const std::string& name, const std::string& color);
   void add_entity_value(const std::string& name);
   EntityValue* get_entity_value(const std::string& name);
index a6a7ea8..f80f4e7 100644 (file)
@@ -25,7 +25,6 @@ class XBT_PUBLIC ConditionVariableImpl {
 
 public:
   ConditionVariableImpl() : piface_(this){};
-  ~ConditionVariableImpl() = default;
 
   void remove_sleeping_actor(actor::ActorImpl& actor) { xbt::intrusive_erase(sleeping_, actor); }
   const s4u::ConditionVariable* get_iface() const { return &piface_; }
index a3578b9..5569f8a 100644 (file)
@@ -103,8 +103,3 @@ void simcall_HANDLER_mutex_lock(smx_simcall_t simcall, smx_mutex_t mutex)
 {
   mutex->lock(simcall->issuer_);
 }
-
-int simcall_HANDLER_mutex_trylock(smx_simcall_t simcall, smx_mutex_t mutex)
-{
-  return mutex->try_lock(simcall->issuer_);
-}
index f2d05b7..3be684e 100644 (file)
@@ -23,7 +23,6 @@ class XBT_PUBLIC SemaphoreImpl {
 
 public:
   explicit SemaphoreImpl(unsigned int value) : value_(value){};
-  ~SemaphoreImpl() = default;
 
   SemaphoreImpl(SemaphoreImpl const&) = delete;
   SemaphoreImpl& operator=(SemaphoreImpl const&) = delete;
index deddfa2..9c6f3c0 100644 (file)
@@ -82,7 +82,7 @@ s4u::Host* NetZoneImpl::create_host(const std::string& name, const std::vector<d
   auto* res = new s4u::Host(name);
   res->set_netpoint(new NetPoint(name, NetPoint::Type::Host, this));
 
-  surf_cpu_model_pm->create_cpu(res, speed_per_pstate, core_amount);
+  surf_cpu_model_pm->create_cpu(res, speed_per_pstate)->set_core_count(core_amount)->seal();
 
   return res;
 }
index 5d0c309..9b78c6a 100644 (file)
@@ -24,7 +24,6 @@ public:
   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;
 };
 
 class XBT_PRIVATE VisitedStates {
index 4bc2330..cee3dcc 100644 (file)
@@ -93,7 +93,7 @@ static inline smx_simcall_t MC_state_choose_request_for_process(simgrid::mc::Sta
           req = &actor->simcall_;
         break;
 
-      case Simcall::COMM_TESTANY: {
+      case Simcall::COMM_TESTANY:
         state->transition_.times_considered_ = -1;
         while (procstate->times_considered < simcall_comm_testany__get__count(&actor->simcall_)) {
           if (simgrid::mc::request_is_enabled_by_idx(&actor->simcall_, procstate->times_considered)) {
@@ -109,7 +109,6 @@ static inline smx_simcall_t MC_state_choose_request_for_process(simgrid::mc::Sta
         if (state->transition_.times_considered_ != -1)
           req = &actor->simcall_;
         break;
-      }
 
       case Simcall::COMM_WAIT: {
         simgrid::mc::RemotePtr<simgrid::kernel::activity::CommImpl> remote_act =
@@ -358,10 +357,13 @@ bool Api::actor_is_enabled(aid_t pid) const
 
 unsigned long Api::get_maxpid() const
 {
+  static const char* name = nullptr;
+  if (not name) {
+    name = "simgrid::kernel::actor::maxpid";
+    if (mc_model_checker->get_remote_simulation().find_variable(name) == nullptr)
+      name = "maxpid"; // We seem to miss the namespaces when compiling with GCC
+  }
   unsigned long maxpid;
-  const char* name = "simgrid::kernel::actor::maxpid";
-  if (mc_model_checker->get_remote_simulation().find_variable(name) == nullptr)
-    name = "maxpid"; // We seem to miss the namespaces when compiling with GCC
   mc_model_checker->get_remote_simulation().read_variable(name, &maxpid, sizeof(maxpid));
   return maxpid;
 }
@@ -799,18 +801,11 @@ std::string Api::request_to_string(smx_simcall_t req, int value) const
       }
       break;
 
-    case Simcall::MUTEX_TRYLOCK:
     case Simcall::MUTEX_LOCK: {
-      if (req->call_ == Simcall::MUTEX_LOCK)
-        type = "Mutex LOCK";
-      else
-        type = "Mutex TRYLOCK";
-
+      type = "Mutex LOCK";
       simgrid::mc::Remote<simgrid::kernel::activity::MutexImpl> mutex;
       mc_model_checker->get_remote_simulation().read_bytes(mutex.get_buffer(), sizeof(mutex),
-                                                           remote(req->call_ == Simcall::MUTEX_LOCK
-                                                                      ? simcall_mutex_lock__get__mutex(req)
-                                                                      : simcall_mutex_trylock__get__mutex(req)));
+                                                           remote(simcall_mutex_lock__get__mutex(req)));
       args = "locked = " + std::to_string(mutex.get_buffer()->is_locked()) + ", owner = ";
       if (mutex.get_buffer()->get_owner() != nullptr)
         args += std::to_string(mc_model_checker->get_remote_simulation()
@@ -898,10 +893,6 @@ std::string Api::request_get_dot_output(smx_simcall_t req, int value) const
         }
         break;
 
-      case Simcall::MUTEX_TRYLOCK:
-        label = "[" + get_actor_dot_label(issuer) + "] Mutex TRYLOCK";
-        break;
-
       case Simcall::MUTEX_LOCK:
         label = "[" + get_actor_dot_label(issuer) + "] Mutex LOCK";
         break;
index d54bfb6..4c131c9 100644 (file)
@@ -59,7 +59,8 @@ static void restore_communications_pattern(simgrid::mc::State* state)
   for (size_t i = 0; i < initial_communications_pattern.size(); i++)
     initial_communications_pattern[i].index_comm = state->communication_indices_[i];
 
-  for (unsigned long i = 0; i < api::get().get_maxpid(); i++)
+  const unsigned long maxpid = api::get().get_maxpid();
+  for (unsigned long i = 0; i < maxpid; i++)
     patterns_copy(incomplete_communications_pattern[i], state->incomplete_comm_pattern_[i]);
 }
 
@@ -302,7 +303,7 @@ void CommunicationDeterminismChecker::log_state() // override
 
 void CommunicationDeterminismChecker::prepare()
 {
-  const auto maxpid = api::get().get_maxpid();
+  const unsigned long maxpid = api::get().get_maxpid();
 
   initial_communications_pattern.resize(maxpid);
   incomplete_communications_pattern.resize(maxpid);
@@ -323,7 +324,7 @@ void CommunicationDeterminismChecker::prepare()
 
 static inline bool all_communications_are_finished()
 {
-  auto maxpid = api::get().get_maxpid();
+  const unsigned long maxpid = api::get().get_maxpid();
   for (size_t current_actor = 1; current_actor < maxpid; current_actor++) {
     if (not incomplete_communications_pattern[current_actor].empty()) {
       XBT_DEBUG("Some communications are not finished, cannot stop the exploration! State not visited.");
@@ -346,10 +347,10 @@ void CommunicationDeterminismChecker::restoreState()
   /* Restore the initial state */
   api::get().restore_initial_state();
 
-  unsigned long n = api::get().get_maxpid();
-  assert(n == incomplete_communications_pattern.size());
-  assert(n == initial_communications_pattern.size());
-  for (unsigned long j = 0; j < n; j++) {
+  const unsigned long maxpid = api::get().get_maxpid();
+  assert(maxpid == incomplete_communications_pattern.size());
+  assert(maxpid == initial_communications_pattern.size());
+  for (unsigned long j = 0; j < maxpid; j++) {
     incomplete_communications_pattern[j].clear();
     initial_communications_pattern[j].index_comm = 0;
   }
index cd73ea9..39f899f 100644 (file)
@@ -30,7 +30,6 @@ public:
   bool exploration_started = false;
 
   explicit Pair(unsigned long expanded_pairs);
-  ~Pair() = default;
 
   Pair(Pair const&) = delete;
   Pair& operator=(Pair const&) = delete;
@@ -48,13 +47,11 @@ public:
 
   VisitedPair(int pair_num, xbt_automaton_state_t automaton_state,
               std::shared_ptr<const std::vector<int>> atomic_propositions, std::shared_ptr<State> graph_state);
-  ~VisitedPair() = default;
 };
 
 class XBT_PRIVATE LivenessChecker : public Checker {
 public:
   explicit LivenessChecker();
-  ~LivenessChecker() override = default;
   void run() override;
   RecordTrace get_record_trace() override;
   std::vector<std::string> get_textual_trace() override;
index 0feca33..4198071 100644 (file)
@@ -187,7 +187,7 @@ void SafetyChecker::backtrack()
     if (reductionMode_ == ReductionMode::dpor) {
       auto call = state->executed_req_.call_;
       const kernel::actor::ActorImpl* issuer = api::get().simcall_get_issuer(&state->executed_req_);
-      if (call == simix::Simcall::MUTEX_LOCK || call == simix::Simcall::MUTEX_TRYLOCK)
+      if (call == simix::Simcall::MUTEX_LOCK)
         xbt_die("Mutex is currently not supported with DPOR,  use --cfg=model-check/reduction:none");
 
       for (auto i = stack_.rbegin(); i != stack_.rend(); ++i) {
index 0d08f13..a16070e 100644 (file)
@@ -24,7 +24,6 @@ class XBT_PRIVATE SafetyChecker : public Checker {
 
 public:
   explicit SafetyChecker();
-  ~SafetyChecker() override = default;
   void run() override;
   RecordTrace get_record_trace() override;
   std::vector<std::string> get_textual_trace() override;
index 78a62d9..9c601be 100644 (file)
@@ -5,6 +5,7 @@
 
 #include "src/mc/checker/SimcallObserver.hpp"
 #include "simgrid/s4u/Host.hpp"
+#include "src/kernel/activity/MutexImpl.hpp"
 #include "src/kernel/actor/ActorImpl.hpp"
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_observer, mc, "Logging specific to MC simcall observation");
@@ -56,5 +57,19 @@ std::string MutexUnlockSimcall::dot_label() const
   return SimcallObserver::dot_label() + "Mutex UNLOCK";
 }
 
+std::string MutexTrylockSimcall::to_string(int time_considered) const
+{
+  std::string res = SimcallObserver::to_string(time_considered) + "Mutex TRYLOCK";
+  res += "(locked = " + std::to_string(mutex_->is_locked());
+  res += ", owner = " + std::to_string(mutex_->get_owner() ? mutex_->get_owner()->get_pid() : -1);
+  res += ", sleeping = n/a)";
+  return res;
+}
+
+std::string MutexTrylockSimcall::dot_label() const
+{
+  return SimcallObserver::dot_label() + "Mutex TRYLOCK";
+}
+
 } // namespace mc
 } // namespace simgrid
index 0c6abc7..6499887 100644 (file)
@@ -73,6 +73,16 @@ public:
   std::string to_string(int times_considered) const override;
   std::string dot_label() const override;
 };
+
+class MutexTrylockSimcall : public SimcallObserver {
+  kernel::activity::MutexImpl* mutex_;
+
+public:
+  MutexTrylockSimcall(smx_actor_t actor, kernel::activity::MutexImpl* mutex) : SimcallObserver(actor), mutex_(mutex) {}
+  std::string to_string(int times_considered) const override;
+  std::string dot_label() const override;
+  kernel::activity::MutexImpl* get_mutex() const { return mutex_; }
+};
 } // namespace mc
 } // namespace simgrid
 
index d6541c1..57dbe95 100644 (file)
@@ -16,7 +16,6 @@ namespace mc {
 class XBT_PRIVATE UdporChecker : public Checker {
 public:
   explicit UdporChecker();
-  ~UdporChecker() override = default;
   void run() override;
   RecordTrace get_record_trace() override;
   std::vector<std::string> get_textual_trace() override;
index 344752b..f6f98ce 100644 (file)
@@ -169,8 +169,7 @@ bool request_is_visible(const s_smx_simcall* req)
   using simix::Simcall;
   return req->call_ == Simcall::COMM_ISEND || req->call_ == Simcall::COMM_IRECV || req->call_ == Simcall::COMM_WAIT ||
          req->call_ == Simcall::COMM_WAITANY || req->call_ == Simcall::COMM_TEST ||
-         req->call_ == Simcall::COMM_TESTANY || req->call_ == Simcall::MUTEX_LOCK ||
-         req->call_ == Simcall::MUTEX_TRYLOCK;
+         req->call_ == Simcall::COMM_TESTANY || req->call_ == Simcall::MUTEX_LOCK;
 }
 
 }
index 5ffc15c..dfa57a4 100644 (file)
@@ -17,7 +17,7 @@ namespace mc {
 
 State::State(unsigned long state_number) : num_(state_number)
 {
-  auto maxpid = api::get().get_maxpid();
+  const unsigned long maxpid = api::get().get_maxpid();
   actor_states_.resize(maxpid);
   /* Stateful model checking */
   if ((_sg_mc_checkpoint > 0 && (state_number % _sg_mc_checkpoint == 0)) || _sg_mc_termination) {
@@ -43,7 +43,8 @@ Transition State::get_transition() const
 void State::copy_incomplete_comm_pattern()
 {
   incomplete_comm_pattern_.clear();
-  for (unsigned long i = 0; i < api::get().get_maxpid(); i++) {
+  const unsigned long maxpid = api::get().get_maxpid();
+  for (unsigned long i = 0; i < maxpid; i++) {
     std::vector<simgrid::mc::PatternCommunication> res;
     for (auto const& comm : incomplete_communications_pattern[i])
       res.push_back(comm->dup());
index 13a72c7..fc50761 100644 (file)
@@ -25,7 +25,7 @@ public:
   RemotePtr<kernel::actor::ActorImpl> address{nullptr};
   Remote<kernel::actor::ActorImpl> copy;
 
-  /** Hostname (owned by `mc_modelchecker->hostnames`) */
+  /** Hostname (owned by `mc_model_checker->hostnames_`) */
   const xbt::string* hostname = nullptr;
   std::string name;
 
index 192a093..7c5fe19 100644 (file)
@@ -37,7 +37,6 @@ private:
 
 public:
   Region(RegionType type, void* start_addr, size_t size);
-  ~Region()             = default;
   Region(Region const&) = delete;
   Region& operator=(Region const&) = delete;
   Region(Region&& that)            = delete;
index 35865cd..fbcf185 100644 (file)
@@ -61,7 +61,6 @@ class XBT_PRIVATE Snapshot final : public AddressSpace {
 public:
   /* Initialization */
   Snapshot(int num_state, RemoteSimulation* get_remote_simulation = &mc_model_checker->get_remote_simulation());
-  ~Snapshot() override = default;
 
   /* Regular use */
   bool on_heap(const void* address) const
index e49fcf0..2c8b7a1 100644 (file)
@@ -54,7 +54,6 @@ public:
   Configuration(const Configuration&) = default;
   Configuration& operator=(Configuration const&) = default;
   Configuration(Configuration&&)                 = default;
-  ~Configuration()                               = default;
 };
 
 class UnfoldingEvent {
@@ -65,7 +64,6 @@ public:
   UnfoldingEvent(const UnfoldingEvent&) = default;
   UnfoldingEvent& operator=(UnfoldingEvent const&) = default;
   UnfoldingEvent(UnfoldingEvent&&)                 = default;
-  ~UnfoldingEvent()                                = default;
 
   EventSet getHistory() const;
 
index d87469c..25da958 100644 (file)
@@ -49,7 +49,6 @@ public:
 
   Task(const Task&) = delete;
   Task& operator=(const Task&) = delete;
-  ~Task()                      = default;
 
   bool is_used() const { return is_used_; }
   bool is_parallel() const { return parallel_; }
index fb6ca07..a4b5fcb 100644 (file)
@@ -38,7 +38,6 @@ public:
   double get_max_downtime() const { return max_downtime_; }
 
   static simgrid::xbt::Extension<VirtualMachineImpl, DirtyPageTrackingExt> EXTENSION_ID;
-  virtual ~DirtyPageTrackingExt() = default;
   DirtyPageTrackingExt()          = default;
 };
 
index a9a5836..477e8e2 100644 (file)
@@ -63,7 +63,6 @@ public:
       , current_flops_(host_->get_load())
   {
   }
-  ~HostLoad() = default;
   HostLoad() = delete;
   explicit HostLoad(simgrid::s4u::Host& ptr) = delete;
   explicit HostLoad(simgrid::s4u::Host&& ptr) = delete;
index efea153..e0a6006 100644 (file)
@@ -50,7 +50,6 @@ public:
   static simgrid::xbt::Extension<simgrid::s4u::Link, LinkEnergy> EXTENSION_ID;
 
   explicit LinkEnergy(simgrid::s4u::Link* ptr) : link_(ptr), last_updated_(surf_get_clock()) {}
-  ~LinkEnergy() = default;
 
   void init_watts_range_list();
   double get_consumed_energy();
index 2dc82a0..c2ff738 100644 (file)
@@ -35,8 +35,6 @@ public:
   static simgrid::xbt::Extension<simgrid::s4u::Link, LinkEnergyWifi> EXTENSION_ID;
 
   explicit LinkEnergyWifi(simgrid::s4u::Link* ptr) : link_(ptr) {}
-
-  ~LinkEnergyWifi() = default;
   LinkEnergyWifi()  = delete;
 
   /**
index 2794b47..edadcbc 100644 (file)
@@ -43,7 +43,6 @@ public:
   static simgrid::xbt::Extension<simgrid::s4u::Link, LinkLoad> EXTENSION_ID;
 
   explicit LinkLoad(simgrid::s4u::Link* ptr);
-  ~LinkLoad() = default;
 
   void track();
   void untrack();
index 29c13b5..ec89754 100644 (file)
@@ -14,7 +14,6 @@ namespace vm {
 class VmHostExt {
 public:
   static simgrid::xbt::Extension<simgrid::s4u::Host, VmHostExt> EXTENSION_ID;
-  virtual ~VmHostExt() = default;
 
   sg_size_t ramsize = 0;    /* available ramsize (0= not taken into account) */
   bool overcommit   = true; /* Whether the host allows overcommiting more VM than the avail ramsize allows */
index 269c185..d0893c0 100644 (file)
@@ -19,7 +19,6 @@ public:
   s4u::ActorPtr tx_     = nullptr;
   s4u::ActorPtr rx_     = nullptr;
   static simgrid::xbt::Extension<simgrid::s4u::Host, VmMigrationExt> EXTENSION_ID;
-  virtual ~VmMigrationExt() = default;
   explicit VmMigrationExt(s4u::ActorPtr issuer, s4u::ActorPtr rx, s4u::ActorPtr tx) : issuer_(issuer), tx_(tx), rx_(rx)
   {
   }
index 8ddf31b..c8046e0 100644 (file)
@@ -41,7 +41,7 @@ VirtualMachine::VirtualMachine(const std::string& name, s4u::Host* physical_host
   for (int i = 0; i < physical_host->get_pstate_count(); i++)
     speeds.push_back(physical_host->get_pstate_speed(i));
 
-  surf_cpu_model_vm->create_cpu(this, speeds, core_amount);
+  surf_cpu_model_vm->create_cpu(this, speeds)->set_core_count(core_amount)->seal();
   if (physical_host->get_pstate() != 0)
     set_pstate(physical_host->get_pstate());
 
index d6a65f6..38b57a6 100644 (file)
@@ -38,7 +38,10 @@ void Mutex::unlock()
 /** @brief Acquire the mutex if it's free, and return false (without blocking) if not */
 bool Mutex::try_lock()
 {
-  return simcall_mutex_trylock(pimpl_);
+  kernel::actor::ActorImpl* issuer = kernel::actor::ActorImpl::self();
+  mc::MutexTrylockSimcall observer{issuer, pimpl_};
+  return kernel::actor::simcall([&observer] { return observer.get_mutex()->try_lock(observer.get_issuer()); },
+                                &observer);
 }
 
 /** @brief Create a new mutex
index c061cdd..0187a48 100644 (file)
@@ -264,9 +264,9 @@ void simcall_mutex_lock(smx_mutex_t mutex)
  * @ingroup simix_synchro_management
  *
  */
-int simcall_mutex_trylock(smx_mutex_t mutex)
+int simcall_mutex_trylock(smx_mutex_t mutex) // XBT_ATTRIB_DEPRECATD_v331
 {
-  return simcall_BODY_mutex_trylock(mutex);
+  return mutex->mutex().try_lock();
 }
 
 /**
index 2d0d22a..edbfb20 100644 (file)
@@ -697,31 +697,6 @@ static inline void simcall_mutex_lock__set__mutex(smx_simcall_t simcall, smx_mut
   simgrid::simix::marshal<smx_mutex_t>(simcall->args_[0], arg);
 }
 
-static inline smx_mutex_t simcall_mutex_trylock__get__mutex(smx_simcall_t simcall)
-{
-  return simgrid::simix::unmarshal<smx_mutex_t>(simcall->args_[0]);
-}
-static inline smx_mutex_t simcall_mutex_trylock__getraw__mutex(smx_simcall_t simcall)
-{
-  return simgrid::simix::unmarshal_raw<smx_mutex_t>(simcall->args_[0]);
-}
-static inline void simcall_mutex_trylock__set__mutex(smx_simcall_t simcall, smx_mutex_t arg)
-{
-  simgrid::simix::marshal<smx_mutex_t>(simcall->args_[0], arg);
-}
-static inline int simcall_mutex_trylock__get__result(smx_simcall_t simcall)
-{
-  return simgrid::simix::unmarshal<int>(simcall->result_);
-}
-static inline int simcall_mutex_trylock__getraw__result(smx_simcall_t simcall)
-{
-  return simgrid::simix::unmarshal_raw<int>(simcall->result_);
-}
-static inline void simcall_mutex_trylock__set__result(smx_simcall_t simcall, int result)
-{
-  simgrid::simix::marshal<int>(simcall->result_, result);
-}
-
 static inline smx_cond_t simcall_cond_wait__get__cond(smx_simcall_t simcall)
 {
   return simgrid::simix::unmarshal<smx_cond_t>(simcall->args_[0]);
@@ -884,7 +859,6 @@ XBT_PRIVATE void simcall_HANDLER_comm_wait(smx_simcall_t simcall, simgrid::kerne
 XBT_PRIVATE void simcall_HANDLER_comm_test(smx_simcall_t simcall, simgrid::kernel::activity::CommImpl* comm);
 XBT_PRIVATE void simcall_HANDLER_comm_testany(smx_simcall_t simcall, simgrid::kernel::activity::CommImpl** comms, size_t count);
 XBT_PRIVATE void simcall_HANDLER_mutex_lock(smx_simcall_t simcall, smx_mutex_t mutex);
-XBT_PRIVATE int simcall_HANDLER_mutex_trylock(smx_simcall_t simcall, smx_mutex_t mutex);
 XBT_PRIVATE void simcall_HANDLER_cond_wait(smx_simcall_t simcall, smx_cond_t cond, smx_mutex_t mutex);
 XBT_PRIVATE void simcall_HANDLER_cond_wait_timeout(smx_simcall_t simcall, smx_cond_t cond, smx_mutex_t mutex, double timeout);
 XBT_PRIVATE void simcall_HANDLER_sem_acquire(smx_simcall_t simcall, smx_sem_t sem);
index cc9f47e..ecd7537 100644 (file)
@@ -111,13 +111,6 @@ inline static void simcall_BODY_mutex_lock(smx_mutex_t mutex)
   return simcall<void, smx_mutex_t>(Simcall::MUTEX_LOCK, mutex);
 }
 
-inline static int simcall_BODY_mutex_trylock(smx_mutex_t mutex)
-{
-  if (false) /* Go to that function to follow the code flow through the simcall barrier */
-    simcall_HANDLER_mutex_trylock(&SIMIX_process_self()->simcall_, mutex);
-  return simcall<int, smx_mutex_t>(Simcall::MUTEX_TRYLOCK, mutex);
-}
-
 inline static void simcall_BODY_cond_wait(smx_cond_t cond, smx_mutex_t mutex)
 {
   if (false) /* Go to that function to follow the code flow through the simcall barrier */
index 05b9c67..eb82c44 100644 (file)
@@ -31,7 +31,6 @@ enum class Simcall {
   COMM_TEST,
   COMM_TESTANY,
   MUTEX_LOCK,
-  MUTEX_TRYLOCK,
   COND_WAIT,
   COND_WAIT_TIMEOUT,
   SEM_ACQUIRE,
@@ -40,6 +39,6 @@ enum class Simcall {
   RUN_BLOCKING,
 };
 
-constexpr int NUM_SIMCALLS = 18;
+constexpr int NUM_SIMCALLS = 17;
 } // namespace simix
 } // namespace simgrid
index 550131a..8a2e0c2 100644 (file)
@@ -39,7 +39,6 @@ constexpr std::array<const char*, simgrid::simix::NUM_SIMCALLS> simcall_names{{
     "Simcall::COMM_TEST",
     "Simcall::COMM_TESTANY",
     "Simcall::MUTEX_LOCK",
-    "Simcall::MUTEX_TRYLOCK",
     "Simcall::COND_WAIT",
     "Simcall::COND_WAIT_TIMEOUT",
     "Simcall::SEM_ACQUIRE",
@@ -104,11 +103,6 @@ void simgrid::kernel::actor::ActorImpl::simcall_handle(int times_considered_)
       simcall_HANDLER_mutex_lock(&simcall_, simgrid::simix::unmarshal<smx_mutex_t>(simcall_.args_[0]));
       break;
 
-    case Simcall::MUTEX_TRYLOCK:
-      simgrid::simix::marshal<int>(simcall_.result_, simcall_HANDLER_mutex_trylock(&simcall_, simgrid::simix::unmarshal<smx_mutex_t>(simcall_.args_[0])));
-      simcall_answer();
-      break;
-
     case Simcall::COND_WAIT:
       simcall_HANDLER_cond_wait(&simcall_, simgrid::simix::unmarshal<smx_cond_t>(simcall_.args_[0]), simgrid::simix::unmarshal<smx_mutex_t>(simcall_.args_[1]));
       break;
index 8d296c2..052868a 100644 (file)
@@ -47,7 +47,6 @@ bool           comm_test(simgrid::kernel::activity::CommImpl* comm) [[block]];
 int            comm_testany(simgrid::kernel::activity::CommImpl** comms, size_t count) [[block]];
 
 void        mutex_lock(smx_mutex_t mutex) [[block]];
-int         mutex_trylock(smx_mutex_t mutex);
 
 void       cond_wait(smx_cond_t cond, smx_mutex_t mutex) [[block]];
 int        cond_wait_timeout(smx_cond_t cond, smx_mutex_t mutex, double timeout) [[block]];
index c82e82c..5aa26ad 100644 (file)
@@ -48,7 +48,8 @@ int PMPI_Type_get_extent(MPI_Datatype datatype, MPI_Aint * lb, MPI_Aint * extent
 
 int PMPI_Type_get_extent_x(MPI_Datatype datatype, MPI_Count * lb, MPI_Count * extent)
 {
-  MPI_Aint tmplb, tmpext;
+  MPI_Aint tmplb;
+  MPI_Aint tmpext;
   int ret = PMPI_Type_get_extent(datatype, &tmplb, &tmpext);
   if(ret == MPI_SUCCESS){
     *lb = static_cast<MPI_Count>(tmplb);
index 7d75aa2..f1ff837 100644 (file)
@@ -26,7 +26,6 @@ public:
   static xbt::Extension<s4u::Host, smpi::Host> EXTENSION_ID;
 
   explicit Host(s4u::Host* ptr);
-  ~Host() = default;
 
   double orecv(size_t size);
   double osend(size_t size);
index 91aeaee..df50447 100644 (file)
@@ -22,7 +22,6 @@ class Info : public F2C{
 public:
   explicit Info() {this->add_f();}
   explicit Info(const Info* orig) : map_(orig->map_) {this->add_f();}
-  ~Info() override = default;
   void ref();
   static void unref(MPI_Info info);
   void set(const char* key, const char* value) { map_[key] = value; }
index a514807..ee3430c 100644 (file)
@@ -78,23 +78,14 @@ CpuCas01Model::~CpuCas01Model()
   surf_cpu_model_pm = nullptr;
 }
 
-Cpu* CpuCas01Model::create_cpu(s4u::Host* host, const std::vector<double>& speed_per_pstate, int core)
+Cpu* CpuCas01Model::create_cpu(s4u::Host* host, const std::vector<double>& speed_per_pstate)
 {
-  return new CpuCas01(this, host, speed_per_pstate, core);
+  return (new CpuCas01(host, speed_per_pstate))->set_model(this);
 }
 
 /************
  * Resource *
  ************/
-CpuCas01::CpuCas01(CpuCas01Model* model, s4u::Host* host, const std::vector<double>& speed_per_pstate, int core)
-    : Cpu(host, speed_per_pstate)
-{
-  this->set_core_count(core)->set_model(model)->set_constraint(
-      model->get_maxmin_system()->constraint_new(this, core * speed_per_pstate.front()));
-}
-
-CpuCas01::~CpuCas01() = default;
-
 bool CpuCas01::is_used() const
 {
   return get_model()->get_maxmin_system()->constraint_used(get_constraint());
index 88d382b..7ef6cec 100644 (file)
@@ -32,7 +32,7 @@ public:
   CpuCas01Model& operator=(const CpuCas01Model&) = delete;
   ~CpuCas01Model() override;
 
-  Cpu* create_cpu(s4u::Host* host, const std::vector<double>& speed_per_pstate, int core) override;
+  Cpu* create_cpu(s4u::Host* host, const std::vector<double>& speed_per_pstate) override;
 };
 
 /************
@@ -41,10 +41,9 @@ public:
 
 class CpuCas01 : public Cpu {
 public:
-  CpuCas01(CpuCas01Model* model, s4u::Host* host, const std::vector<double>& speed_per_pstate, int core);
+  CpuCas01(s4u::Host* host, const std::vector<double>& speed_per_pstate) : Cpu(host, speed_per_pstate) {}
   CpuCas01(const CpuCas01&) = delete;
   CpuCas01& operator=(const CpuCas01&) = delete;
-  ~CpuCas01() override;
   void apply_event(profile::Event* event, double value) override;
   CpuAction* execution_start(double size) override;
   CpuAction* execution_start(double size, int requested_cores) override;
index a15bc1f..eafa003 100644 (file)
@@ -4,6 +4,7 @@
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
 #include "cpu_interface.hpp"
+#include "cpu_ti.hpp"
 #include "src/kernel/resource/profile/Profile.hpp"
 #include "src/surf/surf_interface.hpp"
 #include "surf/surf.hpp"
@@ -98,6 +99,9 @@ Cpu* Cpu::set_core_count(int core_count)
 {
   xbt_assert(not is_sealed(), "Core count cannot be changed once CPU has been sealed");
   xbt_assert(core_count > 0, "Host %s must have at least one core, not 0.", piface_->get_cname());
+  if (dynamic_cast<CpuTiModel*>(get_model()) != nullptr)
+    xbt_assert(core_count == 1, "Multi-core not handled by this model yet");
+
   core_count_ = core_count;
   return this;
 }
@@ -116,6 +120,9 @@ void Cpu::set_speed_profile(kernel::profile::Profile* profile)
 
 void Cpu::seal()
 {
+  lmm::System* lmm = get_model()->get_maxmin_system();
+  if (dynamic_cast<CpuTiModel*>(get_model()) == nullptr)
+    this->set_constraint(lmm->constraint_new(this, core_count_ * speed_per_pstate_.front()));
   Resource::seal();
 }
 
index 0f3d94f..f96a75d 100644 (file)
@@ -38,7 +38,7 @@ public:
    *                         This ignores any potential external load coming from a trace.
    * @param core The number of core of this Cpu
    */
-  virtual Cpu* create_cpu(s4u::Host* host, const std::vector<double>& speed_per_pstate, int core) = 0;
+  virtual Cpu* create_cpu(s4u::Host* host, const std::vector<double>& speed_per_pstate) = 0;
 
   void update_actions_state_lazy(double now, double delta) override;
   void update_actions_state_full(double now, double delta) override;
index 91cf686..89cc142 100644 (file)
@@ -284,9 +284,9 @@ CpuTiModel::~CpuTiModel()
   surf_cpu_model_pm = nullptr;
 }
 
-Cpu* CpuTiModel::create_cpu(s4u::Host* host, const std::vector<double>& speed_per_pstate, int core)
+Cpu* CpuTiModel::create_cpu(s4u::Host* host, const std::vector<double>& speed_per_pstate)
 {
-  return new CpuTi(this, host, speed_per_pstate, core);
+  return (new CpuTi(host, speed_per_pstate))->set_model(this);
 }
 
 double CpuTiModel::next_occurring_event(double now)
@@ -323,12 +323,8 @@ void CpuTiModel::update_actions_state(double now, double /*delta*/)
 /************
  * Resource *
  ************/
-CpuTi::CpuTi(CpuTiModel* model, s4u::Host* host, const std::vector<double>& speed_per_pstate, int core)
-    : Cpu(host, speed_per_pstate)
+CpuTi::CpuTi(s4u::Host* host, const std::vector<double>& speed_per_pstate) : Cpu(host, speed_per_pstate)
 {
-  xbt_assert(core == 1, "Multi-core not handled by this model yet");
-  this->set_model(model);
-
   speed_.peak = speed_per_pstate.front();
   XBT_DEBUG("CPU create: peak=%f", speed_.peak);
 
index 0961510..81b5618 100644 (file)
@@ -100,7 +100,7 @@ using ActionTiList = boost::intrusive::list<CpuTiAction, ActionTiListOptions>;
  ************/
 class CpuTi : public Cpu {
 public:
-  CpuTi(CpuTiModel* model, s4u::Host* host, const std::vector<double>& speed_per_pstate, int core);
+  CpuTi(s4u::Host* host, const std::vector<double>& speed_per_pstate);
   CpuTi(const CpuTi&)            = delete;
   CpuTi& operator&(const CpuTi&) = delete;
   ~CpuTi() override;
@@ -146,7 +146,7 @@ public:
   CpuTiModel(const CpuTiModel&) = delete;
   CpuTiModel& operator=(const CpuTiModel&) = delete;
   ~CpuTiModel() override;
-  Cpu* create_cpu(s4u::Host* host, const std::vector<double>& speed_per_pstate, int core) override;
+  Cpu* create_cpu(s4u::Host* host, const std::vector<double>& speed_per_pstate) override;
   double next_occurring_event(double now) override;
   void update_actions_state(double now, double delta) override;
 
index 3460d36..7911375 100644 (file)
@@ -31,7 +31,6 @@ class XBT_PRIVATE NetworkSmpiModel;
 class NetworkCm02Model : public NetworkModel {
 public:
   NetworkCm02Model();
-  ~NetworkCm02Model() override = default;
   LinkImpl* create_link(const std::string& name, const std::vector<double>& bandwidths,
                         s4u::Link::SharingPolicy policy) override;
   void update_actions_state_lazy(double now, double delta) override;
@@ -46,7 +45,6 @@ public:
 class NetworkCm02Link : public LinkImpl {
 public:
   NetworkCm02Link(const std::string& name, double bandwidth, s4u::Link::SharingPolicy policy, lmm::System* system);
-  ~NetworkCm02Link() override = default;
   void apply_event(kernel::profile::Event* event, double value) override;
   void set_bandwidth(double value) override;
   LinkImpl* set_latency(double value) override;
@@ -60,7 +58,6 @@ class NetworkCm02Action : public NetworkAction {
 
 public:
   using NetworkAction::NetworkAction;
-  ~NetworkCm02Action() override = default;
   void update_remains_lazy(double now) override;
 };
 }
index e08b23a..007bc0c 100644 (file)
@@ -35,7 +35,6 @@ public:
   // number of comms the node is receiving
   int nbActiveCommsDown = 0;
   explicit IBNode(int id) : id(id){};
-  virtual ~IBNode() = default;
 };
 
 class XBT_PRIVATE NetworkIBModel : public NetworkSmpiModel {
index 573b993..0ff7b13 100644 (file)
@@ -110,7 +110,7 @@ class LinkImpl : public Resource_T<LinkImpl>, public xbt::PropertyHolder {
   s4u::Link piface_;
 
 protected:
-  LinkImpl(const std::string& name);
+  explicit LinkImpl(const std::string& name);
   LinkImpl(const LinkImpl&) = delete;
   LinkImpl& operator=(const LinkImpl&) = delete;
   ~LinkImpl() override                 = default; // Use destroy() instead of this destructor.
index 38f60c1..00b44bc 100644 (file)
@@ -17,7 +17,6 @@ namespace resource {
 class NetworkNS3Model : public NetworkModel {
 public:
   NetworkNS3Model();
-  ~NetworkNS3Model() override = default;
   LinkImpl* create_link(const std::string& name, const std::vector<double>& bandwidth,
                         s4u::Link::SharingPolicy policy) override;
   Action* communicate(s4u::Host* src, s4u::Host* dst, double size, double rate) override;
index e51a440..b5fa658 100644 (file)
@@ -18,7 +18,6 @@ namespace resource {
 class XBT_PRIVATE NetworkSmpiModel : public NetworkCm02Model {
 public:
   NetworkSmpiModel();
-  ~NetworkSmpiModel() override = default;
 
   double get_latency_factor(double size) override;
   double get_bandwidth_factor(double size) override;
index de2019e..c55755f 100644 (file)
@@ -187,9 +187,16 @@ L07Action::L07Action(kernel::resource::Model* model, const std::vector<s4u::Host
 
   /* Expand it for the CPUs even if there is nothing to compute, to make sure that it gets expended even if there is no
    * communication either */
-  for (size_t i = 0; i < host_list.size(); i++)
+  double bound = std::numeric_limits<double>::max();
+  for (size_t i = 0; i < host_list.size(); i++) {
     model->get_maxmin_system()->expand(host_list[i]->pimpl_cpu->get_constraint(), get_variable(),
                                        (flops_amount == nullptr ? 0.0 : flops_amount[i]));
+    if (flops_amount && flops_amount[i] > 0)
+      bound = std::min(bound, host_list[i]->pimpl_cpu->get_speed(1.0) * host_list[i]->pimpl_cpu->get_speed_ratio() /
+                                  flops_amount[i]);
+  }
+  if (bound < std::numeric_limits<double>::max())
+    model->get_maxmin_system()->update_variable_bound(get_variable(), bound);
 
   if (bytes_amount != nullptr) {
     for (size_t k = 0; k < host_list.size() * host_list.size(); k++) {
@@ -222,9 +229,9 @@ kernel::resource::Action* NetworkL07Model::communicate(s4u::Host* src, s4u::Host
   return res;
 }
 
-kernel::resource::Cpu* CpuL07Model::create_cpu(s4u::Host* host, const std::vector<double>& speed_per_pstate, int core)
+kernel::resource::Cpu* CpuL07Model::create_cpu(s4u::Host* host, const std::vector<double>& speed_per_pstate)
 {
-  return new CpuL07(this, host, speed_per_pstate, core);
+  return (new CpuL07(host, speed_per_pstate))->set_model(this);
 }
 
 kernel::resource::LinkImpl* NetworkL07Model::create_link(const std::string& name, const std::vector<double>& bandwidths,
@@ -238,15 +245,6 @@ kernel::resource::LinkImpl* NetworkL07Model::create_link(const std::string& name
  * Resource *
  ************/
 
-CpuL07::CpuL07(CpuL07Model* model, simgrid::s4u::Host* host, const std::vector<double>& speed_per_pstate, int core)
-    : Cpu(host, speed_per_pstate)
-{
-  this->set_core_count(core)->set_model(model)->set_constraint(
-      model->get_maxmin_system()->constraint_new(this, speed_per_pstate.front()));
-}
-
-CpuL07::~CpuL07()=default;
-
 kernel::resource::CpuAction* CpuL07::execution_start(double size)
 {
   std::vector<s4u::Host*> host_list = {get_iface()};
index 2763e4c..a38cb2d 100644 (file)
@@ -53,7 +53,7 @@ public:
   CpuL07Model& operator=(const CpuL07Model&) = delete;
   ~CpuL07Model() override;
 
-  kernel::resource::Cpu* create_cpu(s4u::Host* host, const std::vector<double>& speed_per_pstate, int core) override;
+  kernel::resource::Cpu* create_cpu(s4u::Host* host, const std::vector<double>& speed_per_pstate) override;
   HostL07Model *hostModel_;
 };
 
@@ -77,10 +77,10 @@ public:
 
 class CpuL07 : public kernel::resource::Cpu {
 public:
-  CpuL07(CpuL07Model* model, s4u::Host* host, const std::vector<double>& speed_per_pstate, int core);
+  CpuL07(s4u::Host* host, const std::vector<double>& speed_per_pstate) : Cpu(host, speed_per_pstate){};
   CpuL07(const CpuL07&) = delete;
   CpuL07& operator=(const CpuL07&) = delete;
-  ~CpuL07() override;
+
   bool is_used() const override;
   void apply_event(kernel::profile::Event* event, double value) override;
   kernel::resource::CpuAction* execution_start(double size) override;
index 67a8fad..f213bb1 100644 (file)
@@ -182,7 +182,6 @@ public:
   TypedConfigurationElement(const std::string& key, const std::string& desc, T value, std::function<void(T&)> callback)
       : ConfigurationElement(key, desc), content(std::move(value)), callback(std::move(callback))
   {}
-  ~TypedConfigurationElement() override = default;
 
   std::string get_string_value() override;
   const char* get_type_name() override;
index 7d987d2..01f9239 100644 (file)
@@ -56,9 +56,8 @@ int main(int argc, char* argv[])
     XBT_INFO("Behavior: segv");
     behavior = Behavior::SEGV;
   } else {
-    xbt_die("Please use either 'abort', 'assert', 'printf', or 'segv' as first parameter, to specify what to do when "
-            "the error "
-            "is found.");
+    xbt_die("Please use either 'abort', 'assert', 'printf', or 'segv' as first parameter,"
+            " to specify what to do when the error is found.");
   }
 
   e.load_platform(argv[2]);