Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'file' into 'master'
authorAugustin Degomme <adegomme@gmail.com>
Thu, 18 Apr 2019 18:19:09 +0000 (20:19 +0200)
committerAugustin Degomme <adegomme@gmail.com>
Thu, 18 Apr 2019 18:19:09 +0000 (20:19 +0200)
MPI IO

See merge request simgrid/simgrid!6

51 files changed:
examples/s4u/app-bittorrent/s4u-bittorrent.hpp
examples/s4u/app-bittorrent/s4u-peer.cpp
examples/s4u/app-bittorrent/s4u-peer.hpp
examples/s4u/app-bittorrent/s4u-tracker.cpp
examples/s4u/app-bittorrent/s4u-tracker.hpp
examples/s4u/dht-chord/s4u-dht-chord-node.cpp
examples/s4u/dht-chord/s4u-dht-chord.hpp
examples/s4u/platform-properties/s4u-platform-properties.cpp
include/simgrid/kernel/routing/DragonflyZone.hpp
include/simgrid/kernel/routing/NetZoneImpl.hpp
include/simgrid/s4u/Activity.hpp
include/simgrid/s4u/Actor.hpp
include/simgrid/s4u/Comm.hpp
include/simgrid/s4u/Host.hpp
include/simgrid/s4u/Link.hpp
include/simgrid/s4u/Mailbox.hpp
include/simgrid/s4u/NetZone.hpp
include/simgrid/s4u/Storage.hpp
include/xbt/utility.hpp
src/kernel/activity/ActivityImpl.hpp
src/kernel/activity/ConditionVariableImpl.cpp
src/kernel/activity/SynchroRaw.cpp
src/kernel/actor/ActorImpl.cpp
src/kernel/actor/ActorImpl.hpp
src/kernel/routing/ClusterZone.cpp
src/kernel/routing/DragonflyZone.cpp
src/kernel/routing/NetZoneImpl.cpp
src/msg/msg_comm.cpp
src/msg/msg_task.cpp
src/s4u/s4u_Actor.cpp
src/s4u/s4u_Comm.cpp
src/s4u/s4u_Host.cpp
src/s4u/s4u_Link.cpp
src/s4u/s4u_Netzone.cpp
src/s4u/s4u_Storage.cpp
src/simix/smx_global.cpp
src/smpi/bindings/smpi_f77.cpp
src/smpi/internals/smpi_utils.cpp
src/smpi/smpi_replay_main.cpp
src/surf/PropertyHolder.cpp
src/surf/PropertyHolder.hpp
src/surf/cpu_ti.cpp
src/surf/cpu_ti.hpp
src/surf/network_ib.cpp
src/surf/network_ib.hpp
src/surf/sg_platf.cpp
src/surf/xml/surfxml_sax_cb.cpp
src/xbt/xbt_replay.cpp
teshsuite/s4u/storage_client_server/storage_client_server.cpp
teshsuite/s4u/storage_client_server/storage_client_server.tesh
teshsuite/simdag/flatifier/flatifier.cpp

index 19551d0..b2113ca 100644 (file)
@@ -75,11 +75,11 @@ public:
       , block_length(block_length){};
   Message(e_message_type type, int peer_id, simgrid::s4u::Mailbox* return_mailbox, int piece)
       : type(type), peer_id(peer_id), return_mailbox(return_mailbox), piece(piece){};
-  ~Message() = default;
 };
 
 class HostBittorrent {
-  RngStream stream_;
+  std::unique_ptr<std::remove_pointer<RngStream>::type, std::function<void(RngStream)>> stream_ = {
+      nullptr, [](RngStream stream) { RngStream_DeleteStream(&stream); }};
   simgrid::s4u::Host* host = nullptr;
 
 public:
@@ -88,14 +88,12 @@ public:
   explicit HostBittorrent(simgrid::s4u::Host* ptr) : host(ptr)
   {
     std::string descr = std::string("RngSream<") + host->get_cname() + ">";
-    stream_           = RngStream_CreateStream(descr.c_str());
+    stream_.reset(RngStream_CreateStream(descr.c_str()));
   }
   HostBittorrent(const HostBittorrent&) = delete;
   HostBittorrent& operator=(const HostBittorrent&) = delete;
 
-  ~HostBittorrent() { RngStream_DeleteStream(&stream_); };
-
-  RngStream getStream() { return stream_; };
+  RngStream getStream() { return stream_.get(); };
 };
 
 #endif /* BITTORRENT_BITTORRENT_HPP_ */
index f28d40b..1f28b3e 100644 (file)
@@ -50,18 +50,11 @@ Peer::Peer(std::vector<std::string> args)
     bitfield_       = (1U << FILE_PIECES) - 1U;
     bitfield_blocks = (1ULL << (FILE_PIECES * PIECES_BLOCKS)) - 1ULL;
   }
-  pieces_count = new short[FILE_PIECES]{0};
+  pieces_count.resize(FILE_PIECES);
 
   XBT_INFO("Hi, I'm joining the network with id %d", id);
 }
 
-Peer::~Peer()
-{
-  for (auto const& peer : connected_peers)
-    delete peer.second;
-  delete[] pieces_count;
-}
-
 /** Peer main function */
 void Peer::operator()()
 {
@@ -100,9 +93,9 @@ bool Peer::getPeersFromTracker()
   try {
     TrackerAnswer* answer = static_cast<TrackerAnswer*>(mailbox_->get(GET_PEERS_TIMEOUT));
     // Add the peers the tracker gave us to our peer list.
-    for (auto const& peer_id : *answer->getPeers())
+    for (auto const& peer_id : answer->getPeers())
       if (id != peer_id)
-        connected_peers[peer_id] = new Connection(peer_id);
+        connected_peers.emplace(peer_id, Connection(peer_id));
     delete answer;
   } catch (simgrid::TimeoutError& e) {
     XBT_DEBUG("Timeout expired when requesting peers to tracker");
@@ -114,10 +107,10 @@ bool Peer::getPeersFromTracker()
 void Peer::sendHandshakeToAllPeers()
 {
   for (auto const& kv : connected_peers) {
-    Connection* remote_peer = kv.second;
+    const Connection& remote_peer = kv.second;
     Message* handshake      = new Message(MESSAGE_HANDSHAKE, id, mailbox_);
-    remote_peer->mailbox_->put_init(handshake, MESSAGE_HANDSHAKE_SIZE)->detach();
-    XBT_DEBUG("Sending a HANDSHAKE to %d", remote_peer->id);
+    remote_peer.mailbox_->put_init(handshake, MESSAGE_HANDSHAKE_SIZE)->detach();
+    XBT_DEBUG("Sending a HANDSHAKE to %d", remote_peer.id);
   }
 }
 
@@ -148,8 +141,8 @@ void Peer::sendHaveToAllPeers(unsigned int piece)
 {
   XBT_DEBUG("Sending HAVE message to all my peers");
   for (auto const& kv : connected_peers) {
-    Connection* remote_peer = kv.second;
-    remote_peer->mailbox_->put_init(new Message(MESSAGE_HAVE, id, mailbox_, piece), MESSAGE_HAVE_SIZE)->detach();
+    const Connection& remote_peer = kv.second;
+    remote_peer.mailbox_->put_init(new Message(MESSAGE_HAVE, id, mailbox_, piece), MESSAGE_HAVE_SIZE)->detach();
   }
 }
 
@@ -217,7 +210,7 @@ int Peer::nbInterestedPeers()
 {
   int nb = 0;
   for (auto const& kv : connected_peers)
-    if (kv.second->interested)
+    if (kv.second.interested)
       nb++;
   return nb;
 }
@@ -298,7 +291,7 @@ void Peer::handleMessage()
   XBT_DEBUG("Received a %s message from %s", type_names[message->type], message->return_mailbox->get_cname());
 
   auto known_peer         = connected_peers.find(message->peer_id);
-  Connection* remote_peer = (known_peer == connected_peers.end()) ? nullptr : known_peer->second;
+  Connection* remote_peer = (known_peer == connected_peers.end()) ? nullptr : &known_peer->second;
   xbt_assert(remote_peer != nullptr || message->type == MESSAGE_HANDSHAKE,
              "The impossible did happened: A not-in-our-list peer sent us a message.");
 
@@ -307,7 +300,7 @@ void Peer::handleMessage()
       // Check if the peer is in our connection list.
       if (remote_peer == nullptr) {
         XBT_DEBUG("This peer %d was unknown, answer to its handshake", message->peer_id);
-        connected_peers[message->peer_id] = new Connection(message->peer_id);
+        connected_peers.emplace(message->peer_id, Connection(message->peer_id));
         sendMessage(message->return_mailbox, MESSAGE_HANDSHAKE, MESSAGE_HANDSHAKE_SIZE);
       }
       // Send our bitfield to the peer
@@ -551,13 +544,12 @@ void Peer::updateChokedPeers()
 
   /**If we are currently seeding, we unchoke the peer which has been unchoked the last time.*/
   if (hasFinished()) {
-    Connection* remote_peer;
     double unchoke_time = simgrid::s4u::Engine::get_clock() + 1;
-    for (auto const& kv : connected_peers) {
-      remote_peer = kv.second;
-      if (remote_peer->last_unchoke < unchoke_time && remote_peer->interested && remote_peer->choked_upload) {
-        unchoke_time = remote_peer->last_unchoke;
-        chosen_peer  = remote_peer;
+    for (auto& kv : connected_peers) {
+      Connection& remote_peer = kv.second;
+      if (remote_peer.last_unchoke < unchoke_time && remote_peer.interested && remote_peer.choked_upload) {
+        unchoke_time = remote_peer.last_unchoke;
+        chosen_peer  = &remote_peer;
       }
     }
   } else {
@@ -566,12 +558,10 @@ void Peer::updateChokedPeers()
       int j = 0;
       do {
         // We choose a random peer to unchoke.
-        std::unordered_map<int, Connection*>::iterator chosen_peer_it = connected_peers.begin();
+        std::unordered_map<int, Connection>::iterator chosen_peer_it = connected_peers.begin();
         std::advance(chosen_peer_it, RngStream_RandInt(stream, 0, connected_peers.size() - 1));
-        chosen_peer = chosen_peer_it->second;
-        if (chosen_peer == nullptr)
-          THROWF(unknown_error, 0, "A peer should have be selected at this point");
-        else if (not chosen_peer->interested || not chosen_peer->choked_upload)
+        chosen_peer = &chosen_peer_it->second;
+        if (not chosen_peer->interested || not chosen_peer->choked_upload)
           chosen_peer = nullptr;
         else
           XBT_DEBUG("Nothing to do, keep going");
@@ -580,11 +570,11 @@ void Peer::updateChokedPeers()
     } else {
       // Use the "fastest download" policy.
       double fastest_speed = 0.0;
-      for (auto const& kv : connected_peers) {
-        Connection* remote_peer = kv.second;
-        if (remote_peer->peer_speed > fastest_speed && remote_peer->choked_upload && remote_peer->interested) {
-          chosen_peer   = remote_peer;
-          fastest_speed = remote_peer->peer_speed;
+      for (auto& kv : connected_peers) {
+        Connection& remote_peer = kv.second;
+        if (remote_peer.peer_speed > fastest_speed && remote_peer.choked_upload && remote_peer.interested) {
+          fastest_speed = remote_peer.peer_speed;
+          chosen_peer   = &remote_peer;
         }
       }
     }
@@ -617,20 +607,20 @@ void Peer::updateChokedPeers()
 /** @brief Update "interested" state of peers: send "not interested" to peers that don't have any more pieces we want.*/
 void Peer::updateInterestedAfterReceive()
 {
-  for (auto const& kv : connected_peers) {
-    Connection* remote_peer = kv.second;
-    if (remote_peer->am_interested) {
+  for (auto& kv : connected_peers) {
+    Connection& remote_peer = kv.second;
+    if (remote_peer.am_interested) {
       bool interested = false;
       // Check if the peer still has a piece we want.
       for (unsigned int i = 0; i < FILE_PIECES; i++)
-        if (hasNotPiece(i) && remote_peer->hasPiece(i)) {
+        if (hasNotPiece(i) && remote_peer.hasPiece(i)) {
           interested = true;
           break;
         }
 
       if (not interested) { // no more piece to download from connection
-        remote_peer->am_interested = false;
-        sendMessage(remote_peer->mailbox_, MESSAGE_NOTINTERESTED, MESSAGE_NOTINTERESTED_SIZE);
+        remote_peer.am_interested = false;
+        sendMessage(remote_peer.mailbox_, MESSAGE_NOTINTERESTED, MESSAGE_NOTINTERESTED_SIZE);
       }
     }
   }
index 2737649..fa0418d 100644 (file)
@@ -24,7 +24,6 @@ public:
   bool choked_download = true;  // Indicates if the peer has choked the current peer
 
   explicit Connection(int id) : id(id), mailbox_(simgrid::s4u::Mailbox::by_name(std::to_string(id))){};
-  ~Connection() = default;
   void addSpeedValue(double speed) { peer_speed = peer_speed * 0.6 + speed * 0.4; }
   bool hasPiece(unsigned int piece) { return bitfield & 1U << piece; }
 };
@@ -34,12 +33,12 @@ class Peer {
   double deadline;
   RngStream stream;
   simgrid::s4u::Mailbox* mailbox_;
-  std::unordered_map<int, Connection*> connected_peers;
+  std::unordered_map<int, Connection> connected_peers;
   std::set<Connection*> active_peers; // active peers list
 
   unsigned int bitfield_             = 0;       // list of pieces the peer has.
   unsigned long long bitfield_blocks = 0;       // list of blocks the peer has.
-  short* pieces_count                = nullptr; // number of peers that have each piece.
+  std::vector<short> pieces_count;              // number of peers that have each piece.
   unsigned int current_pieces        = 0;       // current pieces the peer is downloading
   double begin_receive_time = 0; // time when the receiving communication has begun, useful for calculating host speed.
   int round_                = 0; // current round for the chocking algorithm.
@@ -50,7 +49,6 @@ public:
   explicit Peer(std::vector<std::string> args);
   Peer(const Peer&) = delete;
   Peer& operator=(const Peer&) = delete;
-  ~Peer();
   void operator()();
 
   std::string getStatus();
index 4e41ae8..f51e55d 100644 (file)
@@ -56,7 +56,7 @@ void Tracker::operator()()
         do {
           next_peer = known_peers.begin();
           std::advance(next_peer, RngStream_RandInt(stream, 0, nb_known_peers - 1));
-        } while (ta->getPeers()->find(*next_peer) != ta->getPeers()->end());
+        } while (ta->getPeers().find(*next_peer) != ta->getPeers().end());
         ta->addPeer(*next_peer);
         tried++;
       }
index 4755919..d4af5d6 100644 (file)
@@ -17,21 +17,17 @@ class TrackerQuery {
 public:
   explicit TrackerQuery(int peer_id, simgrid::s4u::Mailbox* return_mailbox)
       : peer_id(peer_id), return_mailbox(return_mailbox){};
-  ~TrackerQuery() = default;
   int getPeerId() { return peer_id; }
   simgrid::s4u::Mailbox* getReturnMailbox() { return return_mailbox; }
 };
 
 class TrackerAnswer {
   // int interval; // how often the peer should contact the tracker (unused for now)
-  std::set<int>* peers; // the peer list the peer has asked for.
+  std::set<int> peers; // the peer list the peer has asked for.
 public:
-  explicit TrackerAnswer(int /*interval*/) /*: interval(interval)*/ { peers = new std::set<int>; }
-  TrackerAnswer(const TrackerAnswer&)                                       = delete;
-  TrackerAnswer& operator=(const TrackerAnswer&) = delete;
-  ~TrackerAnswer() { delete peers; };
-  void addPeer(int peer) { peers->insert(peer); }
-  std::set<int>* getPeers() { return peers; }
+  explicit TrackerAnswer(int /*interval*/) /*: interval(interval)*/ {}
+  void addPeer(int peer) { peers.insert(peer); }
+  const std::set<int>& getPeers() { return peers; }
 };
 
 class Tracker {
index f69461b..833f3eb 100644 (file)
@@ -55,11 +55,7 @@ Node::Node(std::vector<std::string> args)
   stream             = simgrid::s4u::this_actor::get_host()->extension<HostChord>()->getStream();
   mailbox_           = simgrid::s4u::Mailbox::by_name(std::to_string(id_));
   next_finger_to_fix = 0;
-  fingers_           = new int[nb_bits];
-
-  for (int i = 0; i < nb_bits; i++) {
-    fingers_[i] = id_;
-  }
+  fingers_.resize(nb_bits, id_);
 
   if (args.size() == 3) { // first ring
     deadline_   = std::stod(args[2]);
@@ -74,10 +70,6 @@ Node::Node(std::vector<std::string> args)
   }
 }
 
-Node::~Node()
-{
-  delete[] fingers_;
-}
 /* Makes the current node join the ring, knowing the id of a node already in the ring
  *
  * @param known_id id of a node already in the ring
index ba0ac1f..12b6921 100644 (file)
@@ -22,7 +22,8 @@ extern int nb_keys;
 extern int timeout;
 
 class HostChord {
-  RngStream stream_;
+  std::unique_ptr<std::remove_pointer<RngStream>::type, std::function<void(RngStream)>> stream_ = {
+      nullptr, [](RngStream stream) { RngStream_DeleteStream(&stream); }};
   simgrid::s4u::Host* host = nullptr;
 
 public:
@@ -31,14 +32,12 @@ public:
   explicit HostChord(simgrid::s4u::Host* ptr) : host(ptr)
   {
     std::string descr = std::string("RngSream<") + host->get_cname() + ">";
-    stream_           = RngStream_CreateStream(descr.c_str());
+    stream_.reset(RngStream_CreateStream(descr.c_str()));
   }
   HostChord(const HostChord&) = delete;
   HostChord& operator=(const HostChord&) = delete;
 
-  ~HostChord() { RngStream_DeleteStream(&stream_); };
-
-  RngStream getStream() { return stream_; };
+  RngStream getStream() { return stream_.get(); };
 };
 
 /* Types of tasks exchanged between nodes. */
@@ -68,8 +67,6 @@ public:
   {
   }
 
-  ~ChordMessage() = default;
-
   static void destroy(void* message);
 };
 
@@ -81,7 +78,7 @@ class Node {
   int id_;                           // my id
   int pred_id_ = -1;                 // predecessor id
   simgrid::s4u::Mailbox* mailbox_;   // my mailbox
-  int* fingers_;                     // finger table,(fingers[0] is my successor)
+  std::vector<int> fingers_;         // finger table,(fingers[0] is my successor)
   int next_finger_to_fix;            // index of the next finger to fix in fix_fingers()
   RngStream stream;
 
@@ -89,7 +86,6 @@ public:
   explicit Node(std::vector<std::string> args);
   Node(const Node&) = delete;
   Node& operator=(const Node&) = delete;
-  ~Node();
   void join(int known_id);
   void leave();
   void notifyAndQuit();
index fe49596..e85410a 100644 (file)
@@ -14,7 +14,7 @@ XBT_LOG_NEW_DEFAULT_CATEGORY(s4u_test, "Property test");
 static void test_host(const std::string& hostname)
 {
   simgrid::s4u::Host* thehost = simgrid::s4u::Host::by_name(hostname);
-  std::unordered_map<std::string, std::string>* props = thehost->get_properties();
+  const std::unordered_map<std::string, std::string>* props = thehost->get_properties();
   const char* noexist = "Unknown";
   const char* exist   = "Hdd";
   const char* value;
@@ -81,7 +81,7 @@ static void bob(std::vector<std::string> /*args*/)
   XBT_INFO("   Zone property: author -> %s", root->get_property("author"));
 
   /* Get the property list of current bob process */
-  std::unordered_map<std::string, std::string>* props = simgrid::s4u::Actor::self()->get_properties();
+  const std::unordered_map<std::string, std::string>* props = simgrid::s4u::Actor::self()->get_properties();
   const char* noexist = "UnknownProcessProp";
   XBT_ATTRIB_UNUSED const char* value;
 
index f805299..9144e16 100644 (file)
@@ -18,14 +18,11 @@ public:
   unsigned int group_;
   unsigned int chassis_;
   unsigned int blade_;
-  resource::LinkImpl** blue_links_  = nullptr;
-  resource::LinkImpl** black_links_ = nullptr;
-  resource::LinkImpl** green_links_ = nullptr;
-  resource::LinkImpl** my_nodes_    = nullptr;
-  DragonflyRouter(int i, int j, int k);
-  DragonflyRouter(const DragonflyRouter&) = delete;
-  DragonflyRouter& operator=(const DragonflyRouter&) = delete;
-  ~DragonflyRouter();
+  resource::LinkImpl* blue_link_ = nullptr;
+  std::vector<resource::LinkImpl*> black_links_;
+  std::vector<resource::LinkImpl*> green_links_;
+  std::vector<resource::LinkImpl*> my_nodes_;
+  DragonflyRouter(unsigned group, unsigned chassis, unsigned blade) : group_(group), chassis_(chassis), blade_(blade) {}
 };
 
 /** @ingroup ROUTING_API
@@ -64,9 +61,6 @@ public:
 class XBT_PUBLIC DragonflyZone : public ClusterZone {
 public:
   explicit DragonflyZone(NetZoneImpl* father, const std::string& name, resource::NetworkModel* netmodel);
-  DragonflyZone(const DragonflyZone&) = delete;
-  DragonflyZone& operator=(const DragonflyZone&) = delete;
-  ~DragonflyZone() override;
   //      void create_links_for_node(sg_platf_cluster_cbarg_t cluster, int id, int rank, int position) override;
   void get_local_route(NetPoint* src, NetPoint* dst, RouteCreationArgs* into, double* latency) override;
   void parse_specific_arguments(ClusterCreationArgs* cluster) override;
@@ -91,7 +85,7 @@ private:
   unsigned int num_links_black_        = 0;
   unsigned int num_links_blue_         = 0;
   unsigned int num_links_per_link_     = 1; // splitduplex -> 2, only for local link
-  DragonflyRouter** routers_        = nullptr;
+  std::vector<DragonflyRouter> routers_;
 };
 } // namespace routing
 } // namespace kernel
index eaad97d..ef9b53c 100644 (file)
@@ -61,7 +61,7 @@ public:
 
   /** @brief Make a host within that NetZone */
   simgrid::s4u::Host* create_host(const char* name, const std::vector<double>& speed_per_pstate, int core_count,
-                                  std::map<std::string, std::string>* props);
+                                  const std::map<std::string, std::string>* props);
   /** @brief Creates a new route in this NetZone */
   virtual void add_bypass_route(NetPoint* src, NetPoint* dst, NetPoint* gw_src, NetPoint* gw_dst,
                                 std::vector<resource::LinkImpl*>& link_list, bool symmetrical);
index 8d123ef..de5b14a 100644 (file)
@@ -92,7 +92,7 @@ public:
   /** Retrieve the user data of the Activity */
   void* get_user_data() { return user_data_; }
 
-  kernel::activity::ActivityImplPtr get_impl() { return pimpl_; }
+  kernel::activity::ActivityImpl* get_impl() const { return pimpl_.get(); }
 
 #ifndef DOXYGEN
   XBT_ATTRIB_DEPRECATED_v324("Please use Activity::wait_for()") virtual void wait(double timeout) = 0;
index 7bde9ca..8e48a17 100644 (file)
@@ -142,7 +142,7 @@ public:
 
   // ***** Actor creation *****
   /** Retrieve a reference to myself */
-  static ActorPtr self();
+  static Actor* self();
 
   /** Signal to others that a new actor has been created **/
   static xbt::signal<void(Actor&)> on_creation;
@@ -289,7 +289,7 @@ public:
   kernel::actor::ActorImpl* get_impl() const { return pimpl_; }
 
   /** Retrieve the property value (or nullptr if not set) */
-  std::unordered_map<std::string, std::string>*
+  const std::unordered_map<std::string, std::string>*
   get_properties() const; // FIXME: do not export the map, but only the keys or something
   const char* get_property(const std::string& key) const;
   void set_property(const std::string& key, const std::string& value);
index ae59d15..d82a019 100644 (file)
@@ -119,7 +119,7 @@ public:
   /** Retrieve the size of the received data. Not to be mixed with @ref Activity::set_remaining()  */
   size_t get_dst_data_size();
 
-  s4u::ActorPtr get_sender();
+  Actor* get_sender();
 
 #ifndef DOXYGEN
   XBT_ATTRIB_DEPRECATED_v324("Please use Comm::wait_for()") void wait(double t) override { wait_for(t); }
index ea0afe0..48870a8 100644 (file)
@@ -99,7 +99,8 @@ public:
 
   const char* get_property(const std::string& key) const;
   void set_property(const std::string& key, const std::string& value);
-  std::unordered_map<std::string, std::string>* get_properties();
+  const std::unordered_map<std::string, std::string>* get_properties() const;
+  void set_properties(const std::map<std::string, std::string>& properties);
 
   void set_state_profile(kernel::profile::Profile* p);
   void set_speed_profile(kernel::profile::Profile* p);
index 4a1189d..85b5e1e 100644 (file)
@@ -33,7 +33,7 @@ class XBT_PUBLIC Link : public xbt::Extendable<Link> {
 public:
   enum class SharingPolicy { SPLITDUPLEX = 2, SHARED = 1, FATPIPE = 0 };
 
-  kernel::resource::LinkImpl* get_impl() { return pimpl_; }
+  kernel::resource::LinkImpl* get_impl() const { return pimpl_; }
 
   /** @brief Retrieve a link from its name */
   static Link* by_name(const std::string& name);
@@ -93,7 +93,7 @@ public:
    * The profile must contain absolute values */
   void set_latency_profile(kernel::profile::Profile* profile);
 
-  const char* get_property(const std::string& key);
+  const char* get_property(const std::string& key) const;
   void set_property(const std::string& key, const std::string& value);
 
   /* The signals */
index 069618a..faffc35 100644 (file)
@@ -26,7 +26,7 @@ class XBT_PUBLIC Mailbox {
 
 public:
   /** private function, do not use. FIXME: make me protected */
-  kernel::activity::MailboxImpl* get_impl() { return pimpl_; }
+  kernel::activity::MailboxImpl* get_impl() const { return pimpl_; }
 
   /** @brief Retrieves the name of that mailbox as a C++ string */
   const xbt::string& get_name() const;
index 0ba5c13..e41fed0 100644 (file)
@@ -41,7 +41,7 @@ public:
   std::vector<Host*> get_all_hosts();
   int get_host_count();
 
-  kernel::routing::NetZoneImpl* get_impl() { return pimpl_; }
+  kernel::routing::NetZoneImpl* get_impl() const { return pimpl_; }
 
 private:
   kernel::routing::NetZoneImpl* const pimpl_;
@@ -49,12 +49,12 @@ private:
 
 public:
   /** Get the properties assigned to a netzone */
-  std::unordered_map<std::string, std::string>* get_properties();
+  const std::unordered_map<std::string, std::string>* get_properties() const;
 
   std::vector<NetZone*> get_children();
 
   /** Retrieve the property value (or nullptr if not set) */
-  const char* get_property(const std::string& key);
+  const char* get_property(const std::string& key) const;
   void set_property(const std::string& key, const std::string& value);
 
   /* Add content to the netzone, at parsing time. It should be sealed afterward. */
index dce77c5..9bfa5ad 100644 (file)
@@ -56,8 +56,8 @@ public:
   Host* get_host() { return attached_to_; };
   void set_host(Host* host) { attached_to_ = host; }
 
-  std::unordered_map<std::string, std::string>* get_properties();
-  const char* get_property(const std::string& key);
+  const std::unordered_map<std::string, std::string>* get_properties() const;
+  const char* get_property(const std::string& key) const;
   void set_property(const std::string&, const std::string& value);
 
   void set_data(void* data) { userdata_ = data; }
@@ -70,7 +70,7 @@ public:
 
   IoPtr write_async(sg_size_t size);
   sg_size_t write(sg_size_t size);
-  kernel::resource::StorageImpl* get_impl() { return pimpl_; }
+  kernel::resource::StorageImpl* get_impl() const { return pimpl_; }
 
 private:
   Host* attached_to_ = nullptr;
index 84c282e..2a2c382 100644 (file)
@@ -57,10 +57,6 @@ template <class List, class Elem> inline void intrusive_erase(List& list, Elem&
  */
 template<class T, T... N>
 class integer_sequence {
-  static constexpr std::size_t size()
-  {
-    return std::tuple_size<decltype(std::make_tuple(N...))>::value;
-  }
 };
 
 namespace bits {
index d99f965..d8d5914 100644 (file)
@@ -36,7 +36,7 @@ public:
   virtual void finish() = 0;
 
   virtual void register_simcall(smx_simcall_t simcall);
-  virtual void clean_action();
+  void clean_action();
   virtual double get_remaining() const;
   // boost::intrusive_ptr<ActivityImpl> support:
   friend XBT_PUBLIC void intrusive_ptr_add_ref(ActivityImpl* activity);
index 18d1197..c29e907 100644 (file)
@@ -89,9 +89,6 @@ void ConditionVariableImpl::broadcast()
 
 void ConditionVariableImpl::wait(smx_mutex_t mutex, double timeout, actor::ActorImpl* issuer, smx_simcall_t simcall)
 {
-  XBT_IN("(%p, %p, %f, %p,%p)", this, mutex, timeout, issuer, simcall);
-  RawImplPtr synchro = nullptr;
-
   XBT_DEBUG("Wait condition %p", this);
 
   /* If there is a mutex unlock it */
@@ -101,12 +98,11 @@ void ConditionVariableImpl::wait(smx_mutex_t mutex, double timeout, actor::Actor
     mutex->unlock(issuer);
   }
 
-  synchro = RawImplPtr(new RawImpl());
+  RawImplPtr synchro(new RawImpl());
   (*synchro).set_host(issuer->get_host()).set_timeout(timeout).start();
   synchro->simcalls_.push_front(simcall);
-  issuer->waiting_synchro = synchro;
+  issuer->waiting_synchro = std::move(synchro);
   sleeping_.push_back(*simcall->issuer);
-  XBT_OUT();
 }
 
 // boost::intrusive_ptr<ConditionVariableImpl> support:
index de052c1..facb9d0 100644 (file)
@@ -73,9 +73,7 @@ void RawImpl::finish()
     XBT_DEBUG("RawImpl::finish(): host '%s' failed", simcall->issuer->get_host()->get_cname());
     simcall->issuer->context_->iwannadie = true;
     simcall->issuer->exception_ = std::make_exception_ptr(HostFailureException(XBT_THROW_POINT, "Host failed"));
-  } else if (state_ == SIMIX_SRC_TIMEOUT) {
-    simcall->issuer->exception_ = std::make_exception_ptr(TimeoutError(XBT_THROW_POINT, "Synchronization timeout"));
-  } else {
+  } else if (state_ != SIMIX_SRC_TIMEOUT) {
     xbt_die("Internal error in RawImpl::finish() unexpected synchro state %d", static_cast<int>(state_));
   }
 
index cce43fc..8b3f02d 100644 (file)
@@ -70,7 +70,7 @@ ActorImpl::~ActorImpl() = default;
  */
 
 ActorImplPtr ActorImpl::attach(const std::string& name, void* data, s4u::Host* host,
-                               std::unordered_map<std::string, std::string>* properties)
+                               const std::unordered_map<std::string, std::string>* properties)
 {
   // This is mostly a copy/paste from create(), it'd be nice to share some code between those two functions.
 
@@ -93,8 +93,7 @@ ActorImplPtr ActorImpl::attach(const std::string& name, void* data, s4u::Host* h
 
   /* Add properties */
   if (properties != nullptr)
-    for (auto const& kv : *properties)
-      actor->set_property(kv.first, kv.second);
+    actor->set_properties(*properties);
 
   /* Add the process to it's host process list */
   host->pimpl_->process_list_.push_back(*actor);
@@ -472,7 +471,7 @@ ActorImpl* ActorImpl::start(const simix::ActorCode& code)
 }
 
 ActorImplPtr ActorImpl::create(const std::string& name, const simix::ActorCode& code, void* data, s4u::Host* host,
-                               std::unordered_map<std::string, std::string>* properties, ActorImpl* parent_actor)
+                               const std::unordered_map<std::string, std::string>* properties, ActorImpl* parent_actor)
 {
   XBT_DEBUG("Start actor %s@'%s'", name.c_str(), host->get_cname());
 
@@ -487,8 +486,7 @@ ActorImplPtr ActorImpl::create(const std::string& name, const simix::ActorCode&
 
   /* Add properties */
   if (properties != nullptr)
-    for (auto const& kv : *properties)
-      actor->set_property(kv.first, kv.second);
+    actor->set_properties(*properties);
 
   actor->start(code);
 
index c6324ec..a1d027f 100644 (file)
@@ -105,9 +105,9 @@ public:
   ActorImpl* start(const simix::ActorCode& code);
 
   static ActorImplPtr create(const std::string& name, const simix::ActorCode& code, void* data, s4u::Host* host,
-                             std::unordered_map<std::string, std::string>* properties, ActorImpl* parent_actor);
+                             const std::unordered_map<std::string, std::string>* properties, ActorImpl* parent_actor);
   static ActorImplPtr attach(const std::string& name, void* data, s4u::Host* host,
-                             std::unordered_map<std::string, std::string>* properties);
+                             const std::unordered_map<std::string, std::string>* properties);
   static void detach();
   void cleanup();
   void exit();
@@ -133,7 +133,7 @@ public:
   void* data                                                               = nullptr;
   s4u::Host* host                                                          = nullptr;
   double kill_time                                                         = 0.0;
-  std::shared_ptr<std::unordered_map<std::string, std::string>> properties = nullptr;
+  std::shared_ptr<const std::unordered_map<std::string, std::string>> properties = nullptr;
   bool auto_restart                                                        = false;
   bool daemon_                                                             = false;
   ProcessArg()                                                             = default;
index 021eddd..e49e486 100644 (file)
@@ -29,12 +29,14 @@ void ClusterZone::get_local_route(NetPoint* src, NetPoint* dst, RouteCreationArg
              "Cluster routing: no links attached to the source node - did you use host_link tag?");
 
   if ((src->id() == dst->id()) && has_loopback_) {
-    xbt_assert(not src->is_router(), "Routing from a cluster private router to itself is meaningless");
-
-    std::pair<resource::LinkImpl*, resource::LinkImpl*> info = private_links_.at(node_pos(src->id()));
-    route->link_list.push_back(info.first);
-    if (lat)
-      *lat += info.first->get_latency();
+    if (src->is_router()) {
+      XBT_WARN("Routing from a cluster private router to itself is meaningless");
+    } else {
+      std::pair<resource::LinkImpl*, resource::LinkImpl*> info = private_links_.at(node_pos(src->id()));
+      route->link_list.push_back(info.first);
+      if (lat)
+        *lat += info.first->get_latency();
+    }
     return;
   }
 
index 68235e4..911f950 100644 (file)
@@ -23,15 +23,6 @@ DragonflyZone::DragonflyZone(NetZoneImpl* father, const std::string& name, resou
 {
 }
 
-DragonflyZone::~DragonflyZone()
-{
-  if (this->routers_ != nullptr) {
-    for (unsigned int i = 0; i < this->num_groups_ * this->num_chassis_per_group_ * this->num_blades_per_chassis_; i++)
-      delete routers_[i];
-    delete[] routers_;
-  }
-}
-
 void DragonflyZone::rankId_to_coords(int rankId, unsigned int coords[4])
 {
   // coords : group, chassis, blade, node
@@ -132,32 +123,13 @@ void DragonflyZone::seal()
   this->generate_links();
 }
 
-DragonflyRouter::DragonflyRouter(int group, int chassis, int blade) : group_(group), chassis_(chassis), blade_(blade)
-{
-}
-
-DragonflyRouter::~DragonflyRouter()
-{
-  delete[] my_nodes_;
-  delete[] green_links_;
-  delete[] black_links_;
-  delete blue_links_;
-}
-
 void DragonflyZone::generate_routers()
 {
-  this->routers_ =
-      new DragonflyRouter*[this->num_groups_ * this->num_chassis_per_group_ * this->num_blades_per_chassis_];
-
-  for (unsigned int i = 0; i < this->num_groups_; i++) {
-    for (unsigned int j = 0; j < this->num_chassis_per_group_; j++) {
-      for (unsigned int k = 0; k < this->num_blades_per_chassis_; k++) {
-        DragonflyRouter* router = new DragonflyRouter(i, j, k);
-        this->routers_[i * this->num_chassis_per_group_ * this->num_blades_per_chassis_ +
-                       j * this->num_blades_per_chassis_ + k] = router;
-      }
-    }
-  }
+  this->routers_.reserve(this->num_groups_ * this->num_chassis_per_group_ * this->num_blades_per_chassis_);
+  for (unsigned int i = 0; i < this->num_groups_; i++)
+    for (unsigned int j = 0; j < this->num_chassis_per_group_; j++)
+      for (unsigned int k = 0; k < this->num_blades_per_chassis_; k++)
+        this->routers_.emplace_back(i, j, k);
 }
 
 void DragonflyZone::create_link(const std::string& id, int numlinks, resource::LinkImpl** linkup,
@@ -194,18 +166,18 @@ void DragonflyZone::generate_links()
   // Links from routers to their local nodes.
   for (unsigned int i = 0; i < numRouters; i++) {
     // allocate structures
-    this->routers_[i]->my_nodes_    = new resource::LinkImpl*[num_links_per_link_ * this->num_nodes_per_blade_];
-    this->routers_[i]->green_links_ = new resource::LinkImpl*[this->num_blades_per_chassis_];
-    this->routers_[i]->black_links_ = new resource::LinkImpl*[this->num_chassis_per_group_];
+    this->routers_[i].my_nodes_.resize(num_links_per_link_ * this->num_nodes_per_blade_);
+    this->routers_[i].green_links_.resize(this->num_blades_per_chassis_);
+    this->routers_[i].black_links_.resize(this->num_chassis_per_group_);
 
     for (unsigned int j = 0; j < num_links_per_link_ * this->num_nodes_per_blade_; j += num_links_per_link_) {
       std::string id = "local_link_from_router_" + std::to_string(i) + "_to_node_" +
                        std::to_string(j / num_links_per_link_) + "_" + std::to_string(uniqueId);
       this->create_link(id, 1, &linkup, &linkdown);
 
-      this->routers_[i]->my_nodes_[j] = linkup;
+      this->routers_[i].my_nodes_[j] = linkup;
       if (this->sharing_policy_ == s4u::Link::SharingPolicy::SPLITDUPLEX)
-        this->routers_[i]->my_nodes_[j + 1] = linkdown;
+        this->routers_[i].my_nodes_[j + 1] = linkdown;
 
       uniqueId++;
     }
@@ -219,8 +191,8 @@ void DragonflyZone::generate_links()
                          std::to_string(j) + "_and_" + std::to_string(k) + "_" + std::to_string(uniqueId);
         this->create_link(id, this->num_links_green_, &linkup, &linkdown);
 
-        this->routers_[i * num_blades_per_chassis_ + j]->green_links_[k] = linkup;
-        this->routers_[i * num_blades_per_chassis_ + k]->green_links_[j] = linkdown;
+        this->routers_[i * num_blades_per_chassis_ + j].green_links_[k] = linkup;
+        this->routers_[i * num_blades_per_chassis_ + k].green_links_[j] = linkdown;
         uniqueId++;
       }
     }
@@ -236,9 +208,9 @@ void DragonflyZone::generate_links()
           this->create_link(id, this->num_links_black_, &linkup, &linkdown);
 
           this->routers_[i * num_blades_per_chassis_ * num_chassis_per_group_ + j * num_blades_per_chassis_ + l]
-              ->black_links_[k] = linkup;
+              .black_links_[k] = linkup;
           this->routers_[i * num_blades_per_chassis_ * num_chassis_per_group_ + k * num_blades_per_chassis_ + l]
-              ->black_links_[j] = linkdown;
+              .black_links_[j] = linkdown;
           uniqueId++;
         }
       }
@@ -252,14 +224,12 @@ void DragonflyZone::generate_links()
     for (unsigned int j = i + 1; j < this->num_groups_; j++) {
       unsigned int routernumi                 = i * num_blades_per_chassis_ * num_chassis_per_group_ + j;
       unsigned int routernumj                 = j * num_blades_per_chassis_ * num_chassis_per_group_ + i;
-      this->routers_[routernumi]->blue_links_ = new resource::LinkImpl*;
-      this->routers_[routernumj]->blue_links_ = new resource::LinkImpl*;
       std::string id = "blue_link_between_group_"+ std::to_string(i) +"_and_" + std::to_string(j) +"_routers_" +
           std::to_string(routernumi) + "_and_" + std::to_string(routernumj) + "_" + std::to_string(uniqueId);
       this->create_link(id, this->num_links_blue_, &linkup, &linkdown);
 
-      this->routers_[routernumi]->blue_links_[0] = linkup;
-      this->routers_[routernumj]->blue_links_[0] = linkdown;
+      this->routers_[routernumi].blue_link_ = linkup;
+      this->routers_[routernumj].blue_link_ = linkdown;
       uniqueId++;
     }
   }
@@ -293,10 +263,10 @@ void DragonflyZone::get_local_route(NetPoint* src, NetPoint* dst, RouteCreationA
   XBT_DEBUG("dst : %u group, %u chassis, %u blade, %u node", targetCoords[0], targetCoords[1], targetCoords[2],
             targetCoords[3]);
 
-  DragonflyRouter* myRouter      = routers_[myCoords[0] * (num_chassis_per_group_ * num_blades_per_chassis_) +
-                                       myCoords[1] * num_blades_per_chassis_ + myCoords[2]];
-  DragonflyRouter* targetRouter  = routers_[targetCoords[0] * (num_chassis_per_group_ * num_blades_per_chassis_) +
-                                           targetCoords[1] * num_blades_per_chassis_ + targetCoords[2]];
+  DragonflyRouter* myRouter = &routers_[myCoords[0] * (num_chassis_per_group_ * num_blades_per_chassis_) +
+                                        myCoords[1] * num_blades_per_chassis_ + myCoords[2]];
+  DragonflyRouter* targetRouter = &routers_[targetCoords[0] * (num_chassis_per_group_ * num_blades_per_chassis_) +
+                                            targetCoords[1] * num_blades_per_chassis_ + targetCoords[2]];
   DragonflyRouter* currentRouter = myRouter;
 
   // node->router local link
@@ -319,8 +289,8 @@ void DragonflyZone::get_local_route(NetPoint* src, NetPoint* dst, RouteCreationA
         route->link_list.push_back(currentRouter->green_links_[targetCoords[0]]);
         if (latency)
           *latency += currentRouter->green_links_[targetCoords[0]]->get_latency();
-        currentRouter = routers_[myCoords[0] * (num_chassis_per_group_ * num_blades_per_chassis_) +
-                                 myCoords[1] * num_blades_per_chassis_ + targetCoords[0]];
+        currentRouter = &routers_[myCoords[0] * (num_chassis_per_group_ * num_blades_per_chassis_) +
+                                  myCoords[1] * num_blades_per_chassis_ + targetCoords[0]];
       }
 
       if (currentRouter->chassis_ != 0) {
@@ -328,14 +298,14 @@ void DragonflyZone::get_local_route(NetPoint* src, NetPoint* dst, RouteCreationA
         route->link_list.push_back(currentRouter->black_links_[0]);
         if (latency)
           *latency += currentRouter->black_links_[0]->get_latency();
-        currentRouter = routers_[myCoords[0] * (num_chassis_per_group_ * num_blades_per_chassis_) + targetCoords[0]];
+        currentRouter = &routers_[myCoords[0] * (num_chassis_per_group_ * num_blades_per_chassis_) + targetCoords[0]];
       }
 
       // go to destination group - the only optical hop
-      route->link_list.push_back(currentRouter->blue_links_[0]);
+      route->link_list.push_back(currentRouter->blue_link_);
       if (latency)
-        *latency += currentRouter->blue_links_[0]->get_latency();
-      currentRouter = routers_[targetCoords[0] * (num_chassis_per_group_ * num_blades_per_chassis_) + myCoords[0]];
+        *latency += currentRouter->blue_link_->get_latency();
+      currentRouter = &routers_[targetCoords[0] * (num_chassis_per_group_ * num_blades_per_chassis_) + myCoords[0]];
     }
 
     // same group, but same blade ?
@@ -343,7 +313,7 @@ void DragonflyZone::get_local_route(NetPoint* src, NetPoint* dst, RouteCreationA
       route->link_list.push_back(currentRouter->green_links_[targetCoords[2]]);
       if (latency)
         *latency += currentRouter->green_links_[targetCoords[2]]->get_latency();
-      currentRouter = routers_[targetCoords[0] * (num_chassis_per_group_ * num_blades_per_chassis_) + targetCoords[2]];
+      currentRouter = &routers_[targetCoords[0] * (num_chassis_per_group_ * num_blades_per_chassis_) + targetCoords[2]];
     }
 
     // same blade, but same chassis ?
index b87a8dd..670720c 100644 (file)
@@ -93,7 +93,7 @@ int NetZoneImpl::get_host_count()
 }
 
 simgrid::s4u::Host* NetZoneImpl::create_host(const char* name, const std::vector<double>& speed_per_pstate,
-                                             int coreAmount, std::map<std::string, std::string>* props)
+                                             int coreAmount, const std::map<std::string, std::string>* props)
 {
   simgrid::s4u::Host* res = new simgrid::s4u::Host(name);
 
@@ -105,8 +105,7 @@ simgrid::s4u::Host* NetZoneImpl::create_host(const char* name, const std::vector
   surf_cpu_model_pm->create_cpu(res, speed_per_pstate, coreAmount);
 
   if (props != nullptr)
-    for (auto const& kv : *props)
-      res->set_property(kv.first, kv.second);
+    res->set_properties(*props);
 
   simgrid::s4u::Host::on_creation(*res); // notify the signal
 
index 1f7b29c..28db1e5 100644 (file)
@@ -101,7 +101,7 @@ int MSG_comm_testany(xbt_dynar_t comms)
   msg_comm_t comm;
   unsigned int cursor;
   xbt_dynar_foreach (comms, cursor, comm) {
-    s_comms.push_back(static_cast<simgrid::kernel::activity::CommImpl*>(comm->s_comm->get_impl().get()));
+    s_comms.push_back(static_cast<simgrid::kernel::activity::CommImpl*>(comm->s_comm->get_impl()));
   }
 
   msg_error_t status = MSG_OK;
@@ -180,7 +180,7 @@ int MSG_comm_waitany(xbt_dynar_t comms)
   msg_comm_t comm;
   unsigned int cursor;
   xbt_dynar_foreach (comms, cursor, comm) {
-    s_comms.push_back(static_cast<simgrid::kernel::activity::CommImpl*>(comm->s_comm->get_impl().get()));
+    s_comms.push_back(static_cast<simgrid::kernel::activity::CommImpl*>(comm->s_comm->get_impl()));
   }
 
   msg_error_t status = MSG_OK;
index 188990b..08aeb1f 100644 (file)
@@ -167,7 +167,7 @@ void Task::set_priority(double priority)
 
 s4u::Actor* Task::get_sender()
 {
-  return comm ? comm->get_sender().get() : nullptr;
+  return comm ? comm->get_sender() : nullptr;
 }
 
 s4u::Host* Task::get_source()
index ef457c6..fe048a5 100644 (file)
@@ -31,19 +31,19 @@ xbt::signal<void(Actor const&)> s4u::Actor::on_migration_end;
 xbt::signal<void(Actor const&)> s4u::Actor::on_destruction;
 
 // ***** Actor creation *****
-ActorPtr Actor::self()
+Actor* Actor::self()
 {
   kernel::context::Context* self_context = kernel::context::Context::self();
   if (self_context == nullptr)
-    return ActorPtr();
+    return nullptr;
 
-  return self_context->get_actor()->iface();
+  return self_context->get_actor()->ciface();
 }
 ActorPtr Actor::init(const std::string& name, s4u::Host* host)
 {
   smx_actor_t self = SIMIX_process_self();
   kernel::actor::ActorImpl* actor = simix::simcall([self, &name, host] { return self->init(name, host).get(); });
-  return actor->ciface();
+  return actor->iface();
 }
 
 ActorPtr Actor::start(const std::function<void()>& code)
@@ -232,7 +232,7 @@ void Actor::kill_all()
   simix::simcall([self] { self->kill_all(); });
 }
 
-std::unordered_map<std::string, std::string>* Actor::get_properties() const
+const std::unordered_map<std::string, std::string>* Actor::get_properties() const
 {
   return pimpl_->get_properties();
 }
@@ -525,7 +525,7 @@ xbt_dict_t sg_actor_get_properties(sg_actor_t actor)
 {
   xbt_assert(actor != nullptr, "Invalid parameter: First argument must not be nullptr");
   xbt_dict_t as_dict                        = xbt_dict_new_homogeneous(xbt_free_f);
-  std::unordered_map<std::string, std::string>* props = actor->get_properties();
+  const std::unordered_map<std::string, std::string>* props = actor->get_properties();
   if (props == nullptr)
     return nullptr;
   for (auto const& kv : *props) {
index f119c5a..0c28a0b 100644 (file)
@@ -230,9 +230,9 @@ Mailbox* Comm::get_mailbox()
   return mailbox_;
 }
 
-ActorPtr Comm::get_sender()
+Actor* Comm::get_sender()
 {
-  return sender_ ? sender_->iface() : nullptr;
+  return sender_ ? sender_->ciface() : nullptr;
 }
 
 void intrusive_ptr_release(simgrid::s4u::Comm* c)
index 85ea7a3..46d86bb 100644 (file)
@@ -165,9 +165,9 @@ void Host::route_to(Host* dest, std::vector<kernel::resource::LinkImpl*>& links,
 }
 
 /** Get the properties assigned to a host */
-std::unordered_map<std::string, std::string>* Host::get_properties()
+const std::unordered_map<std::string, std::string>* Host::get_properties() const
 {
-  return simix::simcall([this] { return this->pimpl_->get_properties(); });
+  return this->pimpl_->get_properties();
 }
 
 /** Retrieve the property value (or nullptr if not set) */
@@ -180,6 +180,12 @@ void Host::set_property(const std::string& key, const std::string& value)
 {
   simix::simcall([this, &key, &value] { this->pimpl_->set_property(key, value); });
 }
+
+void Host::set_properties(const std::map<std::string, std::string>& properties)
+{
+  simix::simcall([this, &properties] { this->pimpl_->set_properties(properties); });
+}
+
 /** Specify a profile turning the host on and off according to a exhaustive list or a stochastic law.
  * The profile must contain boolean values. */
 void Host::set_state_profile(kernel::profile::Profile* p)
@@ -505,7 +511,7 @@ int sg_host_is_off(sg_host_t host)
 xbt_dict_t sg_host_get_properties(sg_host_t host)
 {
   xbt_dict_t as_dict = xbt_dict_new_homogeneous(xbt_free_f);
-  std::unordered_map<std::string, std::string>* props = host->get_properties();
+  const std::unordered_map<std::string, std::string>* props = host->get_properties();
   if (props == nullptr)
     return nullptr;
   for (auto const& elm : *props) {
@@ -584,7 +590,7 @@ void sg_host_dump(sg_host_t host)
   XBT_INFO("Displaying host %s", host->get_cname());
   XBT_INFO("  - speed: %.0f", host->get_speed());
   XBT_INFO("  - available speed: %.2f", sg_host_get_available_speed(host));
-  std::unordered_map<std::string, std::string>* props = host->get_properties();
+  const std::unordered_map<std::string, std::string>* props = host->get_properties();
 
   if (not props->empty()) {
     XBT_INFO("  - properties:");
index 456c57d..866436c 100644 (file)
@@ -105,7 +105,7 @@ void Link::set_latency_profile(kernel::profile::Profile* trace)
   simgrid::simix::simcall([this, trace]() { this->pimpl_->set_latency_profile(trace); });
 }
 
-const char* Link::get_property(const std::string& key)
+const char* Link::get_property(const std::string& key) const
 {
   return this->pimpl_->get_property(key);
 }
index a039355..b17dd18 100644 (file)
@@ -27,16 +27,18 @@ NetZone::~NetZone()
 {
 }
 
-std::unordered_map<std::string, std::string>* NetZone::get_properties()
+const std::unordered_map<std::string, std::string>* NetZone::get_properties() const
 {
-  return simix::simcall([this] { return &properties_; });
+  return &properties_;
 }
 
 /** Retrieve the property value (or nullptr if not set) */
-const char* NetZone::get_property(const std::string& key)
+const char* NetZone::get_property(const std::string& key) const
 {
-  return properties_.at(key).c_str();
+  auto prop = properties_.find(key);
+  return prop == properties_.end() ? nullptr : prop->second.c_str();
 }
+
 void NetZone::set_property(const std::string& key, const std::string& value)
 {
   simix::simcall([this, &key, &value] { properties_[key] = value; });
index 0be7985..8de6680 100644 (file)
@@ -41,12 +41,12 @@ const char* Storage::get_type()
   return pimpl_->typeId_.c_str();
 }
 
-std::unordered_map<std::string, std::string>* Storage::get_properties()
+const std::unordered_map<std::string, std::string>* Storage::get_properties() const
 {
-  return simix::simcall([this] { return pimpl_->get_properties(); });
+  return pimpl_->get_properties();
 }
 
-const char* Storage::get_property(const std::string& key)
+const char* Storage::get_property(const std::string& key) const
 {
   return this->pimpl_->get_property(key);
 }
@@ -118,7 +118,7 @@ xbt_dict_t sg_storage_get_properties(sg_storage_t storage)
 {
   xbt_assert((storage != nullptr), "Invalid parameters (storage is nullptr)");
   xbt_dict_t as_dict                        = xbt_dict_new_homogeneous(xbt_free_f);
-  std::unordered_map<std::string, std::string>* props = storage->get_properties();
+  const std::unordered_map<std::string, std::string>* props = storage->get_properties();
   if (props == nullptr)
     return nullptr;
   for (auto const& elm : *props) {
index 4b132db..461b844 100644 (file)
@@ -169,22 +169,22 @@ void Global::empty_trash()
     intrusive_ptr_release(actor);
   }
 #if SIMGRID_HAVE_MC
-  xbt_dynar_reset(simix_global->dead_actors_vector);
+  xbt_dynar_reset(dead_actors_vector);
 #endif
 }
 /**
- * @brief Executes the actors in simix_global->actors_to_run.
+ * @brief Executes the actors in actors_to_run.
  *
- * The actors in simix_global->actors_to_run are run (in parallel if  possible). On exit, simix_global->actors_to_run
- * is empty, and simix_global->actors_that_ran contains the list of actors that just ran.
- * The two lists are swapped so, be careful when using them before and after a call to this function.
+ * The actors in actors_to_run are run (in parallel if possible). On exit, actors_to_run is empty, and actors_that_ran
+ * contains the list of actors that just ran.  The two lists are swapped so, be careful when using them before and after
+ * a call to this function.
  */
 void Global::run_all_actors()
 {
   SIMIX_context_runall();
 
-  simix_global->actors_to_run.swap(simix_global->actors_that_ran);
-  simix_global->actors_to_run.clear();
+  actors_to_run.swap(actors_that_ran);
+  actors_to_run.clear();
 }
 
 simgrid::config::Flag<double> breakpoint{"simix/breakpoint",
@@ -361,7 +361,7 @@ static bool SIMIX_execute_timers()
     try {
       timer->callback();
     } catch (...) {
-      xbt_die("Exception thrown ouf of timer callback");
+      xbt_die("Exception thrown out of timer callback");
     }
     delete timer;
   }
index 0c25e44..71d2988 100644 (file)
@@ -107,6 +107,8 @@ void mpi_initialized_(int* flag, int* ierr){
 }
 
 void mpi_get_processor_name_(char *name, int *resultlen, int* ierr){
+  //fortran does not handle string endings cleanly, so initialize everything before
+  memset(name, 0, MPI_MAX_PROCESSOR_NAME);
   *ierr = MPI_Get_processor_name(name, resultlen);
 }
 
index ddde90d..931d3ec 100644 (file)
@@ -8,6 +8,7 @@
 #include "xbt/log.h"
 #include "xbt/sysdep.h"
 #include <boost/tokenizer.hpp>
+#include "src/surf/xml/platf_private.hpp"
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_utils, smpi, "Logging specific to SMPI (utils)");
 
@@ -48,7 +49,7 @@ std::vector<s_smpi_factor_t> parse_factor(const std::string& smpi_coef_string)
         }
       } else {
         try {
-          fact.values.push_back(std::stod(*factor_iter));
+          fact.values.push_back(surf_parse_get_time((*factor_iter).c_str(), "smpi factor", std::to_string(smpi_factor.size() + 1) + ": " + *factor_iter));
         } catch (std::invalid_argument& ia) {
           throw std::invalid_argument(std::string("Invalid factor value ") + std::to_string(iteration) + " in chunk " +
                                       std::to_string(smpi_factor.size() + 1) + ": " + *factor_iter);
index 72898c5..2404541 100644 (file)
@@ -6,7 +6,7 @@
 
 int main(int argc, char* argv[])
 {
-  if (simgrid::s4u::Actor::self().get() == nullptr) {
+  if (simgrid::s4u::Actor::self() == nullptr) {
     printf("smpireplaymain should not be called directly. Please use smpirun -replay instead.\n");
     return 1;
   }
index d1378fb..bf262b9 100644 (file)
@@ -5,17 +5,15 @@
 
 #include "PropertyHolder.hpp"
 
+#include <map>
+
 namespace simgrid {
 namespace surf {
 
-PropertyHolder::~PropertyHolder() {
-  delete properties_;
-}
-
 /** @brief Return the property associated to the provided key (or nullptr if not existing) */
 const char* PropertyHolder::get_property(const std::string& key) const
 {
-  if (properties_ == nullptr)
+  if (not properties_)
     return nullptr;
   auto prop = properties_->find(key);
   return prop == properties_->end() ? nullptr : prop->second.c_str();
@@ -25,17 +23,34 @@ const char* PropertyHolder::get_property(const std::string& key) const
 void PropertyHolder::set_property(const std::string& key, const std::string& value)
 {
   if (not properties_)
-    properties_ = new std::unordered_map<std::string, std::string>;
+    properties_.reset(new std::unordered_map<std::string, std::string>);
   (*properties_)[key] = value;
 }
 
 /** @brief Return the whole set of properties. Don't mess with it, dude! */
-std::unordered_map<std::string, std::string>* PropertyHolder::get_properties()
+const std::unordered_map<std::string, std::string>* PropertyHolder::get_properties()
 {
   if (not properties_)
-    properties_ = new std::unordered_map<std::string, std::string>;
-  return properties_;
+    properties_.reset(new std::unordered_map<std::string, std::string>);
+  return properties_.get();
 }
 
+/** @brief Change the value of the given keys in the property set */
+template <class Assoc> void PropertyHolder::set_properties(const Assoc& properties)
+{
+  if (not properties_)
+    properties_.reset(new std::unordered_map<std::string, std::string>);
+  std::unordered_map<std::string, std::string> props(properties.cbegin(), properties.cend());
+#if __cplusplus >= 201703L
+  props.merge(properties_);
+#else
+  props.insert(properties_->cbegin(), properties_->cend());
+#endif
+  properties_->swap(props);
+}
+
+template void PropertyHolder::set_properties(const std::map<std::string, std::string>& properties);
+template void PropertyHolder::set_properties(const std::unordered_map<std::string, std::string>& properties);
+
 } /* namespace surf */
 } /* namespace simgrid */
index d2b5631..2c7cdce 100644 (file)
@@ -5,6 +5,8 @@
 
 #ifndef SRC_SURF_PROPERTYHOLDER_HPP_
 #define SRC_SURF_PROPERTYHOLDER_HPP_
+
+#include <memory>
 #include <string>
 #include <unordered_map>
 
@@ -21,18 +23,15 @@ public:
   PropertyHolder() = default;
   PropertyHolder(const PropertyHolder&) = delete;
   PropertyHolder& operator=(const PropertyHolder&) = delete;
-  ~PropertyHolder();
 
   const char* get_property(const std::string& key) const;
   void set_property(const std::string& id, const std::string& value);
 
-  /* FIXME: This should not be exposed, as users may do bad things with the map they got (it's not a copy).
-   * But some user API expose this call so removing it is not so easy.
-   */
-  std::unordered_map<std::string, std::string>* get_properties();
+  const std::unordered_map<std::string, std::string>* get_properties();
+  template <class Assoc> void set_properties(const Assoc& properties);
 
 private:
-  std::unordered_map<std::string, std::string>* properties_ = nullptr;
+  std::unique_ptr<std::unordered_map<std::string, std::string>> properties_ = nullptr;
 };
 
 } /* namespace surf */
index 46872d2..1232dbe 100644 (file)
@@ -8,6 +8,8 @@
 #include "src/surf/surf_interface.hpp"
 #include "surf/surf.hpp"
 
+#include <algorithm>
+
 constexpr double EPSILON = 0.000000001;
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_cpu_ti, surf_cpu, "Logging specific to the SURF CPU TRACE INTEGRATION module");
@@ -24,25 +26,17 @@ CpuTiProfile::CpuTiProfile(profile::Profile* profile)
 {
   double integral = 0;
   double time = 0;
-  int i = 0;
-  nb_points_      = profile->event_list.size() + 1;
-  time_points_    = new double[nb_points_];
-  integral_       = new double[nb_points_];
+  unsigned nb_points = profile->event_list.size() + 1;
+  time_points_.reserve(nb_points);
+  integral_.reserve(nb_points);
   for (auto const& val : profile->event_list) {
-    time_points_[i] = time;
-    integral_[i] = integral;
-    integral += val.date_ * val.value_;
+    time_points_.push_back(time);
+    integral_.push_back(integral);
     time += val.date_;
-    i++;
+    integral += val.date_ * val.value_;
   }
-  time_points_[i] = time;
-  integral_[i] = integral;
-}
-
-CpuTiProfile::~CpuTiProfile()
-{
-  delete[] time_points_;
-  delete [] integral_;
+  time_points_.push_back(time);
+  integral_.push_back(integral);
 }
 
 CpuTiTmgr::~CpuTiTmgr()
@@ -113,7 +107,7 @@ double CpuTiProfile::integrate_simple_point(double a)
 {
   double integral = 0;
   double a_aux = a;
-  int ind         = binary_search(time_points_, a, 0, nb_points_ - 1);
+  int ind         = binary_search(time_points_, a);
   integral += integral_[ind];
 
   XBT_DEBUG("a %f ind %d integral %f ind + 1 %f ind %f time +1 %f time %f", a, ind, integral, integral_[ind + 1],
@@ -195,7 +189,7 @@ double CpuTiTmgr::solve(double a, double amount)
 double CpuTiProfile::solve_simple(double a, double amount)
 {
   double integral_a = integrate_simple_point(a);
-  int ind           = binary_search(integral_, integral_a + amount, 0, nb_points_ - 1);
+  int ind           = binary_search(integral_, integral_a + amount);
   double time       = time_points_[ind];
   time += (integral_a + amount - integral_[ind]) /
           ((integral_[ind + 1] - integral_[ind]) / (time_points_[ind + 1] - time_points_[ind]));
@@ -213,7 +207,7 @@ double CpuTiProfile::solve_simple(double a, double amount)
 double CpuTiTmgr::get_power_scale(double a)
 {
   double reduced_a          = a - floor(a / last_time_) * last_time_;
-  int point                 = profile_->binary_search(profile_->time_points_, reduced_a, 0, profile_->nb_points_ - 1);
+  int point                       = profile_->binary_search(profile_->time_points_, reduced_a);
   kernel::profile::DatedValue val = speed_profile_->event_list.at(point);
   return val.value_;
 }
@@ -260,29 +254,17 @@ CpuTiTmgr::CpuTiTmgr(kernel::profile::Profile* speed_profile, double value) : sp
 
 /**
  * @brief Binary search in array.
- *  It returns the first point of the interval in which "a" is.
+ *  It returns the last point of the interval in which "a" is.
  * @param array    Array
  * @param a        Value to search
- * @param low     Low bound to search in array
- * @param high    Upper bound to search in array
  * @return Index of point
  */
-int CpuTiProfile::binary_search(double* array, double a, int low, int high)
+int CpuTiProfile::binary_search(const std::vector<double>& array, double a)
 {
-  xbt_assert(low < high, "Wrong parameters: low (%d) should be smaller than high (%d)", low, high);
-
-  do {
-    int mid = low + (high - low) / 2;
-    XBT_DEBUG("a %f low %d high %d mid %d value %f", a, low, high, mid, array[mid]);
-
-    if (array[mid] > a)
-      high = mid;
-    else
-      low = mid;
-  }
-  while (low < high - 1);
-
-  return low;
+  if (array[0] > a)
+    return 0;
+  auto pos = std::upper_bound(begin(array), end(array), a);
+  return std::distance(begin(array), pos) - 1;
 }
 
 /*********
index fa3a3e8..61c94fa 100644 (file)
@@ -27,18 +27,14 @@ class XBT_PRIVATE CpuTi;
 class CpuTiProfile {
 public:
   explicit CpuTiProfile(profile::Profile* profile);
-  CpuTiProfile(const CpuTiProfile&) = delete;
-  CpuTiProfile& operator=(const CpuTiProfile&) = delete;
-  ~CpuTiProfile();
 
   double integrate_simple(double a, double b);
   double integrate_simple_point(double a);
   double solve_simple(double a, double amount);
 
-  double* time_points_;
-  double *integral_;
-  int nb_points_;
-  int binary_search(double* array, double a, int low, int high);
+  std::vector<double> time_points_;
+  std::vector<double> integral_;
+  static int binary_search(const std::vector<double>& array, double a);
 };
 
 class CpuTiTmgr {
index 50b200b..66cc730 100644 (file)
@@ -20,12 +20,9 @@ static void IB_create_host_callback(simgrid::s4u::Host const& host)
   using simgrid::kernel::resource::NetworkIBModel;
 
   static int id=0;
-  // pour t->id -> rajouter une nouvelle struct dans le dict, pour stocker les comms actives
-
-  IBNode* act = new IBNode(id);
 
+  ((NetworkIBModel*)surf_network_model)->active_nodes.emplace(host.get_name(), IBNode(id));
   id++;
-  ((NetworkIBModel*)surf_network_model)->active_nodes.insert({host.get_name(), act});
 }
 
 static void IB_action_state_changed_callback(simgrid::kernel::resource::NetworkAction& action,
@@ -48,25 +45,10 @@ static void IB_action_init_callback(simgrid::kernel::resource::NetworkAction& ac
                                     simgrid::s4u::Host* dst)
 {
   simgrid::kernel::resource::NetworkIBModel* ibModel = (simgrid::kernel::resource::NetworkIBModel*)surf_network_model;
-  simgrid::kernel::resource::IBNode* act_src;
-  simgrid::kernel::resource::IBNode* act_dst;
-
-  auto asrc = ibModel->active_nodes.find(src->get_name());
-  if (asrc != ibModel->active_nodes.end()) {
-    act_src = asrc->second;
-  } else {
-    throw std::out_of_range(std::string("Could not find '") + src->get_cname() + "' active comms !");
-  }
-
-  auto adst = ibModel->active_nodes.find(dst->get_name());
-  if (adst != ibModel->active_nodes.end()) {
-    act_dst = adst->second;
-  } else {
-    throw std::out_of_range(std::string("Could not find '") + dst->get_cname() + "' active comms !");
-  }
+  simgrid::kernel::resource::IBNode* act_src         = &ibModel->active_nodes.at(src->get_name());
+  simgrid::kernel::resource::IBNode* act_dst         = &ibModel->active_nodes.at(dst->get_name());
 
   ibModel->active_comms[&action] = std::make_pair(act_src, act_dst);
-
   ibModel->updateIBfactors(&action, act_src, act_dst, 0);
 }
 
@@ -129,12 +111,6 @@ NetworkIBModel::NetworkIBModel() : NetworkSmpiModel()
   }
 }
 
-NetworkIBModel::~NetworkIBModel()
-{
-  for (auto const& instance : active_nodes)
-    delete instance.second;
-}
-
 void NetworkIBModel::computeIBfactors(IBNode* root)
 {
   double num_comm_out    = static_cast<double>(root->ActiveCommsUp.size());
index a90f8ab..ee33677 100644 (file)
@@ -53,10 +53,9 @@ public:
   explicit NetworkIBModel(const char* name);
   NetworkIBModel(const NetworkIBModel&) = delete;
   NetworkIBModel& operator=(const NetworkIBModel&) = delete;
-  ~NetworkIBModel() override;
   void updateIBfactors(NetworkAction* action, IBNode* from, IBNode* to, int remove);
 
-  std::unordered_map<std::string, IBNode*> active_nodes;
+  std::unordered_map<std::string, IBNode> active_nodes;
   std::unordered_map<NetworkAction*, std::pair<IBNode*, IBNode*>> active_comms;
 
 };
index e729a52..3b46bc1 100644 (file)
@@ -115,8 +115,7 @@ static void sg_platf_new_link(simgrid::kernel::routing::LinkCreationArgs* link,
       surf_network_model->create_link(link_name, link->bandwidth, link->latency, link->policy);
 
   if (link->properties) {
-    for (auto const& elm : *link->properties)
-      l->set_property(elm.first, elm.second);
+    l->set_properties(*link->properties);
   }
 
   if (link->latency_trace)
@@ -362,8 +361,7 @@ void sg_platf_new_storage(simgrid::kernel::routing::StorageCreationArgs* storage
   auto s = surf_storage_model->createStorage(storage->id, stype->id, storage->content, storage->attach);
 
   if (storage->properties) {
-    for (auto const& elm : *storage->properties)
-      s->set_property(elm.first, elm.second);
+    s->set_properties(*storage->properties);
     delete storage->properties;
   }
 }
index 26046c6..e57ae9f 100644 (file)
@@ -183,10 +183,6 @@ double surf_parse_get_value_with_unit(const char* string, const unit_scale& unit
   if (ptr == string)
     surf_parse_error(std::string("cannot parse number:") + string);
   if (ptr[0] == '\0') {
-    if (res == 0)
-      return res; // Ok, 0 can be unit-less
-
-    XBT_WARN("Deprecated unit-less value '%s' for %s %s. %s", string, entity_kind, name.c_str(), error_msg);
     ptr = (char*)default_unit;
   }
   auto u = units.find(ptr);
index 25d6d2c..7af9758 100644 (file)
@@ -18,32 +18,27 @@ std::ifstream* action_fs = nullptr;
 std::unordered_map<std::string, action_fun> action_funs;
 static std::unordered_map<std::string, std::queue<ReplayAction*>*> action_queues;
 
-static void read_and_trim_line(std::ifstream* fs, std::string* line)
+static void read_and_trim_line(std::ifstream& fs, std::string* line)
 {
   do {
-    std::getline(*fs, *line);
+    std::getline(fs, *line);
     boost::trim(*line);
-  } while (not fs->eof() && (line->length() == 0 || line->front() == '#'));
+  } while (not fs.eof() && (line->length() == 0 || line->front() == '#'));
   XBT_DEBUG("got from trace: %s", line->c_str());
 }
 
 class ReplayReader {
-  std::ifstream* fs;
+  std::ifstream fs;
   std::string line;
 
 public:
-  explicit ReplayReader(const char* filename)
+  explicit ReplayReader(const char* filename) : fs(filename, std::ifstream::in)
   {
     XBT_VERB("Prepare to replay file '%s'", filename);
-    fs = new std::ifstream(filename, std::ifstream::in);
-    xbt_assert(fs->is_open(), "Cannot read replay file '%s'", filename);
+    xbt_assert(fs.is_open(), "Cannot read replay file '%s'", filename);
   }
   ReplayReader(const ReplayReader&) = delete;
   ReplayReader& operator=(const ReplayReader&) = delete;
-  ~ReplayReader()
-  {
-    delete fs;
-  }
   bool get(ReplayAction* action);
 };
 
@@ -52,7 +47,7 @@ bool ReplayReader::get(ReplayAction* action)
   read_and_trim_line(fs, &line);
 
   boost::split(*action, line, boost::is_any_of(" \t"), boost::token_compress_on);
-  return not fs->eof();
+  return not fs.eof();
 }
 
 static ReplayAction* get_action(const char* name)
@@ -66,7 +61,7 @@ static ReplayAction* get_action(const char* name)
     // Read lines until I reach something for me (which breaks in loop body) or end of file reached
     while (true) {
       std::string action_line;
-      read_and_trim_line(action_fs, &action_line);
+      read_and_trim_line(*action_fs, &action_line);
       if (action_fs->eof())
         break;
       /* we cannot split in place here because we parse&store several lines for the colleagues... */
index 7e2e985..f5fb17f 100644 (file)
@@ -13,7 +13,7 @@ XBT_LOG_NEW_DEFAULT_CATEGORY(storage, "Messages specific for this simulation");
 
 static void display_storage_properties(simgrid::s4u::Storage* storage)
 {
-  std::unordered_map<std::string, std::string>* props = storage->get_properties();
+  const std::unordered_map<std::string, std::string>* props = storage->get_properties();
   if (not props->empty()) {
     XBT_INFO("\tProperties of mounted storage: %s", storage->get_cname());
 
index 8cc8816..14fe8b0 100644 (file)
@@ -56,9 +56,6 @@ $ ./storage_client_server$EXEEXT ${platfdir}/storage/storage.xml "--log=root.fmt
 > [  1.207952] (server@alice)  Storage name: Disk2, mount name: c:
 > [  1.207952] (server@alice)          Free size: 534479367024 bytes
 > [  1.207952] (server@alice)          Used size: 2391544976 bytes
-> [  1.207952] (client@bob) *** GET/SET DATA for storage element: Disk1 ***
-> [  1.207952] (client@bob) Get data: 'No User Data'
-> [  1.207952] (client@bob)    Set and get data: 'Some data'
 > [  1.207952] (server@alice)  No property attached.
 > [  1.207952] (server@alice) *** Dump a storage element ***
 > [  1.207952] (server@alice) Print the content of the storage element: Disk2
@@ -102,6 +99,9 @@ $ ./storage_client_server$EXEEXT ${platfdir}/storage/storage.xml "--log=root.fmt
 > [  1.207952] (server@alice)  \Windows\winhlp32.exe size: 10752 bytes
 > [  1.207952] (server@alice)  \Windows\write.exe size: 10752 bytes
 > [  1.207952] (server@alice) Storage Disk1 is attached to bob
+> [  1.207952] (client@bob) *** GET/SET DATA for storage element: Disk1 ***
+> [  1.207952] (client@bob) Get data: 'No User Data'
+> [  1.207952] (client@bob)    Set and get data: 'Some data'
 > [  1.207952] (server@alice) Storage Disk2 is attached to alice
 > [  1.207952] (server@alice) Storage Disk3 is attached to carl
 > [  1.207952] (server@alice) Storage Disk4 is attached to denise
index 844e307..ce9155b 100644 (file)
@@ -42,7 +42,6 @@ static void create_environment(xbt_os_timer_t parse_time, const char *platformFi
 
 static void dump_hosts()
 {
-  std::unordered_map<std::string, std::string>* props = nullptr;
   unsigned int totalHosts = sg_host_count();
   sg_host_t* hosts        = sg_host_list();
   std::sort(hosts, hosts + totalHosts,
@@ -50,7 +49,7 @@ static void dump_hosts()
 
   for (unsigned int i = 0; i < totalHosts; i++) {
     std::printf("  <host id=\"%s\" speed=\"%.0f\"", hosts[i]->get_cname(), sg_host_speed(hosts[i]));
-    props = hosts[i]->get_properties();
+    const std::unordered_map<std::string, std::string>* props = hosts[i]->get_properties();
     if (hosts[i]->get_core_count() > 1) {
       std::printf(" core=\"%d\"", hosts[i]->get_core_count());
     }