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)
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)
### 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)
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
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
\_/ \___|_| |___/_|\___/|_| |_| |____(_)_____|____/
(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)
_ _____ ____ _ _
__ _____ _ __ ___(_) ___ _ __ |___ / |___ \| || |
\ \ / / _ \ '__/ __| |/ _ \| '_ \ |_ \ __) | || |_
.. autodoxyvar:: ::const_sg_bar_t
.. autodoxyvar:: ::const_sg_mutex_t
.. autodoxyvar:: ::const_sg_sem_t
-
+.. autodoxyvar:: ::const_sg_host_t
.. autodoxyclass:: simgrid::s4u::Actor
-.. doxygentypedef:: ActorPtr
-
.. doxygentypedef:: aid_t
-Creating actors
----------------
+Basic management
+----------------
.. tabs::
.. 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
from simgrid import Actor
- .. automethod:: simgrid.Actor.create
-
.. group-tab:: C
.. code:: C
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::
.. autodoxymethod:: sg_actor_by_PID(aid_t pid)
.. autodoxymethod:: sg_actor_self()
-Querying info about actors
---------------------------
+Querying info
+-------------
.. tabs::
.. automethod:: simgrid.Engine.get_all_hosts
+ .. group-tab:: C
+
+ See also :cpp:func:`sg_host_list` and :cpp:func:`sg_host_count`.
+
Retrieving links
----------------
.. automethod:: simgrid.Mailbox.by_name
Querying info
-.............
+-------------
.. tabs::
.. autoattribute:: simgrid.Mailbox.name
Sending data
-............
+------------
.. tabs::
Receiving data
-..............
+--------------
.. tabs::
.. autodoxymethod:: sg_mailbox_listen(const char *alias)
Receiving actor
-...............
+---------------
See :ref:`s4u_receiving_actor`.
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:
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:
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
==========
.. autoclass:: simgrid.Host
:members:
-=============
-Class Mailbox
-=============
-
-.. autoclass:: simgrid.Mailbox
- :members:
-
.. |hr| raw:: html
<hr />
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 */
#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();
/**
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 ==============
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
*/
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;
/** 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 {
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)
{
}
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
/** 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.
*
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;
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
#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);
* @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;
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 */
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);
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;
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);
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;
::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):
this->close();
}
+/** Take the initial snapshot of the application, that must be stopped. */
void Session::initialize()
{
xbt_assert(initial_snapshot_ == nullptr);
}
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);
}
}
mc::session->initialize();
this->prepare();
-
this->real_run();
}
_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&) {
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();
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();
{
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!");
*/
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_;