Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'master' into depencencies
authorFrederic Suter <frederic.suter@cc.in2p3.fr>
Thu, 30 Jan 2020 10:06:01 +0000 (11:06 +0100)
committerFrederic Suter <frederic.suter@cc.in2p3.fr>
Thu, 30 Jan 2020 10:06:01 +0000 (11:06 +0100)
20 files changed:
CMakeLists.txt
ChangeLog
NEWS
docs/find-missing.ignore
docs/source/app_s4u.rst
include/simgrid/forward.h
include/simgrid/host.h
include/simgrid/modelchecker.h
include/simgrid/s4u/Activity.hpp
include/simgrid/s4u/Actor.hpp
include/simgrid/s4u/Disk.hpp
include/simgrid/s4u/Engine.hpp
include/simgrid/s4u/Host.hpp
src/kernel/activity/ActivityImpl.hpp
src/mc/Session.cpp
src/mc/checker/CommunicationDeterminismChecker.cpp
src/mc/checker/simgrid_mc.cpp
src/mc/remote/RemoteClient.cpp
src/s4u/s4u_Host.cpp
src/surf/HostImpl.hpp

index 26f1be5..adf4eec 100644 (file)
@@ -319,7 +319,6 @@ CHECK_INCLUDE_FILE("unistd.h" HAVE_UNISTD_H)
 CHECK_INCLUDE_FILE("signal.h" HAVE_SIGNAL_H)
 CHECK_INCLUDE_FILE("sys/param.h" HAVE_SYS_PARAM_H)
 CHECK_INCLUDE_FILE("sys/sysctl.h" HAVE_SYS_SYSCTL_H)
-CHECK_INCLUDE_FILE("ucontext.h" HAVE_UCONTEXT_H)
 CHECK_INCLUDE_FILE("linux/futex.h" HAVE_FUTEX_H)
 
 CHECK_FUNCTION_EXISTS(dlfunc HAVE_DLFUNC)
@@ -409,18 +408,18 @@ mark_as_advanced(PATH_LIBDW_H)
 mark_as_advanced(PATH_LIBDW_LIB)
 
 if (enable_model-checking AND enable_ns3)
-  message(FATAL_ERROR "Cannot activate both model-checking and ns-3 bindings: ns-3 pull too much dependencies for the MC to work")
+  message(FATAL_ERROR "Cannot activate both model-checking and ns-3 bindings: ns-3 pulls too much dependencies for the MC to work")
 endif()
 
 get_property(known_features GLOBAL PROPERTY CMAKE_CXX_KNOWN_FEATURES)
 
 if(enable_smpi)
   SET(HAVE_SMPI 1)
-  if(NOT WIN32)
-    SET(HAVE_PRIVATIZATION 1)
-  else()
-    message (STATUS "Warning:  no support for SMPI automatic privatization on this platform")
+  if(WIN32)
+    message (STATUS "Warning: no support for SMPI automatic privatization on Windows.")
     SET(HAVE_PRIVATIZATION 0)
+  else()
+    SET(HAVE_PRIVATIZATION 1)
   endif()
 else()
   SET(HAVE_SMPI 0)
@@ -430,6 +429,7 @@ endif()
 ### Check what context backends are available
 
 set(HAVE_UCONTEXT_CONTEXTS 0)
+CHECK_INCLUDE_FILE("ucontext.h" HAVE_UCONTEXT_H)
 if(NOT HAVE_UCONTEXT_H)
   message(STATUS "No ucontext factory: <ucontext.h> not found.")
 elseif(APPLE)
index 6490385..acd2d0b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,21 @@
 
 SimGrid (3.24.1) NOT RELEASED YET (v3.25 expected December 22. 2029, 04:19 UTC)
 
+Important user-visible changes:
+- Great improvement of the Python binding's stability.
+  - A nasty synchronization bug was ironed out, see also below.
+- Reorganization of the C & Python bindings' documentation.
+  - Python was organized as a separate tree, C was not part of the doc
+  - The C++ doc was also improved as methods are now split by theme.
+- SimDAG++: Automatic dependencies on S4U activities (experimental)
+  - Some features are already implemented but not all of them
+  - Cannot block an activity until it's scheduled on a resource
+  - Only Exec and Io so far. Comms are not handled yet.
+  - No heterogeneous wait_any() that would mix Exec and Io activities.
+  - See examples/s4u/{io-,exec-}dependent for what's already there.
+
+
+
 General:
 - Upgrade documented Java dependency to Java 8 (earlier versions don't work).
 - Drop support for Viva/Triva (old visualization tools), hence removed
@@ -9,8 +24,9 @@ General:
 
 Python:
 - Require pybind11 version 2.4.
-- Greatly improve locking during context switches with Python. No more tests are
-  failing currently, even on win32.
+- Greatly improve locking during context switches with Python.
+  - Declaring Python callbacks to this_actor::on_exit is now working.
+  - No more tests are failing currently, even on win32.
 
 S4U:
 - Actor: Merge signals on_migration_start/end into on_host_change
diff --git a/NEWS b/NEWS
index c28c965..9f24784 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -5,6 +5,12 @@ __   _____ _ __ ___(_) ___  _ __   |___ / |___ \| ___|
   \_/ \___|_|  |___/_|\___/|_| |_| |____(_)_____|____/
                (not released yet)
 
+The Dependstable Snake Release.
+
+ * Great improvement of the Python binding's stability.
+ * Reorganization of the C & Python bindings' documentation.
+ * SimDAG++: Automatic dependencies on S4U activities (experimental)
+ * (+ many bug fixes and internal refactoring)
                     _               _____  ____  _  _
 __   _____ _ __ ___(_) ___  _ __   |___ / |___ \| || |
 \ \ / / _ \ '__/ __| |/ _ \| '_ \    |_ \   __) | || |_
index a996761..b9309f7 100644 (file)
@@ -171,4 +171,4 @@ It is only used by find-missing, that will not report any definition linked here
 .. autodoxyvar:: ::const_sg_bar_t
 .. autodoxyvar:: ::const_sg_mutex_t
 .. autodoxyvar:: ::const_sg_sem_t
-
+.. autodoxyvar:: ::const_sg_host_t
index 8b0c009..f66286e 100644 (file)
@@ -392,12 +392,10 @@ Simulation objects
 
 .. autodoxyclass:: simgrid::s4u::Actor
 
-.. doxygentypedef:: ActorPtr
-
 .. doxygentypedef:: aid_t
 
-Creating actors
----------------
+Basic management
+----------------
 
 .. tabs::
 
@@ -405,15 +403,9 @@ Creating actors
 
       .. code:: C++
 
-         #include <simgrid/s4u/Engine.hpp>
+         #include <simgrid/s4u/Actor.hpp>
 
-      .. autodoxymethod:: simgrid::s4u::Actor::create(const std::string &name, s4u::Host *host, const std::function< void()> &code)
-      .. autodoxymethod:: simgrid::s4u::Actor::create(const std::string &name, s4u::Host *host, F code)
-      .. autodoxymethod:: simgrid::s4u::Actor::create(const std::string &name, s4u::Host *host, F code, Args... args)
-      .. autodoxymethod:: simgrid::s4u::Actor::create(const std::string &name, s4u::Host *host, const std::string &function, std::vector< std::string > args)
-
-      .. autodoxymethod:: simgrid::s4u::Actor::init(const std::string &name, s4u::Host *host)
-      .. autodoxymethod:: simgrid::s4u::Actor::start(const std::function< void()> &code)
+      .. doxygentypedef:: ActorPtr
 
    .. group-tab:: Python
 
@@ -421,8 +413,6 @@ Creating actors
 
          from simgrid import Actor
 
-      .. automethod:: simgrid.Actor.create
-
    .. group-tab:: C
 
       .. code:: C
@@ -434,17 +424,38 @@ Creating actors
 
          Pointer to a constant actor object.
 
+      .. autodoxymethod:: sg_actor_ref(const_sg_actor_t actor)
+      .. autodoxymethod:: sg_actor_unref(const_sg_actor_t actor)
+
+Creating actors
+---------------
+
+.. tabs::
+
+   .. group-tab:: C++
+
+      .. autodoxymethod:: simgrid::s4u::Actor::create(const std::string &name, s4u::Host *host, const std::function< void()> &code)
+      .. autodoxymethod:: simgrid::s4u::Actor::create(const std::string &name, s4u::Host *host, F code)
+      .. autodoxymethod:: simgrid::s4u::Actor::create(const std::string &name, s4u::Host *host, F code, Args... args)
+      .. autodoxymethod:: simgrid::s4u::Actor::create(const std::string &name, s4u::Host *host, const std::string &function, std::vector< std::string > args)
+
+      .. autodoxymethod:: simgrid::s4u::Actor::init(const std::string &name, s4u::Host *host)
+      .. autodoxymethod:: simgrid::s4u::Actor::start(const std::function< void()> &code)
+
+   .. group-tab:: Python
+
+      .. automethod:: simgrid.Actor.create
+
+   .. group-tab:: C
+
       .. autodoxymethod:: sg_actor_init(const char *name, sg_host_t host)
       .. autodoxymethod:: sg_actor_start(sg_actor_t actor, xbt_main_func_t code, int argc, char **argv)
 
       .. autodoxymethod:: sg_actor_attach(const char *name, void *data, sg_host_t host, xbt_dict_t properties)
       .. autodoxymethod:: sg_actor_detach()
 
-      .. autodoxymethod:: sg_actor_ref(const_sg_actor_t actor)
-      .. autodoxymethod:: sg_actor_unref(const_sg_actor_t actor)
-
-Searching specific actors
--------------------------
+Retrieving actors
+-----------------
 
 .. tabs::
 
@@ -463,8 +474,8 @@ Searching specific actors
       .. autodoxymethod:: sg_actor_by_PID(aid_t pid)
       .. autodoxymethod:: sg_actor_self()
 
-Querying info about actors
---------------------------
+Querying info
+-------------
 
 .. tabs::
 
@@ -824,6 +835,10 @@ Retrieving hosts
 
       .. automethod:: simgrid.Engine.get_all_hosts
 
+   .. group-tab:: C
+
+      See also :cpp:func:`sg_host_list` and :cpp:func:`sg_host_count`.
+
 Retrieving links
 ----------------
 
@@ -898,7 +913,7 @@ Basic management
       .. automethod:: simgrid.Mailbox.by_name
 
 Querying info
-.............
+-------------
 
 .. tabs::
 
@@ -912,7 +927,7 @@ Querying info
       .. autoattribute:: simgrid.Mailbox.name
 
 Sending data
-............
+------------
 
 .. tabs::
 
@@ -931,7 +946,7 @@ Sending data
 
 
 Receiving data
-..............
+--------------
 
 .. tabs::
 
@@ -956,7 +971,7 @@ Receiving data
       .. autodoxymethod:: sg_mailbox_listen(const char *alias)
 
 Receiving actor
-...............
+---------------
 
 See :ref:`s4u_receiving_actor`.
 
@@ -983,11 +998,63 @@ Resources
 ⁣  class Disk
 =============
 
-.. doxygenclass:: simgrid::s4u::Disk
-   :members:
-   :protected-members:
-   :undoc-members:
+.. autodoxyclass:: simgrid::s4u::Disk
+
+Basic management
+----------------
+
+.. tabs::
+
+   .. group-tab:: C++
+
+      .. code-block:: C++
+
+         #include <simgrid/s4u/Disk.hpp>
+
+      Note that there is no DiskPtr type, and that you cannot use the RAII
+      idiom on disks because SimGrid does not allow (yet) to create nor
+      destroy resources once the simulation is started. 
+         
+
+Querying info
+-------------
+
+.. tabs::
+
+   .. group-tab:: C++
+
+      .. autodoxymethod:: simgrid::s4u::Disk::get_cname()
+      .. autodoxymethod:: simgrid::s4u::Disk::get_host()
+      .. autodoxymethod:: simgrid::s4u::Disk::get_name()
+      .. autodoxymethod:: simgrid::s4u::Disk::get_properties()
+      .. autodoxymethod:: simgrid::s4u::Disk::get_property(const std::string &key)
+      .. autodoxymethod:: simgrid::s4u::Disk::get_read_bandwidth()
+      .. autodoxymethod:: simgrid::s4u::Disk::get_write_bandwidth()
+      .. autodoxymethod:: simgrid::s4u::Disk::set_property(const std::string &, const std::string &value)
+
+I/O operations
+--------------
+
+.. tabs::
+
+   .. group-tab:: C++
+
+      .. autodoxymethod:: simgrid::s4u::Disk::io_init(sg_size_t size, s4u::Io::OpType type)
+      .. autodoxymethod:: simgrid::s4u::Disk::read(sg_size_t size)
+      .. autodoxymethod:: simgrid::s4u::Disk::read_async(sg_size_t size)
+      .. autodoxymethod:: simgrid::s4u::Disk::write(sg_size_t size)
+      .. autodoxymethod:: simgrid::s4u::Disk::write_async(sg_size_t size)
+
+Signals
+-------
+
+.. tabs::
+
+   .. group-tab:: C++
 
+      .. autodoxyvar:: simgrid::s4u::Disk::on_creation
+      .. autodoxyvar:: simgrid::s4u::Disk::on_destruction
+      .. autodoxyvar:: simgrid::s4u::Disk::on_state_change
 
 
 .. _API_s4u_Host:
@@ -996,6 +1063,116 @@ Resources
 ⁣  class Host
 =============
 
+.. autodoxyclass:: simgrid::s4u::Host
+
+Basic management
+----------------
+
+.. tabs::
+
+   .. group-tab:: C++
+
+      .. code-block:: C++
+
+         #include <simgrid/s4u/Host.hpp>
+
+      Note that there is no HostPtr type, and that you cannot use the RAII
+      idiom on hosts because SimGrid does not allow (yet) to create nor
+      destroy resources once the simulation is started. 
+
+   .. group-tab:: Python
+
+      .. code:: Python
+
+         from simgrid import Host
+
+   .. group-tab:: C
+
+      .. code:: C
+
+         #include <simgrid/host.h>
+
+      .. doxygentypedef:: sg_host_t
+      .. cpp:type:: const s4u_Host* const_sg_host_t
+
+         Pointer to a constant host object.
+
+Retrieving hosts
+----------------
+
+.. tabs::
+
+   .. group-tab:: C++
+
+      See also :cpp:func:`simgrid::s4u::Engine::get_all_hosts`.
+
+      .. autodoxymethod:: simgrid::s4u::Host::by_name(const std::string &name)
+      .. autodoxymethod:: simgrid::s4u::Host::by_name_or_null(const std::string &name)
+      .. autodoxymethod:: simgrid::s4u::Host::current()
+
+   .. group-tab:: Python
+
+      See also :py:func:`simgrid.Engine.get_all_hosts`.
+
+      .. automethod:: simgrid.Host.by_name
+      .. automethod:: simgrid.Host.current
+
+   .. group-tab:: C
+
+      .. autodoxymethod:: sg_host_by_name(const char *name)
+      .. autodoxymethod:: sg_host_count()
+      .. autodoxymethod:: sg_host_list()
+      .. autodoxymethod:: sg_hosts_as_dynar()
+
+Querying info
+-------------
+
+.. tabs::
+
+   .. group-tab:: C++
+
+      .. autodoxymethod:: simgrid::s4u::Host::get_cname()
+      .. autodoxymethod:: simgrid::s4u::Host::get_core_count()
+      .. autodoxymethod:: simgrid::s4u::Host::get_disks()
+      .. autodoxymethod:: simgrid::s4u::Host::get_name()
+
+   .. group-tab:: Python
+
+      .. autoattribute:: simgrid.Exec.host
+      .. autoattribute:: simgrid.Host.name
+
+   .. group-tab:: C
+
+      .. autodoxymethod:: ::sg_host_core_count(const_sg_host_t host)
+      .. autodoxymethod:: sg_host_get_name(const_sg_host_t host)
+
+DVFS
+----
+
+.. tabs::
+
+   .. group-tab:: C++
+
+      .. autodoxymethod:: simgrid::s4u::Host::get_pstate()
+      .. autodoxymethod:: simgrid::s4u::Host::get_pstate_count()
+      .. autodoxymethod:: simgrid::s4u::Host::get_pstate_speed(int pstate_index)
+      .. autodoxymethod:: simgrid::s4u::Host::set_pstate(int pstate_index)
+      .. autodoxymethod:: simgrid::s4u::Host::set_speed_profile(kernel::profile::Profile *p)
+      .. autodoxymethod:: simgrid::s4u::Host::set_state_profile(kernel::profile::Profile *p)
+
+   .. group-tab:: Python
+
+      .. automethod:: simgrid.Host.get_pstate_count
+      .. automethod:: simgrid.Host.get_pstate_speed
+
+   .. group-tab:: C
+
+      .. autodoxymethod:: sg_host_get_available_speed(const_sg_host_t host)
+      .. autodoxymethod:: sg_host_get_nb_pstates(const_sg_host_t host)
+      .. autodoxymethod:: sg_host_get_pstate(const_sg_host_t host)
+      .. autodoxymethod:: sg_host_get_pstate_speed(const_sg_host_t host, int pstate_index)
+      .. autodoxymethod:: sg_host_set_pstate(sg_host_t host, int pstate)
+
 .. doxygenclass:: simgrid::s4u::Host
    :members:
    :protected-members:
@@ -1371,13 +1548,6 @@ Python API Reference
 The Python API is automatically generated with pybind11. It closely mimicks the C++
 API, to which you should refer for more information.
 
-==========
-this_actor
-==========
-
-.. automodule:: simgrid.this_actor
-   :members:
-
 ==========
 Class Comm
 ==========
@@ -1399,13 +1569,6 @@ Class Host
 .. autoclass:: simgrid.Host
    :members:
 
-=============
-Class Mailbox
-=============
-
-.. autoclass:: simgrid.Mailbox
-   :members:
-
 .. |hr| raw:: html
 
    <hr />
index 5d97079..0690462 100644 (file)
@@ -16,6 +16,10 @@ namespace simgrid {
 
 namespace s4u {
 class Activity;
+/** Smart pointer to a simgrid::s4u::Actor */
+typedef boost::intrusive_ptr<Activity> ActivityPtr;
+XBT_PUBLIC void intrusive_ptr_release(const Activity* actor);
+XBT_PUBLIC void intrusive_ptr_add_ref(const Activity* actor);
 
 class Actor;
 /** Smart pointer to a simgrid::s4u::Actor */
index c228722..85d17a2 100644 (file)
 #include <simgrid/forward.h>
 
 SG_BEGIN_DECL
-/** @brief Host datatype.
+/** Returns an array of all existing hosts (use sg_host_count() to know the array size).
  *
- *   A <em>location</em> (or <em>host</em>) is any possible place where an actor may run. Thus it is represented as a
- *   <em>physical resource with computing capabilities</em>, some <em>mailboxes</em> to enable running actors to
- *   communicate with remote ones, and some <em>private data</em> that can be only accessed by local actors.
+ * @remark The host order in this array is generally different from the
+ * creation/declaration order in the XML platform (we use a hash table
+ * internally).
  */
-
 XBT_PUBLIC sg_host_t* sg_host_list();
 
-/** @brief Return the current number of hosts. */
+/** Returns the amount of hosts existing in the platform. */
 XBT_PUBLIC size_t sg_host_count();
 
 /**
@@ -33,15 +32,10 @@ XBT_PUBLIC xbt_dynar_t sg_hosts_as_dynar();
 XBT_PUBLIC size_t sg_host_extension_create(void (*deleter)(void*));
 XBT_PUBLIC void* sg_host_extension_get(const_sg_host_t host, size_t rank);
 
-/** @brief Finds a sg_host_t using its name.
- *
- * This is a name directory service
- * @param name the name of an host.
- * @return the corresponding host
- */
+/** Finds an host from its name */
 XBT_PUBLIC sg_host_t sg_host_by_name(const char* name);
 
-/** @brief Return the name of the #sg_host_t. */
+/** @brief Return the name of the sg_host_t. */
 XBT_PUBLIC const char* sg_host_get_name(const_sg_host_t host);
 
 // ========== User Data ==============
index 6138567..3d5305b 100644 (file)
@@ -21,6 +21,7 @@
 
 SG_BEGIN_DECL
 
+/** Explore every branches where that function returns a value between min and max (inclusive) */
 XBT_PUBLIC int MC_random(int min, int max);
 
 #if SIMGRID_HAVE_MC
index 0680700..67fe59b 100644 (file)
@@ -26,18 +26,10 @@ namespace s4u {
  */
 class XBT_PUBLIC Activity {
   friend Comm;
-  friend XBT_PUBLIC void intrusive_ptr_release(Comm * c);
-  friend XBT_PUBLIC void intrusive_ptr_add_ref(Comm * c);
-
   friend Exec;
   friend ExecSeq;
   friend ExecPar;
-  friend XBT_PUBLIC void intrusive_ptr_release(Exec * e);
-  friend XBT_PUBLIC void intrusive_ptr_add_ref(Exec * e);
-
   friend Io;
-  friend XBT_PUBLIC void intrusive_ptr_release(Io* i);
-  friend XBT_PUBLIC void intrusive_ptr_add_ref(Io* i);
 
 protected:
   Activity()  = default;
@@ -83,10 +75,21 @@ public:
   /** Returns the internal implementation of this Activity */
   kernel::activity::ActivityImpl* get_impl() const { return pimpl_.get(); }
 
+#ifndef DOXYGEN
+  friend void intrusive_ptr_release(Activity* a)
+  {
+    if (a->refcount_.fetch_sub(1, std::memory_order_release) == 1) {
+      std::atomic_thread_fence(std::memory_order_acquire);
+      delete a;
+    }
+  }
+  friend void intrusive_ptr_add_ref(Activity* a) { a->refcount_.fetch_add(1, std::memory_order_relaxed); }
+#endif
 private:
   kernel::activity::ActivityImplPtr pimpl_ = nullptr;
   Activity::State state_                   = Activity::State::INITED;
   double remains_                          = 0;
+  std::atomic_int_fast32_t refcount_{0};
 };
 
 template <class AnyActivity> class Activity_T : public Activity {
@@ -94,21 +97,10 @@ private:
   std::string name_             = "unnamed";
   std::string tracing_category_ = "";
   void* user_data_              = nullptr;
-  std::atomic_int_fast32_t refcount_{0};
   std::vector<Activity*> successors_;
   std::set<Activity*> dependencies_;
 
 public:
-#ifndef DOXYGEN
-  friend void intrusive_ptr_release(AnyActivity* a)
-  {
-    if (a->refcount_.fetch_sub(1, std::memory_order_release) == 1) {
-      std::atomic_thread_fence(std::memory_order_acquire);
-      delete a;
-    }
-  }
-  friend void intrusive_ptr_add_ref(AnyActivity* a) { a->refcount_.fetch_add(1, std::memory_order_relaxed); }
-#endif
 
   void add_successor(Activity* a)
   {
@@ -172,6 +164,14 @@ public:
   }
 
   void* get_user_data() { return user_data_; }
+#ifndef DOXYGEN
+  /* The refcounting is done in the ancestor class, Activity, but we want each of the classes benefiting of the CRTP
+   * (Exec, Comm, etc) to have smart pointers too, so we define these methods here, that forward the ptr_release and
+   * add_ref to the Activity class. Hopefully, the "inline" helps to not hinder the perf here.
+   */
+  friend void inline intrusive_ptr_release(AnyActivity* a) { intrusive_ptr_release(static_cast<Activity*>(a)); }
+  friend void inline intrusive_ptr_add_ref(AnyActivity* a) { intrusive_ptr_add_ref(static_cast<Activity*>(a)); }
+#endif
 };
 
 } // namespace s4u
index 302d6e5..a040274 100644 (file)
@@ -26,7 +26,7 @@ namespace s4u {
 
 /** An actor is an independent stream of execution in your distributed application.
  *
- * \beginrst
+ * \rst
  * It is located on a (simulated) :cpp:class:`host <simgrid::s4u::Host>`, but can interact
  * with the whole simulated platform.
  *
index 11651d3..1f92ec5 100644 (file)
@@ -36,10 +36,14 @@ class XBT_PUBLIC Disk : public xbt::Extendable<Disk> {
   friend kernel::resource::DiskImpl;
 
 protected:
+#ifndef DOXYGEN
   virtual ~Disk() = default;
+#endif
 
 public:
+#ifndef DOXYGEN
   explicit Disk(const std::string& name, kernel::resource::DiskImpl* pimpl) : pimpl_(pimpl), name_(name) {}
+#endif
 
   /** @brief Callback signal fired when a new Disk is created */
   static xbt::signal<void(Disk&)> on_creation;
@@ -66,7 +70,9 @@ public:
 
   IoPtr write_async(sg_size_t size);
   sg_size_t write(sg_size_t size);
+#ifndef DOXYGEN
   kernel::resource::DiskImpl* get_impl() const { return pimpl_; }
+#endif
 };
 
 } // namespace s4u
index 234a82b..6cc8c60 100644 (file)
@@ -91,8 +91,13 @@ protected:
 #endif /*DOXYGEN*/
 
 public:
+  /** Returns the amount of hosts existing in the platform. */
   size_t get_host_count();
-  /** @brief Returns the list of all hosts found in the platform */
+  /** Returns a vector of all hosts found in the platform.
+   *
+   * The order is generally different from the creation/declaration order in the XML platform because we use a hash
+   * table internally.
+   */
   std::vector<Host*> get_all_hosts();
   std::vector<Host*> get_filtered_hosts(const std::function<bool(Host*)>& filter);
   Host* host_by_name(const std::string& name);
index 4870a86..0375c7c 100644 (file)
@@ -36,6 +36,7 @@ namespace s4u {
  * @endrst
  */
 class XBT_PUBLIC Host : public xbt::Extendable<Host> {
+#ifndef DOXYGEN
   friend vm::VMModel;            // Use the pimpl_cpu to compute the VM sharing
   friend vm::VirtualMachineImpl; // creates the the pimpl_cpu
   friend kernel::routing::NetZoneImpl;
@@ -43,13 +44,13 @@ class XBT_PUBLIC Host : public xbt::Extendable<Host> {
 public:
   explicit Host(const std::string& name);
 
-  /** Host destruction logic */
 protected:
   virtual ~Host();
   void set_netpoint(kernel::routing::NetPoint* netpoint) { pimpl_netpoint_ = netpoint; }
 
 private:
   bool currently_destroying_ = false;
+#endif
 
 public:
   /** Called on each newly created host */
@@ -63,9 +64,11 @@ public:
   static xbt::signal<void(Host const&)> on_speed_change;
 
   virtual void destroy();
+#ifndef DOXYGEN
   // No copy/move
   Host(Host const&) = delete;
   Host& operator=(Host const&) = delete;
+#endif
 
   /** Retrieve a host from its name, or return nullptr */
   static Host* by_name_or_null(const std::string& name);
@@ -107,9 +110,34 @@ public:
   void set_state_profile(kernel::profile::Profile* p);
   void set_speed_profile(kernel::profile::Profile* p);
 
+  /** @brief Get the peak computing speed in flops/s at the current pstate, NOT taking the external load into account.
+   *
+   *  The amount of flops per second available for computing depends on several things:
+   *    - The current pstate determines the maximal peak computing speed (use @ref get_pstate_speed() to retrieve the
+   *      computing speed you would get at another pstate)
+   *    - If you declared an external load (with @ref simgrid::surf::Cpu::set_speed_profile()), you must multiply the
+   * result of get_speed() by get_available_speed() to retrieve what a new computation would get.
+   *
+   *  The remaining speed is then shared between the executions located on this host.
+   *  You can retrieve the amount of tasks currently running on this host with @ref get_load().
+   *
+   *  The host may have multiple cores, and your executions may be able to use more than a single core.
+   *
+   *  Finally, executions of priority 2 get twice the amount of flops than executions of priority 1.
+   */
   double get_speed() const;
+  /** @brief Get the available speed ratio, between 0 and 1.
+   *
+   * This accounts for external load (see @ref simgrid::surf::Cpu::set_speed_profile()).
+   */
   double get_available_speed() const;
+  /** Returns the number of core of the processor. */
   int get_core_count() const;
+  /** Returns the current computation load (in flops per second)
+   *
+   * The external load (coming from an availability trace) is not taken in account.
+   * You may also be interested in the load plugin.
+   */
   double get_load() const;
 
   double get_pstate_speed(int pstate_index) const;
index c1c8de5..7d870f1 100644 (file)
@@ -56,7 +56,7 @@ public:
   virtual void register_simcall(smx_simcall_t simcall);
   void clean_action();
   virtual double get_remaining() const;
-  // boost::intrusive_ptr<ActivityImpl> support:
+  // Support for the boost::intrusive_ptr<ActivityImpl> datatype
   friend XBT_PUBLIC void intrusive_ptr_add_ref(ActivityImpl* activity);
   friend XBT_PUBLIC void intrusive_ptr_release(ActivityImpl* activity);
 
index 7a51253..8079ed7 100644 (file)
@@ -27,6 +27,10 @@ namespace mc {
 
 static void setup_child_environment(int socket)
 {
+  /* On startup, simix_global_init() calls simgrid::mc::Client::initialize(), which checks whether the MC_ENV_SOCKET_FD
+   * env variable is set. If so, MC mode is assumed, and the client is setup from its side
+   */
+
 #ifdef __linux__
   // Make sure we do not outlive our parent
   sigset_t mask;
@@ -75,7 +79,7 @@ Session::Session(const std::function<void()>& code)
     ::close(sockets[1]);
     setup_child_environment(sockets[0]);
     code();
-    xbt_die("The model-checked process failed to exec()");
+    xbt_die("The model-checked process failed to exec(): %s", strerror(errno));
   }
 
   // Parent (model-checker):
@@ -95,6 +99,7 @@ Session::~Session()
   this->close();
 }
 
+/** Take the initial snapshot of the application, that must be stopped. */
 void Session::initialize()
 {
   xbt_assert(initial_snapshot_ == nullptr);
@@ -123,7 +128,8 @@ void Session::log_state()
   }
   if (getenv("SIMGRID_MC_SYSTEM_STATISTICS")){
     int ret=system("free");
-    if(ret!=0)XBT_WARN("system call did not return 0, but %d",ret);
+    if (ret != 0)
+      XBT_WARN("Call to system(free) did not return 0, but %d", ret);
   }
 }
 
index 070192e..ebd1a91 100644 (file)
@@ -525,7 +525,6 @@ void CommunicationDeterminismChecker::run()
   mc::session->initialize();
 
   this->prepare();
-
   this->real_run();
 }
 
index e94d23a..d8544e5 100644 (file)
@@ -47,19 +47,25 @@ int main(int argc, char** argv)
   _sg_do_model_check = 1;
 
   // The initialization function can touch argv.
-  // We make a copy of argv before modifying it in order to pass the original
-  // value to the model-checked:
+  // We make a copy of argv before modifying it in order to pass the original value to the model-checked application:
   char** argv_copy = argvdup(argc, argv);
   xbt_log_init(&argc, argv);
 #if HAVE_SMPI
-  smpi_init_options();//only performed once
+  smpi_init_options(); // only performed once
 #endif
   sg_config_init(&argc, argv);
-  simgrid::mc::session = new simgrid::mc::Session([argv_copy] { execvp(argv_copy[1], argv_copy + 1); });
+  simgrid::mc::session = new simgrid::mc::Session([argv_copy] {
+    int i = 1;
+    while (argv_copy[i] != nullptr && argv_copy[i][0] == '-')
+      i++;
+    xbt_assert(argv_copy[i] != nullptr,
+               "Unable to find a binary to exec on the command line. Did you only pass config flags?");
+    execvp(argv_copy[i], argv_copy + i);
+  });
   delete[] argv_copy;
 
-  std::unique_ptr<simgrid::mc::Checker> checker = create_checker(*simgrid::mc::session);
-  int res                                       = SIMGRID_MC_EXIT_SUCCESS;
+  auto checker = create_checker(*simgrid::mc::session);
+  int res      = SIMGRID_MC_EXIT_SUCCESS;
   try {
     checker->run();
   } catch (const simgrid::mc::DeadlockError&) {
index fae0571..93e655a 100644 (file)
@@ -220,16 +220,13 @@ void RemoteClient::init()
   this->init_memory_map_info();
 
   int fd = open_vm(this->pid_, O_RDWR);
-  if (fd < 0)
-    xbt_die("Could not open file for process virtual address space");
+  xbt_assert(fd >= 0, "Could not open file for process virtual address space");
   this->memory_file = fd;
 
   // Read std_heap (is a struct mdesc*):
   const simgrid::mc::Variable* std_heap_var = this->find_variable("__mmalloc_default_mdp");
-  if (not std_heap_var)
-    xbt_die("No heap information in the target process");
-  if (not std_heap_var->address)
-    xbt_die("No constant address for this variable");
+  xbt_assert(std_heap_var, "No heap information in the target process");
+  xbt_assert(std_heap_var->address, "No constant address for this variable");
   this->read_bytes(&this->heap_address, sizeof(mdesc*), remote(std_heap_var->address));
 
   this->smx_actors_infos.clear();
index 038bb3e..d4841f2 100644 (file)
@@ -227,44 +227,19 @@ double Host::get_pstate_speed(int pstate_index) const
   return this->pimpl_cpu->get_pstate_peak_speed(pstate_index);
 }
 
-/** @brief Get the peak computing speed in flops/s at the current pstate, NOT taking the external load into account.
- *
- *  The amount of flops per second available for computing depends on several things:
- *    - The current pstate determines the maximal peak computing speed (use @ref get_pstate_speed() to retrieve the
- *      computing speed you would get at another pstate)
- *    - If you declared an external load (with @ref simgrid::surf::Cpu::set_speed_profile()), you must multiply the
- * result of get_speed() by get_available_speed() to retrieve what a new computation would get.
- *
- *  The remaining speed is then shared between the executions located on this host.
- *  You can retrieve the amount of tasks currently running on this host with @ref get_load().
- *
- *  The host may have multiple cores, and your executions may be able to use more than a single core.
- *
- *  Finally, executions of priority 2 get twice the amount of flops than executions of priority 1.
- */
 double Host::get_speed() const
 {
   return this->pimpl_cpu->get_speed(1.0);
 }
-/** @brief Returns the current computation load (in flops per second)
- *
- * The external load (coming from an availability trace) is not taken in account.
- * You may also be interested in the load plugin.
- */
 double Host::get_load() const
 {
   return this->pimpl_cpu->get_load();
 }
-/** @brief Get the available speed ratio, between 0 and 1.
- *
- * This accounts for external load (see @ref simgrid::surf::Cpu::set_speed_profile()).
- */
 double Host::get_available_speed() const
 {
   return this->pimpl_cpu->get_speed_ratio();
 }
 
-/** @brief Returns the number of core of the processor. */
 int Host::get_core_count() const
 {
   return this->pimpl_cpu->get_core_count();
@@ -336,16 +311,6 @@ size_t sg_host_count()
 {
   return simgrid::s4u::Engine::get_instance()->get_host_count();
 }
-/** @brief Returns the host list
- *
- * Uses sg_host_count() to know the array size.
- *
- * @return an array of @ref sg_host_t containing all the hosts in the platform.
- * @remark The host order in this array is generally different from the
- * creation/declaration order in the XML platform (we use a hash table
- * internally).
- * @see sg_host_count()
- */
 sg_host_t* sg_host_list()
 {
   xbt_assert(sg_host_count() > 0, "There is no host!");
index bb01090..c566740 100644 (file)
@@ -44,7 +44,7 @@ public:
  */
 class XBT_PRIVATE HostImpl : public xbt::PropertyHolder {
   std::vector<kernel::actor::ProcessArg*> actors_at_boot_;
-  s4u::Host* piface_ = nullptr; // FIXME: why don't we store a s4u::Host here as we do everywhere else?
+  s4u::Host* piface_ = nullptr; // we must have a pointer there because the VM wants to change the piface in its ctor
   std::map<std::string, kernel::resource::StorageImpl*> storage_;
   std::vector<kernel::resource::DiskImpl*> disks_;