Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'random_readwritestate' into 'master'
authorYann Duplouy <duplouy@crans.org>
Mon, 27 Apr 2020 17:09:07 +0000 (19:09 +0200)
committerYann Duplouy <duplouy@crans.org>
Mon, 27 Apr 2020 17:09:07 +0000 (19:09 +0200)
[xbt/random] Read/Write the state of the RNG

See merge request simgrid/simgrid!36

47 files changed:
.mailmap
ChangeLog
docs/source/Configuring_SimGrid.rst
docs/source/platform_howtos.rst
examples/deprecated/msg/trace-process-migration/trace-process-migration.tesh
examples/s4u/dht-kademlia/answer.cpp
examples/s4u/dht-kademlia/answer.hpp
examples/s4u/dht-kademlia/message.hpp
examples/s4u/dht-kademlia/node.cpp
examples/s4u/dht-kademlia/node.hpp
examples/s4u/dht-kademlia/routing_table.cpp
examples/s4u/dht-kademlia/routing_table.hpp
examples/s4u/dht-kademlia/s4u-dht-kademlia.cpp
examples/s4u/dht-kademlia/s4u-dht-kademlia.hpp
examples/smpi/replay/replay-override-replayer.tesh
examples/smpi/replay/replay.tesh
include/simgrid/kernel/routing/NetPoint.hpp
include/simgrid/link.h
include/simgrid/s4u/Link.hpp
include/simgrid/simix.h
src/bindings/python/simgrid_python.cpp
src/instr/instr_paje_types.cpp
src/instr/instr_paje_types.hpp
src/instr/instr_platform.cpp
src/instr/instr_smpi.hpp
src/kernel/resource/DiskImpl.hpp
src/mc/checker/Checker.hpp
src/mc/checker/CommunicationDeterminismChecker.hpp
src/mc/checker/LivenessChecker.hpp
src/mc/checker/SafetyChecker.hpp
src/mc/inspect/DwarfExpression.hpp
src/mc/remote/Channel.hpp
src/mc/remote/Client.hpp
src/mc/remote/RemoteClient.hpp
src/mc/remote/RemotePtr.hpp
src/mc/sosp/Snapshot.hpp
src/msg/msg_task.cpp
src/s4u/s4u_Link.cpp
src/simgrid/sg_config.cpp
src/simix/smx_context.cpp
src/smpi/bindings/smpi_pmpi.cpp
src/smpi/internals/instr_smpi.cpp
src/smpi/internals/smpi_bench.cpp
src/smpi/internals/smpi_global.cpp
src/smpi/internals/smpi_replay.cpp
src/surf/disk_s19.cpp
src/surf/xml/surfxml_sax_cb.cpp

index c166857..0eeaab3 100644 (file)
--- a/.mailmap
+++ b/.mailmap
@@ -18,6 +18,7 @@ Henri Casanova <henric@hawaii.edu>
 Henri Casanova <henric@hawaii.edu> <casanova@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
 Henri Casanova <henric@hawaii.edu> <casanova@fac-dhcp04.ics.hawaii.edu>
 Henri Casanova <henric@hawaii.edu> <casanova@fac-dhcp06.ics.hawaii.edu>
+Henri Casanova <henric@hawaii.edu> <henricasanova@gmail.com>
 Stéphane Castelli <stephane.castelli@loria.fr> <scastelli@ipb.fr>
 Stéphane Castelli <stephane.castelli@loria.fr> <stephane.castelli@inria.fr>
 Fabien Chaix <chaix@ics.forth.gr>
@@ -48,7 +49,8 @@ Darina Dimitrova <dimitrov@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
 Bruno Donassolo <donassbr@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
 Yann Duplouy <yann.duplouy@inria.fr> <duplouy@crans.org>
 Pierre-François Dutot <dutot@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
-Julien Emmanuel <julien.emmanuel@atos.net>
+Julien Emmanuel <julien.emmanuel@inria.fr>
+Julien Emmanuel <julien.emmanuel@inria.fr> <julien.emmanuel@atos.net>
 Lionel Eyraud-Dubois <lionel.eyraud-dubois@inria.fr>
 Lionel Eyraud-Dubois <lionel.eyraud-dubois@inria.fr> <eyraud@etincel.(none)>
 Lionel Eyraud-Dubois <lionel.eyraud-dubois@inria.fr> <eyraudl@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
index 416340d..4f77382 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -27,17 +27,22 @@ C interface:
  - Many MSG tests were converted to the new S4U's interface in C, that
    was extended for that.
 
+Simix:
+ - Remove obsolete option --cfg=contexts/parallel-threshold.
+
 Fixed bugs (FG#.. -> FramaGit bugs; FG!.. -> FG merge requests)
  (FG: issues on Framagit; GF: issues on GForge; GH: issues on GitHub)
  - FG#41: Add sg_actor_create C interface
  - FG#43: xbt::random needs some care
  - FG#48: The Impossible Did Happen (yet again)
  - FG!24: Documentation and fix for xbt/random
+ - FG!35: Add a modeling hint for parallel links in doc
  - GF#18137: Allow different stack sizes?
  - GH#128: Parallelization of simulation with --cfg=contexts/nthreads
  - GH#139: Allow pthread creation in SMPI
  - GH#336: Packet-level simulation using SMPI?
  - GH!337: Fix link_energy plugin for wifi platforms
+ - GH!339: Add Mailbox set_receiver method to python binding
 
 ----------------------------------------------------------------------------
 
@@ -560,7 +565,7 @@ Plugins:
  - Rename Energy plugin into host_energy
  - Rename Load plugin into host_load
 
-simix:
+Simix:
  - Add parameter --cfg=simix/breakpoint to raise a SIGTRAP at given time.
  - kill simix::onDeadlock() that was somewhat dupplicating s4u::on_deadlock()
  - Improve performance when handling timeouts of simix synchros.
index 17654ef..e3689ec 100644 (file)
@@ -87,7 +87,6 @@ Existing Configuration Items
 - **contexts/factory:** :ref:`cfg=contexts/factory`
 - **contexts/guard-size:** :ref:`cfg=contexts/guard-size`
 - **contexts/nthreads:** :ref:`cfg=contexts/nthreads`
-- **contexts/parallel-threshold:** :ref:`cfg=contexts/parallel-threshold`
 - **contexts/stack-size:** :ref:`cfg=contexts/stack-size`
 - **contexts/synchro:** :ref:`cfg=contexts/synchro`
 
@@ -832,7 +831,6 @@ on other parts of the memory if their size is too small for the
 application.
 
 .. _cfg=contexts/nthreads:
-.. _cfg=contexts/parallel-threshold:
 .. _cfg=contexts/synchro:
 
 Running User Code in Parallel
@@ -850,17 +848,6 @@ run. To activate this, set the ``contexts/nthreads`` item to the amount
 of cores that you have in your computer (or lower than 1 to have the
 amount of cores auto-detected).
 
-Even if you asked several worker threads using the previous option,
-you can request to start the parallel execution (and pay the
-associated synchronization costs) only if the potential parallelism is
-large enough. For that, set the ``contexts/parallel-threshold``
-item to the minimal amount of user contexts needed to start the
-parallel execution. In any given simulation round, if that amount is
-not reached, the contexts will be run sequentially directly by the
-main thread (thus saving the synchronization costs). Note that this
-option is mainly useful when the grain of the user code is very fine,
-because our synchronization is now very efficient.
-
 When parallel execution is activated, you can choose the
 synchronization schema used with the ``contexts/synchro`` item,
 which value is either:
index 0cd01b4..2a135ea 100644 (file)
@@ -183,6 +183,68 @@ period and another one for the shutdown period.
 
 Of course, this is only one possible way to model these things. YMMV ;)
 
+.. _howto_parallel_links:
+
+Modeling parallel links
+***********************
+
+Most HPC topologies, such as fat-trees, allow parallel links (a 
+router A and a router B can be connected by more than one link).
+You might be tempted to model this configuration as follows :
+
+.. code-block:: xml
+
+    <router id="routerA"/>
+    <router id="routerB"/>
+
+    <link id="link1" bandwidth="10GBps" latency="2us"/>
+    <link id="link2" bandwidth="10GBps" latency="2us"/>
+
+    <route src="routerA" dst="routerB">
+        <link_ctn id="link1"/>
+    </route>
+    <route src="routerA" dst="routerB">
+        <link_ctn id="link2"/>
+    </route>
+
+But that will not work, since SimGrid doesn't allow several routes for 
+a single `{src ; dst}` pair. Instead, what you should do is :
+
+  - Use a single route with both links (so both will be traversed
+    each time a message is exchanged between router A and B)
+
+  - Double the bandwidth of one link, to model the total bandwidth of
+    both links used in parallel. This will make sure no combined 
+    communications between router A and B use more than the bandwidth 
+    of two links
+
+  - Assign the other link a `FATPIPE` sharing policy, which will allow 
+    several communications to use the full bandwidth of this link without
+    having to share it. This will model the fact that individual
+    communications can use at most this link's bandwidth
+
+  - Set the latency of one of the links to 0, so that latency is only 
+    accounted for once (since both link are traversed by each message)
+
+So the final platform for our example becomes :
+
+.. code-block:: xml
+
+    <router id="routerA"/>
+    <router id="routerB"/>
+
+    <!-- This link limits the total bandwidth of all parallel communications -->
+    <link id="link1" bandwidth="20GBps" latency="2us"/>
+
+    <!-- This link only limits the bandwidth of individual communications -->
+    <link id="link2" bandwidth="10GBps" latency="0us" sharing_policy="FATPIPE"/>
+
+    <!-- Each message traverses both links -->
+    <route src="routerA" dst="routerB">
+        <link_ctn id="link1"/>
+        <link_ctn id="link2"/>
+    </route>
+
 .. _understanding_lv08
 
 Understanding the default TCP model
index 319a3e6..772f871 100644 (file)
@@ -252,17 +252,16 @@ $ tail -n +3 procmig.trace
 > 5 11 7 send "0 0 1"
 > 5 12 7 execute "0 1 1"
 > 4 13 0 6 6 ACTOR_LINK
-> 4 14 0 6 6 ACTOR_TASK_LINK
 > 6 0.000000 33 6 1 "policeman-2"
 > 12 0.000000 7 32 9
-> 15 0.000000 14 0 SR 33 p0
+> 15 0.000000 13 0 SR 33 p0
 > 12 0.000000 7 33 11
 > 13 2.000000 7 32
 > 12 2.000000 7 32 10
 > 13 2.025708 7 33
-> 15 2.025708 14 0 SR 33 p1
+> 15 2.025708 13 0 SR 33 p1
 > 12 2.025708 7 33 11
-> 16 2.025708 14 0 SR 32 p0
+> 16 2.025708 13 0 SR 32 p0
 > 15 2.025708 13 0 M 32 0
 > 7 2.025708 6 32
 > 6 2.025708 34 6 1 "emigrant-1"
@@ -271,9 +270,9 @@ $ tail -n +3 procmig.trace
 > 13 4.025708 7 34
 > 12 4.025708 7 34 10
 > 13 4.025903 7 33
-> 15 4.025903 14 0 SR 33 p2
+> 15 4.025903 13 0 SR 33 p2
 > 12 4.025903 7 33 11
-> 16 4.025903 14 0 SR 34 p1
+> 16 4.025903 13 0 SR 34 p1
 > 15 4.025903 13 0 M 34 1
 > 7 4.025903 6 34
 > 6 4.025903 35 6 2 "emigrant-1"
@@ -282,9 +281,9 @@ $ tail -n +3 procmig.trace
 > 13 6.025903 7 35
 > 12 6.025903 7 35 10
 > 13 6.044918 7 33
-> 15 6.044918 14 0 SR 33 p3
+> 15 6.044918 13 0 SR 33 p3
 > 12 6.044918 7 33 11
-> 16 6.044918 14 0 SR 35 p2
+> 16 6.044918 13 0 SR 35 p2
 > 15 6.044918 13 0 M 35 2
 > 7 6.044918 6 35
 > 6 6.044918 36 6 3 "emigrant-1"
@@ -293,9 +292,9 @@ $ tail -n +3 procmig.trace
 > 13 8.044918 7 36
 > 12 8.044918 7 36 10
 > 13 8.070626 7 33
-> 15 8.070626 14 0 SR 33 p4
+> 15 8.070626 13 0 SR 33 p4
 > 12 8.070626 7 33 11
-> 16 8.070626 14 0 SR 36 p3
+> 16 8.070626 13 0 SR 36 p3
 > 15 8.070626 13 0 M 36 3
 > 7 8.070626 6 36
 > 6 8.070626 37 6 4 "emigrant-1"
@@ -304,9 +303,9 @@ $ tail -n +3 procmig.trace
 > 13 10.070626 7 37
 > 12 10.070626 7 37 10
 > 13 10.087178 7 33
-> 15 10.087178 14 0 SR 33 p5
+> 15 10.087178 13 0 SR 33 p5
 > 12 10.087178 7 33 11
-> 16 10.087178 14 0 SR 37 p4
+> 16 10.087178 13 0 SR 37 p4
 > 15 10.087178 13 0 M 37 4
 > 7 10.087178 6 37
 > 6 10.087178 38 6 5 "emigrant-1"
@@ -315,9 +314,9 @@ $ tail -n +3 procmig.trace
 > 13 12.087178 7 38
 > 12 12.087178 7 38 10
 > 13 12.112617 7 33
-> 15 12.112617 14 0 SR 33 p6
+> 15 12.112617 13 0 SR 33 p6
 > 12 12.112617 7 33 11
-> 16 12.112617 14 0 SR 38 p5
+> 16 12.112617 13 0 SR 38 p5
 > 15 12.112617 13 0 M 38 5
 > 7 12.112617 6 38
 > 6 12.112617 39 6 3 "emigrant-1"
@@ -326,9 +325,9 @@ $ tail -n +3 procmig.trace
 > 13 14.112617 7 39
 > 12 14.112617 7 39 10
 > 13 14.138325 7 33
-> 15 14.138325 14 0 SR 33 p7
+> 15 14.138325 13 0 SR 33 p7
 > 12 14.138325 7 33 11
-> 16 14.138325 14 0 SR 39 p6
+> 16 14.138325 13 0 SR 39 p6
 > 15 14.138325 13 0 M 39 6
 > 7 14.138325 6 39
 > 6 14.138325 40 6 1 "emigrant-1"
@@ -337,9 +336,9 @@ $ tail -n +3 procmig.trace
 > 13 16.138325 7 40
 > 12 16.138325 7 40 10
 > 13 16.138521 7 33
-> 15 16.138521 14 0 SR 33 p8
+> 15 16.138521 13 0 SR 33 p8
 > 12 16.138521 7 33 11
-> 16 16.138521 14 0 SR 40 p7
+> 16 16.138521 13 0 SR 40 p7
 > 15 16.138521 13 0 M 40 7
 > 7 16.138521 6 40
 > 6 16.138521 41 6 4 "emigrant-1"
@@ -348,7 +347,7 @@ $ tail -n +3 procmig.trace
 > 13 18.138521 7 41
 > 12 18.138521 7 41 10
 > 13 18.155073 7 33
-> 16 18.155073 14 0 SR 41 p8
+> 16 18.155073 13 0 SR 41 p8
 > 7 18.155073 6 33
 > 7 18.155073 6 41
 > 7 18.155073 2 16
index 7fa8655..6d5515c 100644 (file)
@@ -65,9 +65,9 @@ void Answer::addBucket(const Bucket* bucket)
 {
   xbt_assert((bucket != nullptr), "Provided a NULL bucket");
 
-  for (auto const& id : bucket->nodes) {
+  for (auto const& id : bucket->nodes_) {
     unsigned int distance = id ^ destination_id_;
     nodes_.push_back(std::pair<unsigned int, unsigned int>(id, distance));
   }
 }
-}
+} // namespace kademlia
index 34896d6..de5e1c9 100644 (file)
@@ -29,6 +29,6 @@ public:
   bool destinationFound() const;
   void addBucket(const kademlia::Bucket* bucket);
 };
-}
+} // namespace kademlia
 
 #endif
index 35ec478..15f5e5f 100644 (file)
@@ -38,5 +38,5 @@ public:
   Message(const Message&) = delete;
   Message& operator=(const Message&) = delete;
 };
-}
+} // namespace kademlia
 #endif
index fc2a7e4..d331cc3 100644 (file)
@@ -122,19 +122,19 @@ void Node::routingTableUpdate(unsigned int id)
   Bucket* bucket = table.findBucket(id);
 
   // check if the id is already in the bucket.
-  auto id_pos = std::find(bucket->nodes.begin(), bucket->nodes.end(), id);
+  auto id_pos = std::find(bucket->nodes_.begin(), bucket->nodes_.end(), id);
 
-  if (id_pos == bucket->nodes.end()) {
+  if (id_pos == bucket->nodes_.end()) {
     /* We check if the bucket is full or not. If it is, we evict an old element */
-    if (bucket->nodes.size() >= BUCKET_SIZE) {
-      bucket->nodes.pop_back();
+    if (bucket->nodes_.size() >= BUCKET_SIZE) {
+      bucket->nodes_.pop_back();
     }
-    bucket->nodes.push_front(id);
+    bucket->nodes_.push_front(id);
     XBT_VERB("I'm adding to my routing table %08x", id);
   } else {
     // We push the element to the front
-    bucket->nodes.erase(id_pos);
-    bucket->nodes.push_front(id);
+    bucket->nodes_.erase(id_pos);
+    bucket->nodes_.push_front(id);
     XBT_VERB("I'm updating %08x", id);
   }
 }
@@ -159,12 +159,12 @@ Answer* Node::findClosest(unsigned int destination_id)
   for (int i = 1; answer->getSize() < BUCKET_SIZE && ((bucket_id - i > 0) || (bucket_id + i < IDENTIFIER_SIZE)); i++) {
     /* We check the previous buckets */
     if (bucket_id - i >= 0) {
-      const Bucket* bucket_p = &table.buckets[bucket_id - i];
+      const Bucket* bucket_p = &table.getBucketAt(bucket_id - i);
       answer->addBucket(bucket_p);
     }
     /* We check the next buckets */
     if (bucket_id + i <= IDENTIFIER_SIZE) {
-      const Bucket* bucket_n = &table.buckets[bucket_id + i];
+      const Bucket* bucket_n = &table.getBucketAt(bucket_id + i);
       answer->addBucket(bucket_n);
     }
   }
@@ -280,7 +280,12 @@ void Node::handleFindNode(const Message* msg)
   // Sending the answer
   msg->answer_to_->put_init(answer, 1)->detach(kademlia::destroy);
 }
+
+void Node::displaySuccessRate()
+{
+  XBT_INFO("%u/%u FIND_NODE have succeeded", find_node_success, find_node_success + find_node_failed);
 }
+} // namespace kademlia
 /**@brief Returns an identifier which is in a specific bucket of a routing table
  * @param id id of the routing table owner
  * @param prefix id of the bucket where we want that identifier to be
index dc36ae2..ab64fa7 100644 (file)
@@ -16,11 +16,11 @@ namespace kademlia {
 class Node {
   unsigned int id_;              // node id - 160 bits
   RoutingTable table;            // node routing table
+  unsigned int find_node_success = 0; // Number of find_node which have succeeded.
+  unsigned int find_node_failed  = 0; // Number of find_node which have failed.
 public:
   simgrid::s4u::CommPtr receive_comm = nullptr;
   void* received_msg             = nullptr;
-  unsigned int find_node_success = 0; // Number of find_node which have succeeded.
-  unsigned int find_node_failed  = 0; // Number of find_node which have failed.
   explicit Node(unsigned int node_id) : id_(node_id), table(node_id) {}
   Node(const Node&) = delete;
   Node& operator=(const Node&) = delete;
@@ -34,8 +34,9 @@ public:
   bool findNode(unsigned int id_to_find, bool count_in_stats);
   void randomLookup();
   void handleFindNode(const Message* msg);
+  void displaySuccessRate();
 };
-}
+} // namespace kademlia
 // identifier functions
 unsigned int get_id_in_prefix(unsigned int id, unsigned int prefix);
 unsigned int get_node_prefix(unsigned int id, unsigned int nb_bits);
index c94ae3c..3bd9e5e 100644 (file)
@@ -14,9 +14,9 @@ namespace kademlia {
 /** @brief Initialization of a node routing table.  */
 RoutingTable::RoutingTable(unsigned int node_id) : id_(node_id)
 {
-  buckets.reserve(IDENTIFIER_SIZE + 1);
+  buckets_.reserve(IDENTIFIER_SIZE + 1);
   for (unsigned int i = 0; i < IDENTIFIER_SIZE + 1; i++)
-    buckets.emplace_back(i);
+    buckets_.emplace_back(i);
 }
 
 void RoutingTable::print() const
@@ -24,10 +24,10 @@ void RoutingTable::print() const
   XBT_INFO("Routing table of %08x:", id_);
 
   for (unsigned int i = 0; i <= IDENTIFIER_SIZE; i++) {
-    if (not buckets[i].nodes.empty()) {
+    if (not buckets_[i].nodes_.empty()) {
       XBT_INFO("Bucket number %u: ", i);
       int j = 0;
-      for (auto value : buckets[i].nodes) {
+      for (auto value : buckets_[i].nodes_) {
         XBT_INFO("Element %d: %08x", j, value);
         j++;
       }
@@ -44,13 +44,13 @@ Bucket* RoutingTable::findBucket(unsigned int id)
   unsigned int xor_number = id_ ^ id;
   unsigned int prefix     = get_node_prefix(xor_number, IDENTIFIER_SIZE);
   xbt_assert(prefix <= IDENTIFIER_SIZE, "Tried to return a  bucket that doesn't exist.");
-  return &buckets[prefix];
+  return &buckets_[prefix];
 }
 
 /** Returns if the routing table contains the id. */
 bool RoutingTable::contains(unsigned int node_id)
 {
   const Bucket* bucket = findBucket(node_id);
-  return std::find(bucket->nodes.begin(), bucket->nodes.end(), node_id) != bucket->nodes.end();
-}
+  return std::find(bucket->nodes_.begin(), bucket->nodes_.end(), node_id) != bucket->nodes_.end();
 }
+} // namespace kademlia
index 1c609d4..dda6217 100644 (file)
@@ -16,7 +16,7 @@ namespace kademlia {
 class Bucket {
   unsigned int id_; // bucket id
 public:
-  std::deque<unsigned int> nodes; // Nodes in the bucket.
+  std::deque<unsigned int> nodes_; // Nodes in the bucket.
   unsigned int getId() const { return id_; }
   explicit Bucket(unsigned int id) noexcept : id_(id) {}
 };
@@ -24,15 +24,16 @@ public:
 /* Node routing table */
 class RoutingTable {
   unsigned int id_; // node id of the client's routing table
+  std::vector<Bucket> buckets_; // Node bucket list
 public:
-  std::vector<Bucket> buckets; // Node bucket list - 160 sized.
   explicit RoutingTable(unsigned int node_id);
   RoutingTable(const RoutingTable&) = delete;
   RoutingTable& operator=(const RoutingTable&) = delete;
   void print() const;
   Bucket* findBucket(unsigned int id);
+  const Bucket& getBucketAt(unsigned int pos) const { return buckets_[pos]; }
   bool contains(unsigned int node_id);
 };
-}
+} // namespace kademlia
 
 #endif
index ac5231c..c38206c 100644 (file)
@@ -75,7 +75,7 @@ static void node(int argc, char* argv[])
     XBT_INFO("I couldn't join the network :(");
   }
   XBT_DEBUG("I'm leaving the network");
-  XBT_INFO("%u/%u FIND_NODE have succeeded", node.find_node_success, node.find_node_success + node.find_node_failed);
+  node.displaySuccessRate();
 }
 
 /** @brief Main function */
index c1fae17..347f4d6 100644 (file)
@@ -12,7 +12,7 @@
 namespace kademlia {
 class Answer;
 class Message;
-}
+} // namespace kademlia
 
 constexpr double FIND_NODE_TIMEOUT        = 10.0;
 constexpr double FIND_NODE_GLOBAL_TIMEOUT = 50.0;
index 2a7b050..8bb2014 100644 (file)
@@ -155,53 +155,59 @@ $ tail -n +3 ./simgrid_override.trace
 > 6 0.000000 1 1 0 "rank-0"
 > 6 0.000000 2 1 0 "rank-1"
 > 6 0.000000 3 1 0 "rank-2"
-> 5 6 2 computing "0 1 1"
-> 5 7 2 smpi_replay_run_init "0 1 0"
+> 5 6 2 smpi_replay_run_init "0 1 0"
+> 5 7 2 computing "0 1 1"
 > 5 8 2 action_bcast "0 0.78 0.39"
-> 12 0.000000 2 1 7
+> 12 0.000000 2 1 6
 > 13 0.000000 2 1
-> 12 0.000000 2 2 7
+> 12 0.000000 2 2 6
 > 13 0.000000 2 2
-> 12 0.000000 2 3 7
+> 12 0.000000 2 3 6
 > 13 0.000000 2 3
 > 12 0.000000 2 1 8
 > 12 0.000000 2 2 8
 > 12 0.000000 2 3 8
 > 13 0.000000 2 1
-> 12 0.000000 2 1 6
+> 12 0.000000 2 1 7
 > 5 9 2 action_reduce "0 1 0"
 > 5 10 2 smpi_replay_run_finalize "0 1 0"
 > 13 0.015036 2 2
-> 12 0.015036 2 2 6
+> 12 0.015036 2 2 7
 > 13 0.015676 2 3
-> 12 0.015676 2 3 6
+> 12 0.015676 2 3 7
 > 13 2.636405 2 2
 > 12 2.636405 2 2 8
 > 13 5.097100 2 1
 > 12 5.097100 2 1 8
 > 13 5.097100 2 1
-> 12 5.097100 2 1 6
+> 12 5.097100 2 1 7
 > 13 5.112136 2 2
-> 12 5.112136 2 2 6
+> 12 5.112136 2 2 7
 > 13 6.569099 2 3
 > 12 6.569099 2 3 8
 > 13 6.584775 2 3
-> 12 6.584775 2 3 6
+> 12 6.584775 2 3 7
 > 13 7.733505 2 2
 > 12 7.733505 2 2 9
+> 12 7.733505 2 2 7
 > 13 10.194200 2 1
 > 12 10.194200 2 1 9
 > 13 13.138198 2 3
 > 12 13.138198 2 3 9
+> 12 13.138198 2 3 7
+> 12 13.153874 2 1 7
+> 13 14.286929 2 2
 > 13 14.286929 2 2
 > 12 14.286929 2 2 10
 > 13 14.286929 2 2
 > 7 14.286929 1 2
 > 13 18.250974 2 1
+> 13 18.250974 2 1
 > 12 18.250974 2 1 10
 > 13 18.250974 2 1
 > 7 18.250974 1 1
 > 13 19.691622 2 3
+> 13 19.691622 2 3
 > 12 19.691622 2 3 10
 > 13 19.691622 2 3
 > 7 19.691622 1 3
index da20f7b..afcf644 100644 (file)
@@ -155,53 +155,59 @@ $ tail -n +3 ./simgrid.trace
 > 6 0.000000 1 1 0 "rank-0"
 > 6 0.000000 2 1 0 "rank-1"
 > 6 0.000000 3 1 0 "rank-2"
-> 5 6 2 computing "0 1 1"
-> 5 7 2 smpi_replay_run_init "0 1 0"
+> 5 6 2 smpi_replay_run_init "0 1 0"
+> 5 7 2 computing "0 1 1"
 > 5 8 2 action_bcast "0 0.78 0.39"
-> 12 0.000000 2 1 7
+> 12 0.000000 2 1 6
 > 13 0.000000 2 1
-> 12 0.000000 2 2 7
+> 12 0.000000 2 2 6
 > 13 0.000000 2 2
-> 12 0.000000 2 3 7
+> 12 0.000000 2 3 6
 > 13 0.000000 2 3
 > 12 0.000000 2 1 8
 > 12 0.000000 2 2 8
 > 12 0.000000 2 3 8
 > 13 0.000000 2 1
-> 12 0.000000 2 1 6
+> 12 0.000000 2 1 7
 > 5 9 2 action_reduce "0 1 0"
 > 5 10 2 smpi_replay_run_finalize "0 1 0"
 > 13 0.015036 2 2
-> 12 0.015036 2 2 6
+> 12 0.015036 2 2 7
 > 13 0.015676 2 3
-> 12 0.015676 2 3 6
+> 12 0.015676 2 3 7
 > 13 2.636405 2 2
 > 12 2.636405 2 2 8
 > 13 5.097100 2 1
 > 12 5.097100 2 1 8
 > 13 5.097100 2 1
-> 12 5.097100 2 1 6
+> 12 5.097100 2 1 7
 > 13 5.112136 2 2
-> 12 5.112136 2 2 6
+> 12 5.112136 2 2 7
 > 13 6.569099 2 3
 > 12 6.569099 2 3 8
 > 13 6.584775 2 3
-> 12 6.584775 2 3 6
+> 12 6.584775 2 3 7
 > 13 7.733505 2 2
 > 12 7.733505 2 2 9
+> 12 7.733505 2 2 7
 > 13 10.194200 2 1
 > 12 10.194200 2 1 9
 > 13 13.138198 2 3
 > 12 13.138198 2 3 9
+> 12 13.138198 2 3 7
+> 12 13.153874 2 1 7
+> 13 14.286929 2 2
 > 13 14.286929 2 2
 > 12 14.286929 2 2 10
 > 13 14.286929 2 2
 > 7 14.286929 1 2
 > 13 18.250974 2 1
+> 13 18.250974 2 1
 > 12 18.250974 2 1 10
 > 13 18.250974 2 1
 > 7 18.250974 1 1
 > 13 19.691622 2 3
+> 13 19.691622 2 3
 > 12 19.691622 2 3 10
 > 13 19.691622 2 3
 > 7 19.691622 1 3
index 39b74e3..f73bfd5 100644 (file)
@@ -24,7 +24,7 @@ namespace routing {
  *
  * @details This represents a position in the network. One can send information between two netpoints
  */
-class NetPoint : public simgrid::xbt::Extendable<NetPoint> {
+class NetPoint : public xbt::Extendable<NetPoint> {
 public:
   enum class Type { Host, Router, NetZone };
 
@@ -42,7 +42,7 @@ public:
   bool is_host() const { return component_type_ == Type::Host; }
   bool is_router() const { return component_type_ == Type::Router; }
 
-  static simgrid::xbt::signal<void(NetPoint&)> on_creation;
+  static xbt::signal<void(NetPoint&)> on_creation;
 
   bool operator<(const NetPoint& rhs) const { return name_ < rhs.name_; }
 
index 4c4cf86..115e64a 100644 (file)
@@ -17,7 +17,9 @@ XBT_PUBLIC const char* sg_link_name(const_sg_link_t link);
 XBT_PUBLIC sg_link_t sg_link_by_name(const char* name);
 XBT_PUBLIC int sg_link_is_shared(const_sg_link_t link);
 XBT_PUBLIC double sg_link_bandwidth(const_sg_link_t link);
+XBT_PUBLIC void sg_link_bandwidth_set(sg_link_t link, double value);
 XBT_PUBLIC double sg_link_latency(const_sg_link_t link);
+XBT_PUBLIC void sg_link_latency_set(sg_link_t link, double value);
 XBT_PUBLIC void* sg_link_data(const_sg_link_t link);
 XBT_PUBLIC void sg_link_data_set(sg_link_t link, void* data);
 XBT_PUBLIC int sg_link_count();
index 4fa04e8..d5d13bb 100644 (file)
@@ -54,9 +54,11 @@ public:
 
   /** @brief Get the bandwidth in bytes per second of current Link */
   double get_bandwidth() const;
+  void set_bandwidth(double value);
 
   /** @brief Get the latency in seconds of current Link */
   double get_latency() const;
+  void set_latency(double value);
 
   /** @brief Describes how the link is shared between flows */
   SharingPolicy get_sharing_policy() const;
index 9264bf5..749b0a7 100644 (file)
@@ -29,8 +29,6 @@ XBT_PUBLIC smx_actor_t SIMIX_process_from_PID(aid_t PID);
 XBT_PUBLIC int SIMIX_context_is_parallel();
 XBT_PUBLIC int SIMIX_context_get_nthreads();
 XBT_PUBLIC void SIMIX_context_set_nthreads(int nb_threads);
-XBT_PUBLIC int SIMIX_context_get_parallel_threshold();
-XBT_PUBLIC void SIMIX_context_set_parallel_threshold(int threshold);
 XBT_PUBLIC e_xbt_parmap_mode_t SIMIX_context_get_parallel_mode();
 XBT_PUBLIC void SIMIX_context_set_parallel_mode(e_xbt_parmap_mode_t mode);
 XBT_PUBLIC int SIMIX_is_maestro();
index af3d758..670be45 100644 (file)
@@ -256,7 +256,13 @@ PYBIND11_MODULE(simgrid, m)
             // data.dec_ref(); // FIXME: why does it break python-actor-create?
             return data;
           },
-          py::call_guard<GilScopedRelease>(), "Blocking data reception");
+          py::call_guard<GilScopedRelease>(), "Blocking data reception")
+      .def("set_receiver",
+        [](Mailbox* self, ActorPtr actor) {
+          self->set_receiver(actor);
+        },
+        py::call_guard<GilScopedRelease>(),
+        "Sets the actor as permanent receiver");
 
   /* Class Comm */
   py::class_<simgrid::s4u::Comm, simgrid::s4u::CommPtr>(m, "Comm", "Communication")
index 6bf9e2c..7cad3f6 100644 (file)
@@ -31,17 +31,17 @@ Type::Type(e_event_type event_type, const std::string& name, const std::string&
 
 void StateType::set_event(const std::string& value_name)
 {
-  events_.push_back(new StateEvent(issuer_, this, PAJE_SetState, get_entity_value(value_name), nullptr));
+  events_.push_back(new StateEvent(get_issuer(), this, PAJE_SetState, get_entity_value(value_name), nullptr));
 }
 
 void StateType::push_event(const std::string& value_name, TIData* extra)
 {
-  events_.push_back(new StateEvent(issuer_, this, PAJE_PushState, get_entity_value(value_name), extra));
+  events_.push_back(new StateEvent(get_issuer(), this, PAJE_PushState, get_entity_value(value_name), extra));
 }
 
 void StateType::push_event(const std::string& value_name)
 {
-  events_.push_back(new StateEvent(issuer_, this, PAJE_PushState, get_entity_value(value_name), nullptr));
+  events_.push_back(new StateEvent(get_issuer(), this, PAJE_PushState, get_entity_value(value_name), nullptr));
 }
 
 void StateType::pop_event()
@@ -51,7 +51,7 @@ void StateType::pop_event()
 
 void StateType::pop_event(TIData* extra)
 {
-  events_.push_back(new StateEvent(issuer_, this, PAJE_PopState, nullptr, extra));
+  events_.push_back(new StateEvent(get_issuer(), this, PAJE_PopState, nullptr, extra));
 }
 
 void VariableType::instr_event(double now, double delta, const char* resource, double value)
@@ -76,17 +76,17 @@ void VariableType::instr_event(double now, double delta, const char* resource, d
 
 void VariableType::set_event(double timestamp, double value)
 {
-  events_.push_back(new VariableEvent(timestamp, issuer_, this, PAJE_SetVariable, value));
+  events_.push_back(new VariableEvent(timestamp, get_issuer(), this, PAJE_SetVariable, value));
 }
 
 void VariableType::add_event(double timestamp, double value)
 {
-  events_.push_back(new VariableEvent(timestamp, issuer_, this, PAJE_AddVariable, value));
+  events_.push_back(new VariableEvent(timestamp, get_issuer(), this, PAJE_AddVariable, value));
 }
 
 void VariableType::sub_event(double timestamp, double value)
 {
-  events_.push_back(new VariableEvent(timestamp, issuer_, this, PAJE_SubVariable, value));
+  events_.push_back(new VariableEvent(timestamp, get_issuer(), this, PAJE_SubVariable, value));
 }
 
 void LinkType::start_event(Container* startContainer, const std::string& value, const std::string& key)
@@ -96,12 +96,12 @@ void LinkType::start_event(Container* startContainer, const std::string& value,
 
 void LinkType::start_event(Container* startContainer, const std::string& value, const std::string& key, int size)
 {
-  new LinkEvent(issuer_, this, PAJE_StartLink, startContainer, value, key, size);
+  new LinkEvent(get_issuer(), this, PAJE_StartLink, startContainer, value, key, size);
 }
 
 void LinkType::end_event(Container* endContainer, const std::string& value, const std::string& key)
 {
-  new LinkEvent(issuer_, this, PAJE_EndLink, endContainer, value, key, -1);
+  new LinkEvent(get_issuer(), this, PAJE_EndLink, endContainer, value, key, -1);
 }
 
 Type* Type::by_name(const std::string& name)
index 7d9fa60..2ce289b 100644 (file)
@@ -21,11 +21,14 @@ class Type {
   std::string name_;
   std::string color_;
   Type* father_;
+  std::map<std::string, std::unique_ptr<Type>> children_;
+  Container* issuer_ = nullptr;
+
+protected:
+  Container* get_issuer() const { return issuer_; }
 
 public:
   static xbt::signal<void(Type&, e_event_type event_type)> on_creation;
-  std::map<std::string, std::unique_ptr<Type>> children_;
-  Container* issuer_ = nullptr;
 
   Type(e_event_type event_type, const std::string& name, const std::string& alias, const std::string& color,
        Type* father);
@@ -36,6 +39,7 @@ public:
   const char* get_cname() { return name_.c_str(); }
   const std::string& get_color() const { return color_; }
   Type* get_father() const { return father_; }
+  const std::map<std::string, std::unique_ptr<Type>>& get_children() { return children_; }
   bool is_colored() { return not color_.empty(); }
 
   Type* by_name(const std::string& name);
index 7889d97..b2d214c 100644 (file)
@@ -161,7 +161,7 @@ static void recursiveNewVariableType(const std::string& new_typename, const std:
   if (root->get_name() == "LINK")
     root->by_name_or_create(std::string("b") + new_typename, color);
 
-  for (auto const& elm : root->children_) {
+  for (auto const& elm : root->get_children()) {
     recursiveNewVariableType(new_typename, color, elm.second.get());
   }
 }
@@ -177,7 +177,7 @@ static void recursiveNewUserVariableType(const std::string& father_type, const s
   if (root->get_name() == father_type) {
     root->by_name_or_create(new_typename, color);
   }
-  for (auto const& elm : root->children_)
+  for (auto const& elm : root->get_children())
     recursiveNewUserVariableType(father_type, new_typename, color, elm.second.get());
 }
 
@@ -193,7 +193,7 @@ static void recursiveNewUserStateType(const std::string& father_type, const std:
   if (root->get_name() == father_type)
     root->by_name_or_create<simgrid::instr::StateType>(new_typename);
 
-  for (auto const& elm : root->children_)
+  for (auto const& elm : root->get_children())
     recursiveNewUserStateType(father_type, new_typename, elm.second.get());
 }
 
@@ -208,7 +208,7 @@ static void recursiveNewValueForUserStateType(const std::string& type_name, cons
   if (root->get_name() == type_name)
     static_cast<simgrid::instr::StateType*>(root)->add_entity_value(val, color);
 
-  for (auto const& elm : root->children_)
+  for (auto const& elm : root->get_children())
     recursiveNewValueForUserStateType(type_name, val, color, elm.second.get());
 }
 
@@ -339,13 +339,6 @@ static void on_host_creation(s4u::Host const& host)
   }
 }
 
-static void on_host_speed_change(s4u::Host const& host)
-{
-  Container::by_name(host.get_name())
-      ->get_variable("speed")
-      ->set_event(surf_get_clock(), host.get_core_count() * host.get_available_speed());
-}
-
 static void on_action_state_change(kernel::resource::Action const& action,
                                    kernel::resource::Action::State /* previous */)
 {
@@ -369,19 +362,6 @@ static void on_action_state_change(kernel::resource::Action const& action,
   }
 }
 
-static void on_link_bandwidth_change(s4u::Link const& link)
-{
-  Container::by_name(link.get_name())
-      ->get_variable("bandwidth")
-      ->set_event(surf_get_clock(), sg_bandwidth_factor * link.get_bandwidth());
-}
-
-static void on_netpoint_creation(kernel::routing::NetPoint const& netpoint)
-{
-  if (netpoint.is_router())
-    new RouterContainer(netpoint.get_name(), currentContainer.back());
-}
-
 static void on_platform_created()
 {
   currentContainer.clear();
@@ -395,10 +375,11 @@ static void on_platform_created()
 
 static void on_actor_creation(s4u::Actor const& actor)
 {
-  const Container* root = Container::get_root();
-  Container* container  = Container::by_name(actor.get_host()->get_name());
+  const Container* root      = Container::get_root();
+  Container* container       = Container::by_name(actor.get_host()->get_name());
+  std::string container_name = instr_pid(actor);
 
-  container->create_child(instr_pid(actor), "ACTOR");
+  container->create_child(container_name, "ACTOR");
   ContainerType* actor_type = container->type_->by_name_or_create<ContainerType>("ACTOR");
   StateType* state          = actor_type->by_name_or_create<StateType>("ACTOR_STATE");
   state->add_entity_value("suspend", "1 0 1");
@@ -407,9 +388,7 @@ static void on_actor_creation(s4u::Actor const& actor)
   state->add_entity_value("send", "0 0 1");
   state->add_entity_value("execute", "0 1 1");
   root->type_->by_name_or_create("ACTOR_LINK", actor_type, actor_type);
-  root->type_->by_name_or_create("ACTOR_TASK_LINK", actor_type, actor_type);
 
-  std::string container_name = instr_pid(actor);
   actor.on_exit([container_name](bool failed) {
     if (failed)
       // kill means that this actor no longer exists, let's destroy it
@@ -456,12 +435,24 @@ void define_callbacks()
   if (TRACE_needs_platform()) {
     s4u::Engine::on_platform_created.connect(on_platform_created);
     s4u::Host::on_creation.connect(on_host_creation);
-    s4u::Host::on_speed_change.connect(on_host_speed_change);
+    s4u::Host::on_speed_change.connect([](s4u::Host const& host) {
+      Container::by_name(host.get_name())
+          ->get_variable("speed")
+          ->set_event(surf_get_clock(), host.get_core_count() * host.get_available_speed());
+    });
     s4u::Link::on_creation.connect(on_link_creation);
-    s4u::Link::on_bandwidth_change.connect(on_link_bandwidth_change);
+    s4u::Link::on_bandwidth_change.connect([](s4u::Link const& link) {
+      Container::by_name(link.get_name())
+          ->get_variable("bandwidth")
+          ->set_event(surf_get_clock(), sg_bandwidth_factor * link.get_bandwidth());
+    });
     s4u::NetZone::on_seal.connect([](s4u::NetZone const& /*netzone*/) { currentContainer.pop_back(); });
-    kernel::routing::NetPoint::on_creation.connect(on_netpoint_creation);
+    kernel::routing::NetPoint::on_creation.connect([](kernel::routing::NetPoint const& netpoint) {
+      if (netpoint.is_router())
+        new RouterContainer(netpoint.get_name(), currentContainer.back());
+    });
   }
+
   s4u::NetZone::on_creation.connect(on_netzone_creation);
 
   kernel::resource::CpuAction::on_state_change.connect(on_action_state_change);
@@ -501,6 +492,17 @@ void define_callbacks()
     s4u::Actor::on_host_change.connect(on_actor_host_change);
   }
 
+  if (TRACE_smpi_is_enabled() && TRACE_smpi_is_computing()) {
+    s4u::Exec::on_start.connect([](simgrid::s4u::Actor const& actor, s4u::Exec const& exec) {
+      Container::by_name(std::string("rank-") + std::to_string(actor.get_pid()))
+          ->get_state("MPI_STATE")
+          ->push_event("computing", new CpuTIData("compute", exec.get_cost()));
+    });
+    s4u::Exec::on_completion.connect([](s4u::Actor const& actor, s4u::Exec const&) {
+      Container::by_name(std::string("rank-") + std::to_string(actor.get_pid()))->get_state("MPI_STATE")->pop_event();
+    });
+  }
+
   if (TRACE_vm_is_enabled()) {
     s4u::Host::on_creation.connect(on_vm_creation);
     s4u::VirtualMachine::on_start.connect([](s4u::VirtualMachine const& vm) {
index a99c15f..1a9ecf9 100644 (file)
 XBT_PRIVATE container_t smpi_container(int rank);
 XBT_PRIVATE void TRACE_smpi_setup_container(int rank, const_sg_host_t host);
 
-XBT_PRIVATE void TRACE_smpi_computing_init(int rank);
-XBT_PRIVATE void TRACE_smpi_computing_out(int rank);
-XBT_PRIVATE void TRACE_smpi_computing_in(int rank, double amount);
-XBT_PRIVATE void TRACE_smpi_sleeping_init(int rank);
 XBT_PRIVATE void TRACE_smpi_sleeping_out(int rank);
 XBT_PRIVATE void TRACE_smpi_sleeping_in(int rank, double duration);
 XBT_PRIVATE void TRACE_smpi_comm_in(int rank, const char* operation, simgrid::instr::TIData* extra);
 XBT_PRIVATE void TRACE_smpi_comm_out(int rank);
 XBT_PRIVATE void TRACE_smpi_send(int rank, int src, int dst, int tag, int size);
 XBT_PRIVATE void TRACE_smpi_recv(int src, int dst, int tag);
-XBT_PRIVATE void TRACE_smpi_init(int rank);
+XBT_PRIVATE void TRACE_smpi_init(int rank, std::string calling_func);
+
 /* SMPI + LB (load balancer) */
 XBT_PRIVATE void TRACE_smpi_process_change_host(int rank, const_sg_host_t new_host);
 
index d536e0e..962dd9f 100644 (file)
@@ -53,6 +53,8 @@ class DiskImpl : public Resource, public xbt::PropertyHolder {
   s4u::Disk piface_;
   double read_bw_;
   double write_bw_;
+  lmm::Constraint* constraint_write_; /* Constraint for maximum write bandwidth*/
+  lmm::Constraint* constraint_read_;  /* Constraint for maximum write bandwidth*/
 
 public:
   DiskImpl(Model* model, const std::string& name, kernel::lmm::System* maxmin_system, double read_bw, double bwrite_bw);
@@ -63,27 +65,24 @@ public:
 
   /** @brief Public interface */
   s4u::Disk* get_iface() { return &piface_; }
+  s4u::Host* get_host() const { return host_; }
+  void set_host(s4u::Host* host) { host_ = host; }
+
   double get_read_bandwidth() { return read_bw_; }
   double get_write_bandwidth() { return write_bw_; }
+  lmm::Constraint* get_read_constraint() const { return constraint_read_; }
+  lmm::Constraint* get_write_constraint() const { return constraint_write_; }
 
   /** @brief Check if the Storage is used (if an action currently uses its resources) */
   bool is_used() override;
-
   void apply_event(profile::Event* event, double value) override;
-
   void turn_on() override;
   void turn_off() override;
 
-  s4u::Host* get_host() const { return host_; }
-  void set_host(s4u::Host* host) { host_ = host; }
-
   void destroy(); // Must be called instead of the destructor
   virtual DiskAction* io_start(sg_size_t size, s4u::Io::OpType type) = 0;
   virtual DiskAction* read(sg_size_t size)                           = 0;
   virtual DiskAction* write(sg_size_t size)                          = 0;
-
-  lmm::Constraint* constraint_write_; /* Constraint for maximum write bandwidth*/
-  lmm::Constraint* constraint_read_;  /* Constraint for maximum write bandwidth*/
 };
 
 /**********
index c9ff833..070a779 100644 (file)
@@ -65,7 +65,8 @@ protected:
 XBT_PUBLIC Checker* createLivenessChecker(Session& session);
 XBT_PUBLIC Checker* createSafetyChecker(Session& session);
 XBT_PUBLIC Checker* createCommunicationDeterminismChecker(Session& session);
-}
-}
+
+} // namespace mc
+} // namespace simgrid
 
 #endif
index 1701a28..c692e2c 100644 (file)
@@ -28,19 +28,18 @@ private:
   void prepare();
   void real_run();
   void log_state() override;
-  void deterministic_comm_pattern(int process, const simgrid::mc::PatternCommunication* comm, int backtracking);
+  void deterministic_comm_pattern(int process, const PatternCommunication* comm, int backtracking);
   void restoreState();
 
 public:
   // These are used by functions which should be moved in CommunicationDeterminismChecker:
   void get_comm_pattern(smx_simcall_t request, e_mc_call_type_t call_type, int backtracking);
-  void complete_comm_pattern(simgrid::mc::RemotePtr<simgrid::kernel::activity::CommImpl> comm_addr, unsigned int issuer,
-                             int backtracking);
+  void complete_comm_pattern(RemotePtr<kernel::activity::CommImpl> comm_addr, unsigned int issuer, int backtracking);
 
 private:
   /** Stack representing the position in the exploration graph */
-  std::list<std::unique_ptr<simgrid::mc::State>> stack_;
-  simgrid::mc::VisitedStates visited_states_;
+  std::list<std::unique_ptr<State>> stack_;
+  VisitedStates visited_states_;
   unsigned long expanded_states_count_ = 0;
 
   bool initial_communications_pattern_done = false;
@@ -49,8 +48,8 @@ private:
   char *send_diff = nullptr;
   char *recv_diff = nullptr;
 };
+} // namespace mc
+} // namespace simgrid
 
 #endif
 
-}
-}
index 678e0ee..3ce6200 100644 (file)
@@ -22,7 +22,7 @@ class XBT_PRIVATE Pair {
 public:
   int num = 0;
   bool search_cycle = false;
-  std::shared_ptr<simgrid::mc::State> graph_state = nullptr; /* System state included */
+  std::shared_ptr<State> graph_state    = nullptr; /* System state included */
   xbt_automaton_state_t automaton_state = nullptr;
   std::shared_ptr<const std::vector<int>> atomic_propositions;
   int requests = 0;
@@ -40,16 +40,14 @@ class XBT_PRIVATE VisitedPair {
 public:
   int num;
   int other_num = 0; /* Dot output for */
-  std::shared_ptr<simgrid::mc::State> graph_state = nullptr; /* System state included */
+  std::shared_ptr<State> graph_state = nullptr; /* System state included */
   xbt_automaton_state_t automaton_state;
   std::shared_ptr<const std::vector<int>> atomic_propositions;
   std::size_t heap_bytes_used = 0;
   int actors_count            = 0;
 
-  VisitedPair(
-    int pair_num, xbt_automaton_state_t automaton_state,
-    std::shared_ptr<const std::vector<int>> atomic_propositions,
-    std::shared_ptr<simgrid::mc::State> graph_state);
+  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;
 };
 
@@ -64,8 +62,8 @@ public:
 
 private:
   std::shared_ptr<const std::vector<int>> get_proposition_values();
-  std::shared_ptr<VisitedPair> insert_acceptance_pair(simgrid::mc::Pair* pair);
-  int insert_visited_pair(std::shared_ptr<VisitedPair> visited_pair, simgrid::mc::Pair* pair);
+  std::shared_ptr<VisitedPair> insert_acceptance_pair(Pair* pair);
+  int insert_visited_pair(std::shared_ptr<VisitedPair> visited_pair, Pair* pair);
   void show_acceptance_cycle(std::size_t depth);
   void replay();
   void remove_acceptance_pair(int pair_num);
@@ -85,7 +83,7 @@ private:
   std::string previous_request_;
 };
 
-}
-}
+} // namespace mc
+} // namespace simgrid
 
 #endif
index ec6ba66..0167dda 100644 (file)
@@ -20,7 +20,8 @@ namespace simgrid {
 namespace mc {
 
 class XBT_PRIVATE SafetyChecker : public Checker {
-  simgrid::mc::ReductionMode reductionMode_ = simgrid::mc::ReductionMode::unset;
+  ReductionMode reductionMode_ = ReductionMode::unset;
+
 public:
   explicit SafetyChecker(Session& session);
   ~SafetyChecker() = default;
@@ -35,13 +36,13 @@ private:
   void restore_state();
 
   /** Stack representing the position in the exploration graph */
-  std::list<std::unique_ptr<simgrid::mc::State>> stack_;
-  simgrid::mc::VisitedStates visited_states_;
-  std::unique_ptr<simgrid::mc::VisitedState> visited_state_;
+  std::list<std::unique_ptr<State>> stack_;
+  VisitedStates visited_states_;
+  std::unique_ptr<VisitedState> visited_state_;
   unsigned long expanded_states_count_ = 0;
 };
 
-}
-}
+} // namespace mc
+} // namespace simgrid
 
 #endif
index 811bbb0..c2058a9 100644 (file)
@@ -44,10 +44,10 @@ typedef std::vector<Dwarf_Op> DwarfExpression;
  */
 struct ExpressionContext {
   /** CPU state (registers) */
-  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;
+  unw_cursor_t* cursor                  = nullptr;
+  void* frame_base                      = nullptr;
+  const mc::AddressSpace* address_space = nullptr; /** Address space used to read memory */
+  mc::ObjectInformation* object_info    = nullptr;
 };
 
 /** When an error happens in the execution of a DWARF expression */
index 5494f33..30161b5 100644 (file)
@@ -55,7 +55,7 @@ public:
 
   int get_socket() const { return socket_; }
 };
-}
-}
+} // namespace mc
+} // namespace simgrid
 
 #endif
index d6b7fd6..11cf82a 100644 (file)
@@ -51,7 +51,7 @@ public:
   static Client* initialize();
   static Client* get() { return instance_.get(); }
 };
-}
-}
+} // namespace mc
+} // namespace simgrid
 
 #endif
index 6f0a1bd..6a2349b 100644 (file)
@@ -20,8 +20,8 @@ namespace mc {
 class ActorInformation {
 public:
   /** MCed address of the process */
-  RemotePtr<simgrid::kernel::actor::ActorImpl> address{nullptr};
-  Remote<simgrid::kernel::actor::ActorImpl> copy;
+  RemotePtr<kernel::actor::ActorImpl> address{nullptr};
+  Remote<kernel::actor::ActorImpl> copy;
 
   /** Hostname (owned by `mc_modelchecker->hostnames`) */
   const char* hostname = nullptr;
@@ -105,11 +105,11 @@ public:
   void clear_bytes(RemotePtr<void> address, size_t len);
 
   // Debug information:
-  std::shared_ptr<simgrid::mc::ObjectInformation> find_object_info(RemotePtr<void> addr) const;
-  std::shared_ptr<simgrid::mc::ObjectInformation> find_object_info_exec(RemotePtr<void> addr) const;
-  std::shared_ptr<simgrid::mc::ObjectInformation> find_object_info_rw(RemotePtr<void> addr) const;
-  simgrid::mc::Frame* find_function(RemotePtr<void> ip) const;
-  const simgrid::mc::Variable* find_variable(const char* name) const;
+  std::shared_ptr<ObjectInformation> find_object_info(RemotePtr<void> addr) const;
+  std::shared_ptr<ObjectInformation> find_object_info_exec(RemotePtr<void> addr) const;
+  std::shared_ptr<ObjectInformation> find_object_info_rw(RemotePtr<void> addr) const;
+  Frame* find_function(RemotePtr<void> ip) const;
+  const Variable* find_variable(const char* name) const;
 
   // Heap access:
   xbt_mheap_t get_heap()
@@ -146,7 +146,7 @@ public:
 
   void ignore_global_variable(const char* name)
   {
-    for (std::shared_ptr<simgrid::mc::ObjectInformation> const& info : this->object_infos)
+    for (std::shared_ptr<ObjectInformation> const& info : this->object_infos)
       info->remove_global_variable(name);
   }
 
@@ -158,11 +158,11 @@ public:
   void unignore_heap(void* address, size_t size);
 
   void ignore_local_variable(const char* var_name, const char* frame_name);
-  std::vector<simgrid::mc::ActorInformation>& actors();
-  std::vector<simgrid::mc::ActorInformation>& dead_actors();
+  std::vector<ActorInformation>& actors();
+  std::vector<ActorInformation>& dead_actors();
 
   /** Get a local description of a remote SIMIX actor */
-  simgrid::mc::ActorInformation* resolve_actor_info(simgrid::mc::RemotePtr<simgrid::kernel::actor::ActorImpl> actor)
+  ActorInformation* resolve_actor_info(RemotePtr<kernel::actor::ActorImpl> actor)
   {
     xbt_assert(mc_model_checker != nullptr);
     if (not actor)
@@ -178,9 +178,9 @@ public:
   }
 
   /** Get a local copy of the SIMIX actor structure */
-  simgrid::kernel::actor::ActorImpl* resolve_actor(simgrid::mc::RemotePtr<simgrid::kernel::actor::ActorImpl> process)
+  kernel::actor::ActorImpl* resolve_actor(RemotePtr<kernel::actor::ActorImpl> process)
   {
-    simgrid::mc::ActorInformation* actor_info = this->resolve_actor_info(process);
+    ActorInformation* actor_info = this->resolve_actor_info(process);
     if (actor_info)
       return actor_info->copy.get_buffer();
     else
@@ -198,7 +198,7 @@ private:
   pid_t pid_ = -1;
   Channel channel_;
   bool running_ = false;
-  std::vector<simgrid::xbt::VmMap> memory_map_;
+  std::vector<xbt::VmMap> memory_map_;
   RemotePtr<void> maestro_stack_start_;
   RemotePtr<void> maestro_stack_end_;
   int memory_file = -1;
@@ -209,9 +209,9 @@ private:
 public:
   // object info
   // TODO, make private (first, objectify simgrid::mc::ObjectInformation*)
-  std::vector<std::shared_ptr<simgrid::mc::ObjectInformation>> object_infos;
-  std::shared_ptr<simgrid::mc::ObjectInformation> libsimgrid_info;
-  std::shared_ptr<simgrid::mc::ObjectInformation> binary_info;
+  std::vector<std::shared_ptr<ObjectInformation>> object_infos;
+  std::shared_ptr<ObjectInformation> libsimgrid_info;
+  std::shared_ptr<ObjectInformation> binary_info;
 
   // Copies of MCed SMX data structures
   /** Copy of `simix_global->process_list`
@@ -278,7 +278,7 @@ public:
 /** Open a FD to a remote process memory (`/dev/$pid/mem`)
  */
 XBT_PRIVATE int open_vm(pid_t pid, int flags);
-}
-}
+} // namespace mc
+} // namespace simgrid
 
 #endif
index e3f0371..d4c7bca 100644 (file)
@@ -135,7 +135,7 @@ template <class T = void> inline RemotePtr<T> remote(uint64_t p)
 {
   return RemotePtr<T>(p);
 }
-}
-}
+} // namespace mc
+} // namespace simgrid
 
 #endif
index 5b8bb66..233297d 100644 (file)
@@ -89,8 +89,8 @@ public:
 
 private:
   void add_region(RegionType type, ObjectInformation* object_info, void* start_addr, std::size_t size);
-  void snapshot_regions(simgrid::mc::RemoteClient* process);
-  void snapshot_stacks(simgrid::mc::RemoteClient* process);
+  void snapshot_regions(RemoteClient* process);
+  void snapshot_stacks(RemoteClient* process);
 };
 } // namespace mc
 } // namespace simgrid
index 032624f..b2eefa8 100644 (file)
@@ -105,7 +105,7 @@ s4u::CommPtr Task::send_async(const std::string& alias, void_f_pvoid_t cleanup,
   if (TRACE_actor_is_enabled()) {
     container_t process_container = instr::Container::by_name(instr_pid(*MSG_process_self()));
     std::string key               = std::string("p") + std::to_string(get_id());
-    instr::Container::get_root()->get_link("ACTOR_TASK_LINK")->start_event(process_container, "SR", key);
+    instr::Container::get_root()->get_link("ACTOR_LINK")->start_event(process_container, "SR", key);
   }
 
   /* Prepare the task to send */
@@ -576,7 +576,7 @@ msg_error_t MSG_task_receive_with_timeout_bounded(msg_task_t* task, const char*
     container_t process_container = simgrid::instr::Container::by_name(instr_pid(*MSG_process_self()));
 
     std::string key = std::string("p") + std::to_string((*task)->get_id());
-    simgrid::instr::Container::get_root()->get_link("ACTOR_TASK_LINK")->end_event(process_container, "SR", key);
+    simgrid::instr::Container::get_root()->get_link("ACTOR_LINK")->end_event(process_container, "SR", key);
   }
   return ret;
 }
index 4942e65..4474227 100644 (file)
@@ -55,11 +55,21 @@ double Link::get_latency() const
   return this->pimpl_->get_latency();
 }
 
+void Link::set_latency(double value)
+{
+  kernel::actor::simcall([this, value] { pimpl_->set_latency(value); });
+}
+
 double Link::get_bandwidth() const
 {
   return this->pimpl_->get_bandwidth();
 }
 
+void Link::set_bandwidth(double value)
+{
+  kernel::actor::simcall([this, value] { pimpl_->set_bandwidth(value); });
+}
+
 Link::SharingPolicy Link::get_sharing_policy() const
 {
   return this->pimpl_->get_sharing_policy();
@@ -127,10 +137,20 @@ double sg_link_bandwidth(const_sg_link_t link)
 {
   return link->get_bandwidth();
 }
+
+void sg_link_bandwidth_set(sg_link_t link, double value)
+{
+  return link->set_bandwidth(value);
+}
+
 double sg_link_latency(const_sg_link_t link)
 {
   return link->get_latency();
 }
+void sg_link_latency_set(sg_link_t link, double value)
+{
+  return link->set_latency(value);
+}
 void* sg_link_data(const_sg_link_t link)
 {
   return link->get_data();
index 5a51587..813dce8 100644 (file)
@@ -342,11 +342,6 @@ void sg_config_init(int *argc, char **argv)
   simgrid::config::declare_flag<int>("contexts/nthreads", "Number of parallel threads used to execute user contexts", 1,
                                      &SIMIX_context_set_nthreads);
 
-  simgrid::config::declare_flag<int>("contexts/parallel-threshold",
-                                     "Minimal number of user contexts to be run in parallel (raw contexts only)", 2,
-                                     &SIMIX_context_set_parallel_threshold);
-  simgrid::config::alias("contexts/parallel-threshold", {"contexts/parallel_threshold"});
-
   /* synchronization mode for parallel user contexts */
 #if HAVE_FUTEX_H
   std::string default_synchro_mode = "futex";
index d0343dd..1365a6a 100644 (file)
@@ -50,7 +50,6 @@ static simgrid::config::Flag<std::string> context_factory_name(
 unsigned smx_context_stack_size;
 unsigned smx_context_guard_size;
 static int smx_parallel_contexts = 1;
-static int smx_parallel_threshold = 2;
 static e_xbt_parmap_mode_t smx_parallel_synchronization_mode = XBT_PARMAP_DEFAULT;
 
 /**
@@ -151,32 +150,6 @@ void SIMIX_context_set_nthreads(int nb_threads) {
   smx_parallel_contexts = nb_threads;
 }
 
-/**
- * @brief Returns the threshold above which user processes are run in parallel.
- *
- * If the number of threads is set to 1, there is no parallelism and this
- * threshold has no effect.
- *
- * @return when the number of user processes ready to run is above
- * this threshold, they are run in parallel
- */
-int SIMIX_context_get_parallel_threshold() {
-  return smx_parallel_threshold;
-}
-
-/**
- * @brief Sets the threshold above which user processes are run in parallel.
- *
- * If the number of threads is set to 1, there is no parallelism and this
- * threshold has no effect.
- *
- * @param threshold when the number of user processes ready to run is above
- * this threshold, they are run in parallel
- */
-void SIMIX_context_set_parallel_threshold(int threshold) {
-  smx_parallel_threshold = threshold;
-}
-
 /**
  * @brief Returns the synchronization mode used when processes are run in
  * parallel.
index 0b484fd..de3c35d 100644 (file)
@@ -42,11 +42,7 @@ int PMPI_Init(int*, char***)
 
   simgrid::smpi::ActorExt::init();
   int rank_traced = simgrid::s4u::this_actor::get_pid();
-  TRACE_smpi_init(rank_traced);
-  TRACE_smpi_comm_in(rank_traced, __func__, new simgrid::instr::NoOpTIData("init"));
-  TRACE_smpi_comm_out(rank_traced);
-  TRACE_smpi_computing_init(rank_traced);
-  TRACE_smpi_sleeping_init(rank_traced);
+  TRACE_smpi_init(rank_traced, __func__);
   smpi_bench_begin();
   smpi_process()->mark_as_initialized();
 
index 4c27a61..5dba5c2 100644 (file)
@@ -146,7 +146,7 @@ void TRACE_smpi_setup_container(int rank, const_sg_host_t host)
   father->create_child(std::string("rank-") + std::to_string(rank), "MPI"); // This container is of type MPI
 }
 
-void TRACE_smpi_init(int rank)
+void TRACE_smpi_init(int rank, std::string calling_func)
 {
   if (not TRACE_smpi_is_enabled())
     return;
@@ -155,6 +155,17 @@ void TRACE_smpi_init(int rank)
 
   TRACE_smpi_setup_container(rank, sg_host_self());
   simgrid::s4u::this_actor::on_exit([self](bool) { smpi_container(self->get_pid())->remove_from_parent(); });
+
+  simgrid::instr::StateType* state = smpi_container(rank)->get_state("MPI_STATE");
+
+  state->add_entity_value(calling_func, instr_find_color(calling_func.c_str()));
+  state->push_event(calling_func, new simgrid::instr::NoOpTIData("init"));
+  state->pop_event();
+  if (TRACE_smpi_is_computing())
+    state->add_entity_value("computing", instr_find_color("computing"));
+  if (TRACE_smpi_is_sleeping())
+    state->add_entity_value("sleeping", instr_find_color("sleeping"));
+
 #if HAVE_PAPI
   const simgrid::instr::Container* container = smpi_container(rank);
   papi_counter_t counters = smpi_process()->papi_counters();
@@ -169,34 +180,6 @@ void TRACE_smpi_init(int rank)
 #endif
 }
 
-void TRACE_smpi_computing_init(int rank)
-{
- //first use, initialize the color in the trace
- if (TRACE_smpi_is_enabled() && TRACE_smpi_is_computing())
-   smpi_container(rank)->get_state("MPI_STATE")->add_entity_value("computing", instr_find_color("computing"));
-}
-
-void TRACE_smpi_sleeping_init(int rank)
-{
- //first use, initialize the color in the trace
- if (TRACE_smpi_is_enabled() && TRACE_smpi_is_sleeping())
-   smpi_container(rank)->get_state("MPI_STATE")->add_entity_value("sleeping", instr_find_color("sleeping"));
-}
-
-void TRACE_smpi_computing_in(int rank, double amount)
-{
-  if (TRACE_smpi_is_enabled() && TRACE_smpi_is_computing())
-    smpi_container(rank)
-        ->get_state("MPI_STATE")
-        ->push_event("computing", new simgrid::instr::CpuTIData("compute", amount));
-}
-
-void TRACE_smpi_computing_out(int rank)
-{
-  if (TRACE_smpi_is_enabled() && TRACE_smpi_is_computing())
-    smpi_container(rank)->get_state("MPI_STATE")->pop_event();
-}
-
 void TRACE_smpi_sleeping_in(int rank, double duration)
 {
   if (TRACE_smpi_is_enabled() && TRACE_smpi_is_sleeping())
index 6eb4ab1..c28f90a 100644 (file)
@@ -47,27 +47,16 @@ void private_execute_flops(double flops) {
   smpi_switch_data_segment(simgrid::s4u::Actor::self());
 }
 
-void smpi_execute_flops(double flops) {
-  int rank     = simgrid::s4u::this_actor::get_pid();
-  TRACE_smpi_computing_in(rank, flops);
-
+void smpi_execute_flops(double flops)
+{
   private_execute_flops(flops);
-
-  TRACE_smpi_computing_out(rank);
 }
 
 void smpi_execute(double duration)
 {
   if (duration >= smpi_cfg_cpu_thresh()) {
     XBT_DEBUG("Sleep for %g to handle real computation time", duration);
-    double flops = duration * smpi_cfg_host_speed();
-    int rank     = simgrid::s4u::this_actor::get_pid();
-    TRACE_smpi_computing_in(rank, flops);
-
-    private_execute_flops(flops);
-
-    TRACE_smpi_computing_out(rank);
-
+    private_execute_flops(duration * smpi_cfg_host_speed());
   } else {
     XBT_DEBUG("Real computation took %g while option smpi/cpu-threshold is set to %g => ignore it", duration,
               smpi_cfg_cpu_thresh());
index 7ddc565..c3e32fa 100644 (file)
@@ -642,5 +642,5 @@ void smpi_mpi_init() {
 }
 
 void SMPI_thread_create() {
-  TRACE_smpi_init(simgrid::s4u::this_actor::get_pid());
+  TRACE_smpi_init(simgrid::s4u::this_actor::get_pid(), __func__);
 }
index 1cd1302..d05719e 100644 (file)
@@ -773,10 +773,7 @@ void smpi_replay_init(const char* instance_id, int rank, double start_delay_flop
 
   int my_proc_id = simgrid::s4u::this_actor::get_pid();
 
-  TRACE_smpi_init(my_proc_id);
-  TRACE_smpi_computing_init(my_proc_id);
-  TRACE_smpi_comm_in(my_proc_id, "smpi_replay_run_init", new simgrid::instr::NoOpTIData("init"));
-  TRACE_smpi_comm_out(my_proc_id);
+  TRACE_smpi_init(my_proc_id, "smpi_replay_run_init");
   xbt_replay_action_register("init", [](simgrid::xbt::ReplayAction& action) { simgrid::smpi::replay::InitAction().execute(action); });
   xbt_replay_action_register("finalize", [](simgrid::xbt::ReplayAction const&) { /* nothing to do */ });
   xbt_replay_action_register("comm_size", [](simgrid::xbt::ReplayAction& action) { simgrid::smpi::replay::CommunicatorAction().execute(action); });
index 8e849d8..66525d7 100644 (file)
@@ -96,10 +96,10 @@ DiskS19Action::DiskS19Action(Model* model, double cost, bool failed, DiskImpl* d
   model->get_maxmin_system()->expand(disk->get_constraint(), get_variable(), 1.0);
   switch (type) {
     case s4u::Io::OpType::READ:
-      model->get_maxmin_system()->expand(disk->constraint_read_, get_variable(), 1.0);
+      model->get_maxmin_system()->expand(disk->get_read_constraint(), get_variable(), 1.0);
       break;
     case s4u::Io::OpType::WRITE:
-      model->get_maxmin_system()->expand(disk->constraint_write_, get_variable(), 1.0);
+      model->get_maxmin_system()->expand(disk->get_write_constraint(), get_variable(), 1.0);
       break;
     default:
       THROW_UNIMPLEMENTED;
index 355cba0..06db516 100644 (file)
@@ -1001,7 +1001,7 @@ void surf_parse_open(const std::string& file)
 
   surf_file_to_parse = surf_fopen(file, "r");
   if (surf_file_to_parse == nullptr)
-    throw std::invalid_argument(std::string("Unable to open ')") + file + "' from '" + simgrid::xbt::Path().get_name() +
+    throw std::invalid_argument(std::string("Unable to open '") + file + "' from '" + simgrid::xbt::Path().get_name() +
                                 "'. Does this file exist?");
   surf_input_buffer = surf_parse__create_buffer(surf_file_to_parse, YY_BUF_SIZE);
   surf_parse__switch_to_buffer(surf_input_buffer);