.. group-tab:: C++
.. autodoxymethod:: simgrid::s4u::Actor::on_exit
- .. autodoxymethod:: simgrid::s4u::Actor::join()
- .. autodoxymethod:: simgrid::s4u::Actor::join(double timeout)
+ .. autodoxymethod:: simgrid::s4u::Actor::join() const
+ .. autodoxymethod:: simgrid::s4u::Actor::join(double timeout) const
.. autodoxymethod:: simgrid::s4u::Actor::set_auto_restart(bool autorestart)
.. group-tab:: Python
.. group-tab:: C
- .. autodoxymethod:: sg_actor_join(sg_actor_t actor, double timeout)
+ .. autodoxymethod:: sg_actor_join(const_sg_actor_t actor, double timeout)
.. autodoxymethod:: sg_actor_set_auto_restart(sg_actor_t actor, int auto_restart)
Signals
.. group-tab:: C++
- .. autodoxymethod:: simgrid::s4u::Host::add_disk(Disk *disk)
+ .. autodoxymethod:: simgrid::s4u::Host::add_disk(const Disk* disk)
.. autodoxymethod:: simgrid::s4u::Host::get_actor_count() const
.. autodoxymethod:: simgrid::s4u::Host::get_all_actors() const
.. autodoxymethod:: simgrid::s4u::Host::get_disks() const
.. autodoxymethod:: simgrid::s4u::VirtualMachine::get_pm() const
.. autodoxymethod:: simgrid::s4u::VirtualMachine::get_ramsize() const
- .. autodoxymethod:: simgrid::s4u::VirtualMachine::get_state()
+ .. autodoxymethod:: simgrid::s4u::VirtualMachine::get_state() const
.. autodoxymethod:: simgrid::s4u::VirtualMachine::set_bound(double bound)
.. autodoxymethod:: simgrid::s4u::VirtualMachine::set_pm(Host *pm)
.. autodoxymethod:: simgrid::s4u::Semaphore::acquire()
.. autodoxymethod:: simgrid::s4u::Semaphore::acquire_timeout(double timeout)
- .. autodoxymethod:: simgrid::s4u::Semaphore::get_capacity()
+ .. autodoxymethod:: simgrid::s4u::Semaphore::get_capacity() const
.. autodoxymethod:: simgrid::s4u::Semaphore::release()
- .. autodoxymethod:: simgrid::s4u::Semaphore::would_block()
+ .. autodoxymethod:: simgrid::s4u::Semaphore::would_block() const
.. group-tab:: C
.. autodoxymethod:: sg_sem_acquire(sg_sem_t sem)
.. autodoxymethod:: sg_sem_acquire_timeout(sg_sem_t sem, double timeout)
- .. autodoxymethod:: sg_sem_get_capacity(sg_sem_t sem)
+ .. autodoxymethod:: sg_sem_get_capacity(const_sg_sem_t sem)
.. autodoxymethod:: sg_sem_release(sg_sem_t sem)
- .. autodoxymethod:: sg_sem_would_block(sg_sem_t sem)
+ .. autodoxymethod:: sg_sem_would_block(const_sg_sem_t sem)
.. |hr| raw:: html
static void master(int argc, char* argv[])
{
- sg_actor_t actor;
+ const_sg_actor_t actor;
XBT_INFO("Start sleeper");
actor = sg_actor_create("sleeper from master", sg_host_self(), sleeper, 0, NULL);
~TimeoutException() override;
};
-XBT_ATTRIB_DEPRECATED_v328("Please use simgrid::TimeoutException") typedef TimeoutException TimeoutError;
+using TimeoutError XBT_ATTRIB_DEPRECATED_v328("Please use simgrid::TimeoutException") = TimeoutException;
/** Exception raised when a host fails */
class HostFailureException : public Exception {
} // namespace simgrid
-XBT_ATTRIB_DEPRECATED_v328("Please use simgrid::Exception") typedef simgrid::Exception xbt_ex;
+using xbt_ex XBT_ATTRIB_DEPRECATED_v328("Please use simgrid::Exception") = simgrid::Exception;
#endif
#endif
XBT_PUBLIC void sg_actor_set_host(sg_actor_t actor, sg_host_t host);
-XBT_PUBLIC void sg_actor_join(sg_actor_t actor, double timeout);
+XBT_PUBLIC void sg_actor_join(const_sg_actor_t actor, double timeout);
XBT_PUBLIC void sg_actor_kill(sg_actor_t actor);
XBT_PUBLIC void sg_actor_kill_all();
XBT_PUBLIC void sg_actor_set_kill_time(sg_actor_t actor, double kill_time);
class EngineImpl;
namespace actor {
class ActorImpl;
-typedef boost::intrusive_ptr<ActorImpl> ActorImplPtr;
+using ActorImplPtr = boost::intrusive_ptr<ActorImpl>;
// What's executed as an actor code:
-typedef std::function<void()> ActorCode;
+using ActorCode = std::function<void()>;
// Create an ActorCode from the parameters parsed in the XML file (or elsewhere)
-typedef std::function<ActorCode(std::vector<std::string> args)> ActorCodeFactory;
+using ActorCodeFactory = std::function<ActorCode(std::vector<std::string> args)>;
} // namespace actor
namespace activity {
class ActivityImpl;
enum class State;
- typedef boost::intrusive_ptr<ActivityImpl> ActivityImplPtr;
+ using ActivityImplPtr = boost::intrusive_ptr<ActivityImpl>;
XBT_PUBLIC void intrusive_ptr_add_ref(ActivityImpl* activity);
XBT_PUBLIC void intrusive_ptr_release(ActivityImpl* activity);
class ConditionVariableImpl;
class CommImpl;
- typedef boost::intrusive_ptr<CommImpl> CommImplPtr;
+ using CommImplPtr = boost::intrusive_ptr<CommImpl>;
class ExecImpl;
- typedef boost::intrusive_ptr<ExecImpl> ExecImplPtr;
+ using ExecImplPtr = boost::intrusive_ptr<ExecImpl>;
class IoImpl;
- typedef boost::intrusive_ptr<IoImpl> IoImplPtr;
+ using IoImplPtr = boost::intrusive_ptr<IoImpl>;
class MutexImpl;
- typedef boost::intrusive_ptr<MutexImpl> MutexImplPtr;
+ using MutexImplPtr = boost::intrusive_ptr<MutexImpl>;
class RawImpl;
- typedef boost::intrusive_ptr<RawImpl> RawImplPtr;
+ using RawImplPtr = boost::intrusive_ptr<RawImpl>;
class SemaphoreImpl;
- typedef boost::intrusive_ptr<SemaphoreImpl> SemaphoreImplPtr;
+ using SemaphoreImplPtr = boost::intrusive_ptr<SemaphoreImpl>;
class SleepImpl;
- typedef boost::intrusive_ptr<SleepImpl> SleepImplPtr;
+ using SleepImplPtr = boost::intrusive_ptr<SleepImpl>;
class MailboxImpl;
}
} // namespace vm
} // namespace simgrid
-typedef simgrid::s4u::Actor s4u_Actor;
-typedef simgrid::s4u::Barrier s4u_Barrier;
-typedef simgrid::s4u::Comm s4u_Comm;
-typedef simgrid::s4u::Exec s4u_Exec;
-typedef simgrid::s4u::Host s4u_Host;
-typedef simgrid::s4u::Link s4u_Link;
-typedef simgrid::s4u::File s4u_File;
-typedef simgrid::s4u::ConditionVariable s4u_ConditionVariable;
-typedef simgrid::s4u::Mailbox s4u_Mailbox;
-typedef simgrid::s4u::Mutex s4u_Mutex;
-typedef simgrid::s4u::Semaphore s4u_Semaphore;
-typedef simgrid::s4u::Disk s4u_Disk;
-typedef simgrid::s4u::Storage s4u_Storage;
-typedef simgrid::s4u::NetZone s4u_NetZone;
-typedef simgrid::s4u::VirtualMachine s4u_VM;
-
-typedef simgrid::simix::Timer* smx_timer_t;
-typedef simgrid::kernel::actor::ActorImpl* smx_actor_t;
-typedef simgrid::kernel::activity::ActivityImpl* smx_activity_t;
-typedef simgrid::kernel::activity::ConditionVariableImpl* smx_cond_t;
-typedef simgrid::kernel::activity::MailboxImpl* smx_mailbox_t;
-typedef simgrid::kernel::activity::MutexImpl* smx_mutex_t;
-typedef simgrid::kernel::activity::SemaphoreImpl* smx_sem_t;
-XBT_ATTRIB_DEPRECATED_v330("Please use kernel::activity::State") typedef simgrid::kernel::activity::State e_smx_state_t;
+using s4u_Actor = simgrid::s4u::Actor;
+using s4u_Barrier = simgrid::s4u::Barrier;
+using s4u_Comm = simgrid::s4u::Comm;
+using s4u_Exec = simgrid::s4u::Exec;
+using s4u_Host = simgrid::s4u::Host;
+using s4u_Link = simgrid::s4u::Link;
+using s4u_File = simgrid::s4u::File;
+using s4u_ConditionVariable = simgrid::s4u::ConditionVariable;
+using s4u_Mailbox = simgrid::s4u::Mailbox;
+using s4u_Mutex = simgrid::s4u::Mutex;
+using s4u_Semaphore = simgrid::s4u::Semaphore;
+using s4u_Disk = simgrid::s4u::Disk;
+using s4u_Storage = simgrid::s4u::Storage;
+using s4u_NetZone = simgrid::s4u::NetZone;
+using s4u_VM = simgrid::s4u::VirtualMachine;
+
+using smx_timer_t = simgrid::simix::Timer*;
+using smx_actor_t = simgrid::kernel::actor::ActorImpl*;
+using smx_activity_t = simgrid::kernel::activity::ActivityImpl*;
+using smx_cond_t = simgrid::kernel::activity::ConditionVariableImpl*;
+using smx_mailbox_t = simgrid::kernel::activity::MailboxImpl*;
+using smx_mutex_t = simgrid::kernel::activity::MutexImpl*;
+using smx_sem_t = simgrid::kernel::activity::SemaphoreImpl*;
+using e_smx_state_t XBT_ATTRIB_DEPRECATED_v330("Please use kernel::activity::State") = simgrid::kernel::activity::State;
#else
typedef struct s4u_Actor s4u_Actor;
} // namespace jedule
} // namespace simgrid
-typedef simgrid::jedule::Jedule *jedule_t;
+using jedule_t = simgrid::jedule::Jedule*;
#endif /* JEDULE_HPP_ */
}
}
-typedef simgrid::jedule::Event* jed_event_t;
+using jed_event_t = simgrid::jedule::Event*;
#endif /* JEDULE_EVENTS_H_ */
} // namespace jedule
} // namespace simgrid
-typedef simgrid::jedule::Container * jed_container_t;
+using jed_container_t = simgrid::jedule::Container*;
void get_resource_selection_by_hosts(std::vector<simgrid::jedule::Subset>& subset_list,
const std::vector<sg_host_t>& host_list);
*/
template <class F> auto then_no_unwrap(F continuation) -> Future<decltype(continuation(std::move(*this)))>
{
- typedef decltype(continuation(std::move(*this))) R;
+ using R = decltype(continuation(std::move(*this)));
if (state_ == nullptr)
throw std::future_error(std::future_errc::no_state);
auto state = std::move(state_);
namespace kernel {
namespace resource {
-typedef std::pair<double, Action*> heap_element_type;
-typedef boost::heap::pairing_heap<heap_element_type, boost::heap::constant_time_size<false>, boost::heap::stable<true>,
- boost::heap::compare<simgrid::xbt::HeapComparator<heap_element_type>>>
- heap_type;
+using heap_element_type = std::pair<double, Action*>;
+using heap_type =
+ boost::heap::pairing_heap<heap_element_type, boost::heap::constant_time_size<false>, boost::heap::stable<true>,
+ boost::heap::compare<simgrid::xbt::HeapComparator<heap_element_type>>>;
-typedef std::pair<double, Action*> heap_element_type;
class XBT_PUBLIC ActionHeap : public heap_type {
friend Action;
/* Lazy update needs this Set hook to maintain a list of the tracked actions */
boost::intrusive::list_member_hook<> modified_set_hook_;
bool is_within_modified_set() const { return modified_set_hook_.is_linked(); }
- typedef boost::intrusive::list<
- Action, boost::intrusive::member_hook<Action, boost::intrusive::list_member_hook<>, &Action::modified_set_hook_>>
- ModifiedSet;
+ using ModifiedSet = boost::intrusive::list<
+ Action, boost::intrusive::member_hook<Action, boost::intrusive::list_member_hook<>, &Action::modified_set_hook_>>;
boost::intrusive::list_member_hook<> state_set_hook_;
- typedef boost::intrusive::list<
- Action, boost::intrusive::member_hook<Action, boost::intrusive::list_member_hook<>, &Action::state_set_hook_>>
- StateSet;
+ using StateSet = boost::intrusive::list<
+ Action, boost::intrusive::member_hook<Action, boost::intrusive::list_member_hook<>, &Action::state_set_hook_>>;
enum class State {
INITED, /**< Created, but not started yet */
class Task;
}
}
-typedef simgrid::msg::Comm sg_msg_Comm;
-typedef simgrid::msg::Task sg_msg_Task;
+using sg_msg_Comm = simgrid::msg::Comm;
+using sg_msg_Task = simgrid::msg::Task;
#else
typedef struct msg_Comm sg_msg_Comm;
typedef struct msg_Task sg_msg_Task;
* @param process the process to wait for
* @param timeout wait until the process is over, or the timeout occurs
*/
-XBT_PUBLIC void MSG_process_join(msg_process_t process, double timeout);
+XBT_PUBLIC void MSG_process_join(const_sg_actor_t process, double timeout);
/** @brief Kills a process */
XBT_PUBLIC void MSG_process_kill(msg_process_t process);
/** @brief Kill all running process */
XBT_PUBLIC void MSG_sem_acquire(msg_sem_t sem);
XBT_PUBLIC int MSG_sem_acquire_timeout(msg_sem_t sem, double timeout);
XBT_PUBLIC void MSG_sem_release(msg_sem_t sem);
-XBT_PUBLIC int MSG_sem_get_capacity(msg_sem_t sem);
+XBT_PUBLIC int MSG_sem_get_capacity(const_sg_sem_t sem);
XBT_PUBLIC void MSG_sem_destroy(const_sg_sem_t sem);
-XBT_PUBLIC int MSG_sem_would_block(msg_sem_t sem);
+XBT_PUBLIC int MSG_sem_would_block(const_sg_sem_t sem);
/** @brief Opaque type representing a barrier identifier */
typedef sg_bar_t msg_bar_t;
* Blocks the calling actor until the joined actor is terminated. If actor alice executes bob.join(), then alice is
* blocked until bob terminates.
*/
- void join();
+ void join() const;
/** Wait for the actor to finish, or for the timeout to elapse.
*
* Blocks the calling actor until the joined actor is terminated. If actor alice executes bob.join(), then alice is
* blocked until bob terminates.
*/
- void join(double timeout);
+ void join(double timeout) const;
/** Kill that actor and restart it from start. */
Actor* restart();
int get_pstate() const;
std::vector<Disk*> get_disks() const;
- void add_disk(Disk* disk);
+ void add_disk(const Disk* disk);
void remove_disk(const std::string& disk_name);
std::vector<const char*> get_attached_storages() const;
void acquire();
int acquire_timeout(double timeout);
void release();
- int get_capacity();
- int would_block();
+ int get_capacity() const;
+ int would_block() const;
};
} // namespace s4u
VirtualMachine* set_ramsize(size_t ramsize);
VirtualMachine* set_bound(double bound);
- VirtualMachine::state get_state();
+ VirtualMachine::state get_state() const;
static xbt::signal<void(VirtualMachine const&)> on_start;
static xbt::signal<void(VirtualMachine const&)> on_started;
static xbt::signal<void(VirtualMachine const&)> on_shutdown;
XBT_PUBLIC void sg_sem_acquire(sg_sem_t sem);
XBT_PUBLIC int sg_sem_acquire_timeout(sg_sem_t sem, double timeout);
XBT_PUBLIC void sg_sem_release(sg_sem_t sem);
-XBT_PUBLIC int sg_sem_get_capacity(sg_sem_t sem);
+XBT_PUBLIC int sg_sem_get_capacity(const_sg_sem_t sem);
XBT_PUBLIC void sg_sem_destroy(const_sg_sem_t sem);
-XBT_PUBLIC int sg_sem_would_block(sg_sem_t sem);
+XBT_PUBLIC int sg_sem_would_block(const_sg_sem_t sem);
SG_END_DECL
// If we are in the application, pass the code to the maestro which
// executes it for us and reports the result. We use a std::future which
// conveniently handles the success/failure value for us.
- typedef typename std::result_of<F()>::type R;
+ using R = typename std::result_of<F()>::type;
simgrid::xbt::Result<R> result;
simcall_run_kernel([&result, &code] { simgrid::xbt::fulfill_promise(result, std::forward<F>(code)); }, t);
return result.get();
namespace simgrid {
namespace simix {
-
-typedef std::pair<double, Timer*> TimerQelt;
+using TimerQelt = std::pair<double, Timer*>;
static boost::heap::fibonacci_heap<TimerQelt, boost::heap::compare<xbt::HeapComparator<TimerQelt>>> simix_timers;
/** @brief Timer datatype */
*/
template <class F> auto kernel_sync(F code) -> decltype(code().get())
{
- typedef decltype(code().get()) T;
+ using T = decltype(code().get());
if (SIMIX_is_maestro())
xbt_die("Can't execute blocking call in kernel mode");
template <class T>
class Future {
public:
- Future() { /* Nothing to do*/}
+ Future() = default;
explicit Future(simgrid::kernel::Future<T> future) : future_(std::move(future)) {}
Future(Future&&) noexcept = default;
Future& operator=(Future&&) noexcept = default;
*/
template <class F> auto kernel_async(F code) -> Future<decltype(code().get())>
{
- typedef decltype(code().get()) T;
+ using T = decltype(code().get());
// Execute the code in the kernel and get the kernel future:
simgrid::kernel::Future<T> future = simgrid::kernel::actor::simcall(std::move(code));
}
}
-typedef simgrid::smpi::Comm SMPI_Comm;
-typedef simgrid::smpi::Datatype SMPI_Datatype;
-typedef simgrid::smpi::Errhandler SMPI_Errhandler;
-typedef simgrid::smpi::File SMPI_File;
-typedef simgrid::smpi::Group SMPI_Group;
-typedef simgrid::smpi::Info SMPI_Info;
-typedef simgrid::smpi::Op SMPI_Op;
-typedef simgrid::smpi::Request SMPI_Request;
-typedef simgrid::smpi::Topo SMPI_Topology;
-typedef simgrid::smpi::Topo_Cart SMPI_Cart_topology;
-typedef simgrid::smpi::Topo_Dist_Graph SMPI_Dist_Graph_topology;
-typedef simgrid::smpi::Topo_Graph SMPI_Graph_topology;
-typedef simgrid::smpi::Win SMPI_Win;
+using SMPI_Comm = simgrid::smpi::Comm;
+using SMPI_Datatype = simgrid::smpi::Datatype;
+using SMPI_Errhandler = simgrid::smpi::Errhandler;
+using SMPI_File = simgrid::smpi::File;
+using SMPI_Group = simgrid::smpi::Group;
+using SMPI_Info = simgrid::smpi::Info;
+using SMPI_Op = simgrid::smpi::Op;
+using SMPI_Request = simgrid::smpi::Request;
+using SMPI_Topology = simgrid::smpi::Topo;
+using SMPI_Cart_topology = simgrid::smpi::Topo_Cart;
+using SMPI_Dist_Graph_topology = simgrid::smpi::Topo_Dist_Graph;
+using SMPI_Graph_topology = simgrid::smpi::Topo_Graph;
+using SMPI_Win = simgrid::smpi::Win;
#else
/** @brief Configuration set's data type is opaque. */
#ifdef __cplusplus
#include <xbt/config.hpp>
-typedef simgrid::config::Config* xbt_cfg_t;
+using xbt_cfg_t = simgrid::config::Config*;
#else
typedef void* xbt_cfg_t;
#endif
struct whatever {};
// Union used for storage:
- typedef typename std::aligned_union<0,
- void*,
- std::pair<void(*)(),void*>,
- std::pair<void(whatever::*)(), whatever*>
- >::type TaskUnion;
+ using TaskUnion = typename std::aligned_union<0, void*, std::pair<void (*)(), void*>,
+ std::pair<void (whatever::*)(), whatever*>>::type;
// Is F suitable for small buffer optimization?
template<class F>
"SBO not working for reference_wrapper");
// Call (and possibly destroy) the function:
- typedef R (*call_function)(TaskUnion&, Args...);
+ using call_function = R (*)(TaskUnion&, Args...);
// Destroy the function (of needed):
- typedef void (*destroy_function)(TaskUnion&);
+ using destroy_function = void (*)(TaskUnion&);
// Move the function (otherwise memcpy):
- typedef void (*move_function)(TaskUnion& dest, TaskUnion& src);
+ using move_function = void (*)(TaskUnion& dest, TaskUnion& src);
// Vtable of functions for manipulating whatever is in the TaskUnion:
struct TaskVtable {
class TaskImpl {
F code_;
std::tuple<Args...> args_;
- typedef decltype(simgrid::xbt::apply(std::move(code_), std::move(args_))) result_type;
+ using result_type = decltype(simgrid::xbt::apply(std::move(code_), std::move(args_)));
+
public:
TaskImpl(F code, std::tuple<Args...> args) :
code_(std::move(code)),
namespace simgrid {
namespace xbt {
/* To split the file if a unique one is given (specific variable for the other case live in runner()) */
-typedef std::vector<std::string> ReplayAction;
+using ReplayAction = std::vector<std::string>;
XBT_PUBLIC_DATA std::ifstream* action_fs;
XBT_PUBLIC int replay_runner(const char* actor_name, const char* trace_filename);
}
}
-typedef std::function<void(simgrid::xbt::ReplayAction&)> action_fun;
+using action_fun = std::function<void(simgrid::xbt::ReplayAction&)>;
XBT_PUBLIC void xbt_replay_action_register(const char* action_name, const action_fun& function);
XBT_PUBLIC action_fun xbt_replay_action_get(const char* action_name);
*/
template<class R, class... P>
class signal<R(P...)> {
- typedef std::function<R(P...)> callback_type;
+ using callback_type = std::function<R(P...)>;
std::map<unsigned int, callback_type> handlers_;
unsigned int callback_sequence_id = 0;
public:
// Types
- typedef std::size_t size_type;
- typedef char& reference;
- typedef const char& const_reference;
- typedef char* iterator;
- typedef const char* const_iterator;
+ using size_type = std::size_t;
+ using reference = char&;
+ using const_reference = const char&;
+ using iterator = char*;
+ using const_iterator = const char*;
// Dtor
~string()
std::vector<jobject> vms;
for (size_t i = 0; i < host_count; i++) {
- auto* vm = dynamic_cast<simgrid::s4u::VirtualMachine*>(hosts[i]);
+ const auto* vm = dynamic_cast<simgrid::s4u::VirtualMachine*>(hosts[i]);
if (vm != nullptr && vm->get_state() != simgrid::s4u::VirtualMachine::state::DESTROYED) {
auto jvm = static_cast<jobject>(vm->extension(JAVA_HOST_LEVEL));
vms.push_back(jvm);
namespace {
-static std::string get_simgrid_version()
+std::string get_simgrid_version()
{
int major;
int minor;
.def("is_daemon", &Actor::is_daemon,
"Returns True if that actor is a daemon and will be terminated automatically when the last non-daemon actor "
"terminates.")
- .def("join", py::overload_cast<double>(&Actor::join), py::call_guard<GilScopedRelease>(),
+ .def("join", py::overload_cast<double>(&Actor::join, py::const_), py::call_guard<GilScopedRelease>(),
"Wait for the actor to finish (more info in the C++ documentation).", py::arg("timeout"))
.def("kill", &Actor::kill, py::call_guard<GilScopedRelease>(), "Kill that actor")
.def("kill_all", &Actor::kill_all, py::call_guard<GilScopedRelease>(), "Kill all actors but the caller.")
template <typename T> void Parmap<T>::PosixSynchro::master_wait()
{
std::unique_lock<std::mutex> lk(done_mutex);
- while (this->parmap.thread_counter < this->parmap.num_workers) {
- /* wait for all workers to be ready */
- done_cond.wait(lk);
- }
+ /* wait for all workers to be ready */
+ done_cond.wait(lk, [this]() { return this->parmap.thread_counter >= this->parmap.num_workers; });
}
template <typename T> void Parmap<T>::PosixSynchro::worker_signal()
{
std::unique_lock<std::mutex> lk(ready_mutex);
/* wait for more work */
- while (this->parmap.work_round != round) {
- ready_cond.wait(lk);
- }
+ ready_cond.wait(lk, [this, round]() { return this->parmap.work_round == round; });
}
#if HAVE_FUTEX_H
actor->on_exit->emplace_back(fun);
}
-/** @brief Restart a process, starting it again from the beginning. */
-/**
- * @ingroup simix_process_management
- * @brief Creates and runs a new SIMIX process.
- *
- * The structure and the corresponding thread are created and put in the list of ready processes.
- *
- * @param name a name for the process. It is for user-level information and can be nullptr.
- * @param code the main function of the process
- * @param data a pointer to any data one may want to attach to the new object. It is for user-level information and can
- * be nullptr.
- * It can be retrieved with the method ActorImpl::getUserData().
- * @param host where the new agent is executed.
- * @param properties the properties of the process
- */
-smx_actor_t simcall_process_create(const std::string& name, const simgrid::kernel::actor::ActorCode& code, void* data,
- sg_host_t host, std::unordered_map<std::string, std::string>* properties)
-{
- smx_actor_t self = simgrid::kernel::actor::ActorImpl::self();
- return simgrid::kernel::actor::simcall([&name, &code, data, host, properties, self] {
- return simgrid::kernel::actor::ActorImpl::create(name, code, data, host, properties, self).get();
- });
-}
-
void simcall_process_set_data(smx_actor_t process, void* data) // XBT_ATTRIB_DEPRECATED_v329
{
simgrid::kernel::actor::simcall([process, data] { process->set_user_data(data); });
};
/* Used to keep the list of actors blocked on a synchro */
-typedef boost::intrusive::list<ActorImpl, boost::intrusive::member_hook<ActorImpl, boost::intrusive::list_member_hook<>,
- &ActorImpl::smx_synchro_hook>>
- SynchroList;
+using SynchroList =
+ boost::intrusive::list<ActorImpl, boost::intrusive::member_hook<ActorImpl, boost::intrusive::list_member_hook<>,
+ &ActorImpl::smx_synchro_hook>>;
XBT_PUBLIC void create_maestro(const std::function<void()>& code);
XBT_PUBLIC int get_maxpid();
extern void (*SMPI_switch_data_segment)(simgrid::s4u::ActorPtr actor);
-XBT_PUBLIC smx_actor_t simcall_process_create(const std::string& name, const simgrid::kernel::actor::ActorCode& code,
- void* data, sg_host_t host,
- std::unordered_map<std::string, std::string>* properties);
-
#endif
/* This allows Java to hijack the context factory (Java induces factories of factory :) */
-typedef ContextFactory* (*ContextFactoryInitializer)();
+using ContextFactoryInitializer = ContextFactory* (*)();
XBT_PUBLIC_DATA ContextFactoryInitializer factory_initializer;
XBT_PRIVATE ContextFactory* thread_factory();
private:
#if BOOST_VERSION < 106100
boost::context::fcontext_t fc_;
- typedef intptr_t arg_type;
+ using arg_type = intptr_t;
#else
boost::context::detail::fcontext_t fc_;
- typedef boost::context::detail::transfer_t arg_type;
+ using arg_type = boost::context::detail::transfer_t;
#endif
XBT_ATTRIB_NORETURN static void wrapper(arg_type arg);
// Raw context routines
-typedef void (*rawctx_entry_point_t)(simgrid::kernel::context::SwappedContext*);
+using rawctx_entry_point_t = void (*)(simgrid::kernel::context::SwappedContext*);
-typedef void* raw_stack_t;
+using raw_stack_t = void*;
extern "C" raw_stack_t raw_makecontext(void* malloced_stack, int stack_size, rawctx_entry_point_t entry_point,
simgrid::kernel::context::SwappedContext* arg);
extern "C" void raw_swapcontext(raw_stack_t* old, raw_stack_t new_context);
namespace kernel {
namespace lmm {
-typedef std::vector<int> dyn_light_t;
+using dyn_light_t = std::vector<int>;
int Variable::next_rank_ = 1;
int Constraint::next_rank_ = 1;
resource::Action::ModifiedSet* modified_set_ = nullptr;
private:
- typedef std::vector<int> dyn_light_t;
-
+ using dyn_light_t = std::vector<int>;
+
//Data used in lmm::solve
std::vector<ConstraintLight> cnst_light_vec;
dyn_light_t saturated_constraints;
void add_event(double date, Event* evt);
private:
- typedef std::pair<double, Event*> Qelt;
+ using Qelt = std::pair<double, Event*>;
std::priority_queue<Qelt, std::vector<Qelt>, std::greater<>> heap_;
};
int nr_nodes = xbt_dynar_length(nodes);
std::vector<double> cost_arr(nr_nodes); /* link cost from src to other hosts */
pred_arr.resize(nr_nodes); /* predecessors in path from src */
- typedef std::pair<double, int> Qelt;
+ using Qelt = std::pair<double, int>;
std::priority_queue<Qelt, std::vector<Qelt>, std::greater<>> pqueue;
/* initialize */
if (property_automaton == nullptr)
property_automaton = xbt_automaton_new();
- RemoteSimulation* process = &this->get_remote_simulation();
+ const RemoteSimulation* process = &this->get_remote_simulation();
RemotePtr<int> address = remote((int*)message.data);
xbt::add_proposition(property_automaton, message.name, [process, address]() { return process->read(address); });
}
};
-typedef std::array<HeapLocation, 2> HeapLocationPair;
-typedef std::set<HeapLocationPair> HeapLocationPairs;
+using HeapLocationPair = std::array<HeapLocation, 2>;
+using HeapLocationPairs = std::set<HeapLocationPair>;
class HeapArea : public HeapLocation {
public:
* just a sequence of dwarf instructions. We currently directly use
* `Dwarf_Op` from `dwarf.h` for dwarf instructions.
*/
-typedef std::vector<Dwarf_Op> DwarfExpression;
+using DwarfExpression = std::vector<Dwarf_Op>;
/** Context of evaluation of a DWARF expression
*
*/
class ExpressionStack {
public:
- typedef std::uintptr_t value_type;
+ using value_type = std::uintptr_t;
static const std::size_t max_size = 64;
private:
/** A DWARF expression with optional validity constraints */
class LocationListEntry {
public:
- typedef simgrid::xbt::Range<std::uint64_t> range_type;
+ using range_type = simgrid::xbt::Range<std::uint64_t>;
private:
DwarfExpression expression_;
bool valid_for_ip(unw_word_t ip) const { return range_.contain(ip); }
};
-typedef std::vector<LocationListEntry> LocationList;
+using LocationList = std::vector<LocationListEntry>;
/** Location of some variable in memory
*
void ObjectInformation::remove_global_variable(const char* name)
{
- typedef std::vector<Variable>::size_type size_type;
+ using size_type = std::vector<Variable>::size_type;
if (this->global_variables.empty())
return;
static void remove_local_variable(Frame& scope, const char* var_name, const char* subprogram_name,
Frame const& subprogram)
{
- typedef std::vector<Variable>::size_type size_type;
+ using size_type = std::vector<Variable>::size_type;
// If the current subprogram matches the given name:
if ((subprogram_name == nullptr || (not subprogram.name.empty() && subprogram.name == subprogram_name)) &&
*/
class Member {
public:
- typedef int flags_type;
+ using flags_type = int;
static constexpr flags_type INHERITANCE_FLAG = 1;
static constexpr flags_type VIRTUAL_POINTER_FLAG = 2;
namespace simgrid {
namespace mc {
-typedef std::uint64_t hash_type;
+using hash_type = std::uint64_t;
XBT_PRIVATE hash_type hash(simgrid::mc::Snapshot const& snapshot);
namespace simgrid {
namespace mc {
-typedef std::vector<Transition> RecordTrace;
+using RecordTrace = std::vector<Transition>;
/** Convert a string representation of the path into an array of `simgrid::mc::Transition`
*/
"libcrypt",
"libcrypto",
"libcurl",
+ "libcurl-gnutls",
"libcxxrt",
"libdebuginfod",
"libdl",
"libelf",
"libevent",
"libexecinfo",
+ "libffi",
"libflang",
"libflangrti",
"libgcc_s",
+ "libgmp",
+ "libgnutls",
+ "libgcrypt",
"libgfortran",
+ "libgpg-error",
"libgssapi_krb5",
+ "libhogweed",
"libidn2",
"libimf",
"libintlc",
"libkrb5support", /*odd behaviour on fedora rawhide ... remove these when fixed*/
"liblber",
"libldap",
+ "libldap_r",
"liblua5.1",
"liblua5.3",
"liblzma",
"libm",
"libmd",
+ "libnettle",
"libnghttp2",
"libomp",
+ "libp11-kit",
"libpapi",
"libpcre2",
"libpfm",
"libquadmath",
"libresolv",
"librt",
+ "librtmp",
"libsasl2",
"libselinux",
"libssh",
"libssl",
"libstdc++",
"libsvml",
+ "libtasn1",
"libtsan", /* gcc sanitizers */
"libubsan", /* gcc sanitizers */
"libunistring",
return;
}
- typedef std::vector<IgnoredHeapRegion>::size_type size_type;
+ using size_type = std::vector<IgnoredHeapRegion>::size_type;
size_type start = 0;
size_type end = ignored_heap_.size() - 1;
void RemoteSimulation::unignore_heap(void* address, size_t size)
{
- typedef std::vector<IgnoredHeapRegion>::size_type size_type;
+ using size_type = std::vector<IgnoredHeapRegion>::size_type;
size_type start = 0;
size_type end = ignored_heap_.size() - 1;
*/
class PageStore {
public: // Types
- typedef std::uint64_t hash_type;
+ using hash_type = std::uint64_t;
private:
// Types
// We are using a cheap hash to index a page.
// We should expect collision and we need to associate multiple page indices
// to the same hash.
- typedef std::unordered_set<std::size_t> page_set_type;
- typedef std::unordered_map<hash_type, page_set_type> pages_map_type;
+ using page_set_type = std::unordered_set<std::size_t>;
+ using pages_map_type = std::unordered_map<hash_type, page_set_type>;
// Fields:
/** First page */
std::string frame_name;
unw_cursor_t unw_cursor;
};
-typedef s_mc_stack_frame_t* mc_stack_frame_t;
+using mc_stack_frame_t = s_mc_stack_frame_t*;
struct s_local_variable_t {
simgrid::mc::Frame* subprogram;
simgrid::mc::Type* type;
void* address;
};
-typedef s_local_variable_t* local_variable_t;
-typedef const s_local_variable_t* const_local_variable_t;
+using local_variable_t = s_local_variable_t*;
+using const_local_variable_t = const s_local_variable_t*;
struct XBT_PRIVATE s_mc_snapshot_stack_t {
std::vector<s_local_variable_t> local_variables;
simgrid::mc::UnwindContext context;
std::vector<s_mc_stack_frame_t> stack_frames;
};
-typedef s_mc_snapshot_stack_t* mc_snapshot_stack_t;
-typedef const s_mc_snapshot_stack_t* const_mc_snapshot_stack_t;
+using mc_snapshot_stack_t = s_mc_snapshot_stack_t*;
+using const_mc_snapshot_stack_t = const s_mc_snapshot_stack_t*;
namespace simgrid {
namespace mc {
{
sg_actor_set_host(actor, host);
}
-void MSG_process_join(sg_actor_t actor, double timeout)
+void MSG_process_join(const_sg_actor_t actor, double timeout)
{
sg_actor_join(actor, timeout);
}
{
sg_sem_release(sem);
}
-int MSG_sem_get_capacity(sg_sem_t sem)
+int MSG_sem_get_capacity(const_sg_sem_t sem)
{
return sg_sem_get_capacity(sem);
}
{
sg_sem_destroy(sem);
}
-int MSG_sem_would_block(sg_sem_t sem)
+int MSG_sem_would_block(const_sg_sem_t sem)
{
return sg_sem_would_block(sem);
}
simgrid::s4u::Host* remote_host = simgrid::s4u::Host::by_name_or_null(tokens[2]);
xbt_assert(remote_host, "You're trying to access a host that does not exist. Please check your platform file");
- simgrid::s4u::Disk* disk = nullptr;
+ const simgrid::s4u::Disk* disk = nullptr;
for (auto const& d : remote_host->get_disks())
if (d->get_name() == tokens[1]) {
disk = d;
return this;
}
-VirtualMachine::state VirtualMachine::get_state()
+VirtualMachine::state VirtualMachine::get_state() const
{
return kernel::actor::simcall([this]() { return pimpl_vm_->get_state(); });
}
ActorPtr Actor::init(const std::string& name, s4u::Host* host)
{
- kernel::actor::ActorImpl* self = kernel::actor::ActorImpl::self();
+ const kernel::actor::ActorImpl* self = kernel::actor::ActorImpl::self();
kernel::actor::ActorImpl* actor =
kernel::actor::simcall([self, &name, host] { return self->init(name, host).get(); });
return actor->get_iface();
ActorPtr Actor::create(const std::string& name, s4u::Host* host, const std::function<void()>& code)
{
- kernel::actor::ActorImpl* self = kernel::actor::ActorImpl::self();
+ const kernel::actor::ActorImpl* self = kernel::actor::ActorImpl::self();
kernel::actor::ActorImpl* actor =
kernel::actor::simcall([self, &name, host, &code] { return self->init(name, host)->start(code); });
// ***** Actor methods *****
-void Actor::join()
+void Actor::join() const
{
join(-1);
}
-void Actor::join(double timeout)
+void Actor::join(double timeout) const
{
kernel::actor::ActorImpl* issuer = kernel::actor::ActorImpl::self();
- kernel::actor::ActorImpl* target = pimpl_;
+ const kernel::actor::ActorImpl* target = pimpl_;
kernel::actor::simcall_blocking<void>([issuer, target, timeout] {
if (target->finished_) {
// The joined process is already finished, just wake up the issuer right away
void Actor::kill()
{
- kernel::actor::ActorImpl* self = kernel::actor::ActorImpl::self();
+ const kernel::actor::ActorImpl* self = kernel::actor::ActorImpl::self();
kernel::actor::simcall([this, self] { self->kill(pimpl_); });
}
void Actor::kill_all()
{
- kernel::actor::ActorImpl* self = kernel::actor::ActorImpl::self();
+ const kernel::actor::ActorImpl* self = kernel::actor::ActorImpl::self();
kernel::actor::simcall([self] { self->kill_all(); });
}
* @param actor the actor to wait for
* @param timeout wait until the actor is over, or the timeout expires
*/
-void sg_actor_join(sg_actor_t actor, double timeout)
+void sg_actor_join(const_sg_actor_t actor, double timeout)
{
actor->join(timeout);
}
void Host::turn_off()
{
if (is_on()) {
- kernel::actor::ActorImpl* self = kernel::actor::ActorImpl::self();
+ const kernel::actor::ActorImpl* self = kernel::actor::ActorImpl::self();
kernel::actor::simcall([this, self] {
for (VirtualMachine* const& vm : vm::VirtualMachineImpl::allVms_)
if (vm->get_pm() == this) {
return kernel::actor::simcall([this] { return this->pimpl_->get_disks(); });
}
-void Host::add_disk(Disk* disk)
+void Host::add_disk(const Disk* disk)
{
kernel::actor::simcall([this, disk] { this->pimpl_->add_disk(disk); });
}
kernel::actor::simcall([this] { sem_->release(); });
}
-int Semaphore::get_capacity()
+int Semaphore::get_capacity() const
{
return kernel::actor::simcall([this] { return sem_->get_capacity(); });
}
-int Semaphore::would_block()
+int Semaphore::would_block() const
{
return kernel::actor::simcall([this] { return sem_->would_block(); });
}
sem->release();
}
-int sg_sem_get_capacity(sg_sem_t sem)
+int sg_sem_get_capacity(const_sg_sem_t sem)
{
return sem->get_capacity();
}
* Note that the returned value may be wrong right after the function call, when you try to use it...
* But that's a classical semaphore issue, and SimGrid's semaphore are not different to usual ones here.
*/
-int sg_sem_would_block(sg_sem_t sem)
+int sg_sem_would_block(const_sg_sem_t sem)
{
return sem->would_block();
}
XBT_PUBLIC_DATA const std::array<const char*, NUM_SIMCALLS> simcall_names; /* Name of each simcall */
-typedef bool (*simix_match_func_t)(void*, void*, simgrid::kernel::activity::CommImpl*);
-typedef void (*simix_copy_data_func_t)(simgrid::kernel::activity::CommImpl*, void*, size_t);
-typedef void (*simix_clean_func_t)(void*);
-typedef void (*FPtr)(); // Hide the ugliness
+using simix_match_func_t = bool (*)(void*, void*, simgrid::kernel::activity::CommImpl*);
+using simix_copy_data_func_t = void (*)(simgrid::kernel::activity::CommImpl*, void*, size_t);
+using simix_clean_func_t = void (*)(void*);
+using FPtr = void (*)(); // Hide the ugliness
/* Pack all possible scalar types in an union */
union u_smx_scalar {
extern XBT_PRIVATE MPI_Comm MPI_COMM_UNINITIALIZED;
-typedef SMPI_Cart_topology* MPIR_Cart_Topology;
-
-typedef SMPI_Graph_topology* MPIR_Graph_Topology;
-
-typedef SMPI_Dist_Graph_topology* MPIR_Dist_Graph_Topology;
+using MPIR_Cart_Topology = SMPI_Cart_topology*;
+using MPIR_Graph_Topology = SMPI_Graph_topology*;
+using MPIR_Dist_Graph_Topology = SMPI_Dist_Graph_topology*;
XBT_PRIVATE simgrid::smpi::ActorExt* smpi_process();
XBT_PRIVATE simgrid::smpi::ActorExt* smpi_process_remote(simgrid::s4u::ActorPtr actor);
void* address;
int file_descriptor;
};
-typedef s_smpi_privatization_region_t* smpi_privatization_region_t;
+using smpi_privatization_region_t = s_smpi_privatization_region_t*;
extern XBT_PRIVATE int smpi_loaded_page;
XBT_PRIVATE smpi_privatization_region_t smpi_init_global_memory_segment_process();
#define TOPAGE(addr) (void*)(((unsigned long)(addr) / xbt_pagesize) * xbt_pagesize)
/** Used only if PAPI is compiled in, but integrated anyway so that this file does not depend on internal_config.h (to speed builds) */
-typedef std::vector<std::pair</* counter name */ std::string, /* counter value */ long long>> papi_counter_t;
+using papi_counter_t = std::vector<std::pair</* counter name */ std::string, /* counter value */ long long>>;
struct papi_process_data {
papi_counter_t counter_data;
int event_set;
int refcount;
};
-typedef s_smpi_key_elem_t* smpi_key_elem;
+using smpi_key_elem = s_smpi_key_elem_t*;
namespace simgrid{
namespace smpi{
namespace simgrid{
namespace smpi{
-typedef struct s_smpi_mpi_generalized_request_funcs {
+struct smpi_mpi_generalized_request_funcs_t {
MPI_Grequest_query_function *query_fn;
MPI_Grequest_free_function *free_fn;
MPI_Grequest_cancel_function *cancel_fn;
void* extra_state;
s4u::ConditionVariablePtr cond;
s4u::MutexPtr mutex;
-} s_smpi_mpi_generalized_request_funcs_t;
-typedef struct s_smpi_mpi_generalized_request_funcs *smpi_mpi_generalized_request_funcs;
+};
class Request : public F2C {
void* buf_;
int refcount_;
MPI_Op op_;
int cancelled_; // tri-state
- smpi_mpi_generalized_request_funcs generalized_funcs;
+ smpi_mpi_generalized_request_funcs_t* generalized_funcs;
MPI_Request* nbc_requests_;
int nbc_requests_size_;
static bool match_common(MPI_Request req, MPI_Request sender, MPI_Request receiver);
#include "smpi_status.hpp"
#include <memory>
-typedef std::shared_ptr<SMPI_Topology> MPI_Topology;
+using MPI_Topology = std::shared_ptr<SMPI_Topology>;
namespace simgrid{
namespace smpi{
std::ifstream fstream(filename);
xbt_assert(fstream.is_open(), "Could not open file %s. Does it exist?", filename.c_str());
std::string line;
- typedef boost::tokenizer<boost::escaped_list_separator<char>> Tokenizer;
+ using Tokenizer = boost::tokenizer<boost::escaped_list_separator<char>>;
std::getline(fstream, line); // Skip the header line
while (std::getline(fstream, line)) {
Tokenizer tok(line);
return;
simgrid::config::declare_flag<bool>("smpi/display-timing", "Whether we should display the timing after simulation.", false);
simgrid::config::declare_flag<bool>("smpi/keep-temps", "Whether we should keep the generated temporary files.", false);
+ simgrid::config::declare_flag<std::string>("smpi/tmpdir", "tmp dir for dlopen files", "/tmp");
simgrid::config::declare_flag<std::string>("smpi/coll-selector", "Which collective selector to use", "default");
simgrid::config::declare_flag<std::string>("smpi/gather", "Which collective to use for gather", "");
#include "src/simix/smx_private.hpp"
#include "src/smpi/include/smpi_actor.hpp"
#include "xbt/config.hpp"
+#include "xbt/file.hpp"
#include <algorithm>
#include <boost/algorithm/string.hpp> /* split */
XBT_ERROR("Could not initialize PAPI library; is it correctly installed and linked?"
" Expected version is %u", PAPI_VER_CURRENT);
- typedef boost::tokenizer<boost::char_separator<char>> Tokenizer;
+ using Tokenizer = boost::tokenizer<boost::char_separator<char>>;
boost::char_separator<char> separator_units(";");
std::string str = smpi_cfg_papi_events_file();
Tokenizer tokens(str, separator_units);
#endif
}
-
-
-typedef std::function<int(int argc, char *argv[])> smpi_entry_point_type;
-typedef int (* smpi_c_entry_point_type)(int argc, char **argv);
-typedef void (*smpi_fortran_entry_point_type)();
+using smpi_entry_point_type = std::function<int(int argc, char* argv[])>;
+using smpi_c_entry_point_type = int (*)(int argc, char** argv);
+using smpi_fortran_entry_point_type = void (*)();
template <typename F>
static int smpi_run_entry_point(const F& entry_point, const std::string& executable_path, std::vector<std::string> args)
for (auto const& libname : privatize_libs) {
// load the library once to add it to the local libs, to get the absolute path
void* libhandle = dlopen(libname.c_str(), RTLD_LAZY);
+ xbt_assert(libhandle != nullptr,
+ "Cannot dlopen %s - check your settings in smpi/privatize-libs", libname.c_str());
// get library name from path
std::string fullpath = libname;
#if not defined(__APPLE__) && not defined(__HAIKU__)
return std::function<void()>([executable, fdin_size, args] {
static std::size_t rank = 0;
// Copy the dynamic library:
- std::string target_executable =
- executable + "_" + std::to_string(getpid()) + "_" + std::to_string(rank) + ".so";
+ simgrid::xbt::Path path(executable);
+ std::string target_executable = simgrid::config::get_value<std::string>("smpi/tmpdir") + "/" +
+ path.get_base_name() + "_" + std::to_string(getpid()) + "_" + std::to_string(rank) + ".so";
smpi_copy_file(executable, target_executable, fdin_size);
// if smpi/privatize-libs is set, duplicate pointed lib and link each executable copy to a different one.
unsigned int pad = 7;
if (libname.length() < pad)
pad = libname.length();
- std::string target_lib =
+ std::string target_lib = simgrid::config::get_value<std::string>("smpi/tmpdir") + "/" +
std::string(pad - std::to_string(rank).length(), '0') + std::to_string(rank) + libname.substr(pad);
target_libs.push_back(target_lib);
XBT_DEBUG("copy lib %s to %s, with size %lld", libpath.c_str(), target_lib.c_str(), (long long)fdin_size2);
smpi_copy_file(libpath, target_lib, fdin_size2);
-
- std::string sedcommand = "sed -i -e 's/" + libname + "/" + target_lib + "/g' " + target_executable;
- int status = system(sedcommand.c_str());
- xbt_assert(status == 0, "error while applying sed command %s \n", sedcommand.c_str());
+ void* handle = dlopen(target_lib.c_str(), RTLD_LAZY | RTLD_LOCAL | WANT_RTLD_DEEPBIND);
+ xbt_assert(handle != nullptr, "dlopen of library %s failed: %s (errno: %d -- %s)", target_lib.c_str(),
+ dlerror(), errno, strerror(errno));
}
}
};
}
-typedef std::tuple</*sender*/ int, /* receiver */ int, /* tag */ int> req_key_t;
-typedef std::unordered_map<req_key_t, MPI_Request, hash_tuple::hash<std::tuple<int,int,int>>> req_storage_t;
+using req_key_t = std::tuple</*sender*/ int, /* receiver */ int, /* tag */ int>;
+using req_storage_t = std::unordered_map<req_key_t, MPI_Request, hash_tuple::hash<std::tuple<int, int, int>>>;
void log_timed_action(const simgrid::xbt::ReplayAction& action, double clock)
{
};
std::unordered_map<smpi_source_location, shared_data_t, std::hash<std::string>> allocs;
-typedef decltype(allocs)::value_type shared_data_key_type;
+using shared_data_key_type = decltype(allocs)::value_type;
struct shared_metadata_t {
size_t size;
std::map<std::string, void*> calls;
#ifndef WIN32
-static int smpi_shared_malloc_bogusfile = -1;
-static int smpi_shared_malloc_bogusfile_huge_page = -1;
-static unsigned long smpi_shared_malloc_blocksize = 1UL << 20;
+int smpi_shared_malloc_bogusfile = -1;
+int smpi_shared_malloc_bogusfile_huge_page = -1;
+unsigned long smpi_shared_malloc_blocksize = 1UL << 20;
#endif
}
std::vector<s_smpi_factor_t> smpi_factor;
/** Setup the tokenizer that parses the string **/
- typedef boost::tokenizer<boost::char_separator<char>> Tokenizer;
+ using Tokenizer = boost::tokenizer<boost::char_separator<char>>;
boost::char_separator<char> sep(";");
boost::char_separator<char> factor_separator(":");
Tokenizer tokens(smpi_coef_string, sep);
(*request)->flags_ |= MPI_REQ_GENERALIZED;
(*request)->flags_ |= MPI_REQ_PERSISTENT;
(*request)->refcount_ = 1;
- ((*request)->generalized_funcs) = new s_smpi_mpi_generalized_request_funcs_t;
+ ((*request)->generalized_funcs) = new smpi_mpi_generalized_request_funcs_t;
((*request)->generalized_funcs)->query_fn=query_fn;
((*request)->generalized_funcs)->free_fn=free_fn;
((*request)->generalized_funcs)->cancel_fn=cancel_fn;
bool operator()(s4u::Host* const a, s4u::Host* const b) const;
};
-typedef boost::heap::fibonacci_heap<s4u::Host*, boost::heap::compare<compare_hosts>>::handle_type heap_handle;
+using heap_handle = boost::heap::fibonacci_heap<s4u::Host*, boost::heap::compare<compare_hosts>>::handle_type;
/** Structure that imitates a std::pair, but it allows us to use meaningful names instead of .first and .second */
struct XBT_PRIVATE pair_handle_load
class XBT_PRIVATE Mapping {
public:
/** Each host can have an arbitrary number of actors -> multimap **/
- typedef std::unordered_multimap<s4u::Host*, s4u::ActorPtr> host_to_actors_map_t;
+ using host_to_actors_map_t = std::unordered_multimap<s4u::Host*, s4u::ActorPtr>;
host_to_actors_map_t host_to_actors;
/** Each actor gets assigned to exactly one host -> map **/
SIMOPTS="--cfg=surf/precision:1e-9 --cfg=network/model:SMPI"
+SMPITMPDIR="$(dirname $(mktemp -u))"
+
#usage to print the way this script should be called
usage () {
cat <<EOF
-np <numprocs> # use that amount of processes from the hostfile.
# By default, all processes of the hostfile are used.
-no-privatize # Disable the globals privatization, that is activated by default
+ -tmpdir # Directory used to store temporary files. Defaults to system's.
-trace-ti # activate time independent tracing (for replay, default in smpi_simgrid.txt)
-trace # activate tracing (Paje, default in smpi_simgrid.trace)
-trace-comment <comment> # put a comment on the top of the trace file
MAPOPT=1
shift 1
;;
+ "-tmpdir")
+ SMPITMPDIR="$2"
+ shift 1
+ ;;
"-trace")
TRACE_ACTIVE="true"
shift 1
esac
done
+#setup tmp dir
+SIMOPTS="$SIMOPTS --cfg=smpi/tmpdir:$SMPITMPDIR"
+export LD_LIBRARY_PATH="$SMPITMPDIR:$LD_LIBRARY_PATH"
+
if [ -n "${APP_TRACES}" ] ; then
if [ $# -eq 0 ] ; then
EXEC="@SMPIREPLAYMAIN@"
void remove_actor(kernel::actor::ActorImpl* actor) { xbt::intrusive_erase(actor_list_, *actor); }
void add_actor_at_boot(kernel::actor::ProcessArg* arg) { actors_at_boot_.emplace_back(arg); }
- typedef boost::intrusive::list<
+ using ActorList = boost::intrusive::list<
kernel::actor::ActorImpl,
boost::intrusive::member_hook<kernel::actor::ActorImpl, boost::intrusive::list_member_hook<>,
- &kernel::actor::ActorImpl::host_actor_list_hook>>
- ActorList;
+ &kernel::actor::ActorImpl::host_actor_list_hook>>;
// FIXME: make these private
ActorList actor_list_;
boost::intrusive::list_member_hook<> action_ti_hook;
};
-typedef boost::intrusive::member_hook<CpuTiAction, boost::intrusive::list_member_hook<>, &CpuTiAction::action_ti_hook> ActionTiListOptions;
-typedef boost::intrusive::list<CpuTiAction, ActionTiListOptions > ActionTiList;
+using ActionTiListOptions =
+ boost::intrusive::member_hook<CpuTiAction, boost::intrusive::list_member_hook<>, &CpuTiAction::action_ti_hook>;
+using ActionTiList = boost::intrusive::list<CpuTiAction, ActionTiListOptions>;
/************
* Resource *
boost::intrusive::list_member_hook<> cpu_ti_hook;
};
-typedef boost::intrusive::member_hook<CpuTi, boost::intrusive::list_member_hook<>, &CpuTi::cpu_ti_hook> CpuTiListOptions;
-typedef boost::intrusive::list<CpuTi, CpuTiListOptions> CpuTiList;
+using CpuTiListOptions =
+ boost::intrusive::member_hook<CpuTi, boost::intrusive::list_member_hook<>, &CpuTi::cpu_ti_hook>;
+using CpuTiList = boost::intrusive::list<CpuTi, CpuTiListOptions>;
/*********
* Model *
namespace {
-static bool parse_bool(const char* value)
+bool parse_bool(const char* value)
{
for (const char* true_value : {"yes", "on", "true", "1"})
if (std::strcmp(true_value, value) == 0)
throw std::range_error("not a boolean");
}
-static double parse_double(const char* value)
+double parse_double(const char* value)
{
char* end;
errno = 0;
return res;
}
-static long int parse_long(const char* value)
+long int parse_long(const char* value)
{
char* end;
errno = 0;
int count; //negative for roll
long int limit;
};
-typedef struct xbt_log_append2_file_s* xbt_log_append2_file_t;
+using xbt_log_append2_file_t = xbt_log_append2_file_s*;
static constexpr const char* APPEND2_END_TOKEN = "\n[End of log]\n";
static constexpr const char* APPEND2_END_TOKEN_CLEAR = "\n ";