From 4052b6d9960bd9792127d006c4f359b946cb7baa Mon Sep 17 00:00:00 2001 From: Martin Quinson Date: Sat, 12 May 2018 02:43:24 +0200 Subject: [PATCH] rename simix::kernelImmediate into simix::simcall --- include/simgrid/simix.hpp | 3 +- include/simgrid/simix/blocking_simcall.hpp | 3 +- src/kernel/context/Context.cpp | 2 +- src/msg/msg_synchro.cpp | 8 ++--- src/plugins/vm/s4u_VirtualMachine.cpp | 14 ++++---- src/s4u/s4u_Actor.cpp | 34 +++++++++---------- src/s4u/s4u_ConditionVariable.cpp | 4 +-- src/s4u/s4u_Engine.cpp | 4 +-- src/s4u/s4u_Exec.cpp | 4 +-- src/s4u/s4u_Host.cpp | 17 +++++----- src/s4u/s4u_Link.cpp | 14 ++++---- src/s4u/s4u_Mailbox.cpp | 4 +-- src/s4u/s4u_Netzone.cpp | 4 +-- src/s4u/s4u_Storage.cpp | 4 +-- src/simix/ActorImpl.cpp | 2 +- src/simix/libsmx.cpp | 22 ++++++------ src/smpi/bindings/smpi_pmpi.cpp | 2 +- src/surf/plugins/host_energy.cpp | 4 +-- src/surf/plugins/link_energy.cpp | 2 +- .../generic-simcalls/generic-simcalls.cpp | 2 +- 20 files changed, 74 insertions(+), 79 deletions(-) diff --git a/include/simgrid/simix.hpp b/include/simgrid/simix.hpp index ed5e1285cb..eee08fc05d 100644 --- a/include/simgrid/simix.hpp +++ b/include/simgrid/simix.hpp @@ -49,8 +49,7 @@ namespace simix { * More importantly, this enforces a deterministic/reproducible ordering * of the operation with respect to other simcalls. */ -template -typename std::result_of::type kernelImmediate(F&& code) +template typename std::result_of::type simcall(F&& code) { // If we are in the maestro, we take the fast path and execute the // code directly without simcall mashalling/unmarshalling/dispatch: diff --git a/include/simgrid/simix/blocking_simcall.hpp b/include/simgrid/simix/blocking_simcall.hpp index ccfc8a1e5a..dcc7b1d87c 100644 --- a/include/simgrid/simix/blocking_simcall.hpp +++ b/include/simgrid/simix/blocking_simcall.hpp @@ -153,8 +153,7 @@ auto kernelAsync(F code) typedef decltype(code().get()) T; // Execute the code in the kernel and get the kernel future: - simgrid::kernel::Future future = - simgrid::simix::kernelImmediate(std::move(code)); + simgrid::kernel::Future future = simgrid::simix::simcall(std::move(code)); // Wrap the kernel future in a actor future: return simgrid::simix::Future(std::move(future)); diff --git a/src/kernel/context/Context.cpp b/src/kernel/context/Context.cpp index 73dccc4c62..b1af4dc6aa 100644 --- a/src/kernel/context/Context.cpp +++ b/src/kernel/context/Context.cpp @@ -80,7 +80,7 @@ void Context::stop() this->process_->suspended = 0; this->iwannadie = false; - simgrid::simix::kernelImmediate([this] { SIMIX_process_cleanup(this->process_); }); + simgrid::simix::simcall([this] { SIMIX_process_cleanup(this->process_); }); this->iwannadie = true; } diff --git a/src/msg/msg_synchro.cpp b/src/msg/msg_synchro.cpp index c2895a3417..bce88e5312 100644 --- a/src/msg/msg_synchro.cpp +++ b/src/msg/msg_synchro.cpp @@ -19,7 +19,7 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(msg_synchro, msg, "Logging specific to MSG (sync /** @brief creates a semaphore object of the given initial capacity */ msg_sem_t MSG_sem_init(int initial_value) { - return simgrid::simix::kernelImmediate([initial_value] { return SIMIX_sem_init(initial_value); }); + return simgrid::simix::simcall([initial_value] { return SIMIX_sem_init(initial_value); }); } /** @brief locks on a semaphore object */ @@ -34,11 +34,11 @@ msg_error_t MSG_sem_acquire_timeout(msg_sem_t sem, double timeout) { /** @brief releases the semaphore object */ void MSG_sem_release(msg_sem_t sem) { - simgrid::simix::kernelImmediate([sem] { SIMIX_sem_release(sem); }); + simgrid::simix::simcall([sem] { SIMIX_sem_release(sem); }); } int MSG_sem_get_capacity(msg_sem_t sem) { - return simgrid::simix::kernelImmediate([sem] { return SIMIX_sem_get_capacity(sem); }); + return simgrid::simix::simcall([sem] { return SIMIX_sem_get_capacity(sem); }); } void MSG_sem_destroy(msg_sem_t sem) { @@ -51,7 +51,7 @@ void MSG_sem_destroy(msg_sem_t sem) { * But that's a classical semaphore issue, and SimGrid's semaphore are not different to usual ones here. */ int MSG_sem_would_block(msg_sem_t sem) { - return simgrid::simix::kernelImmediate([sem] { return SIMIX_sem_would_block(sem); }); + return simgrid::simix::simcall([sem] { return SIMIX_sem_would_block(sem); }); } /*-**** barrier related functions ****-*/ diff --git a/src/plugins/vm/s4u_VirtualMachine.cpp b/src/plugins/vm/s4u_VirtualMachine.cpp index 29174e30a2..2985b7c6fa 100644 --- a/src/plugins/vm/s4u_VirtualMachine.cpp +++ b/src/plugins/vm/s4u_VirtualMachine.cpp @@ -66,7 +66,7 @@ void VirtualMachine::start() { on_start(*this); - simgrid::simix::kernelImmediate([this]() { + simgrid::simix::simcall([this]() { simgrid::vm::VmHostExt::ensureVmExtInstalled(); simgrid::s4u::Host* pm = this->pimpl_vm_->getPm(); @@ -85,7 +85,7 @@ void VirtualMachine::start() total_ramsize_of_vms += ws_vm->getRamsize(); if (vm_ramsize > pm_ramsize - total_ramsize_of_vms) { - XBT_WARN("cannnot start %s@%s due to memory shortage: vm_ramsize %ld, free %ld, pm_ramsize %ld (bytes).", + XBT_WARN("cannot start %s@%s due to memory shortage: vm_ramsize %ld, free %ld, pm_ramsize %ld (bytes).", this->get_cname(), pm->get_cname(), vm_ramsize, pm_ramsize - total_ramsize_of_vms, pm_ramsize); THROWF(vm_error, 0, "Memory shortage on host '%s', VM '%s' cannot be started", pm->get_cname(), this->get_cname()); @@ -102,7 +102,7 @@ void VirtualMachine::suspend() { on_suspend(*this); smx_actor_t issuer = SIMIX_process_self(); - simgrid::simix::kernelImmediate([this, issuer]() { pimpl_vm_->suspend(issuer); }); + simgrid::simix::simcall([this, issuer]() { pimpl_vm_->suspend(issuer); }); } void VirtualMachine::resume() @@ -114,7 +114,7 @@ void VirtualMachine::resume() void VirtualMachine::shutdown() { smx_actor_t issuer = SIMIX_process_self(); - simgrid::simix::kernelImmediate([this, issuer]() { pimpl_vm_->shutdown(issuer); }); + simgrid::simix::simcall([this, issuer]() { pimpl_vm_->shutdown(issuer); }); on_shutdown(*this); } @@ -134,12 +134,12 @@ simgrid::s4u::Host* VirtualMachine::getPm() void VirtualMachine::setPm(simgrid::s4u::Host* pm) { - simgrid::simix::kernelImmediate([this, pm]() { pimpl_vm_->setPm(pm); }); + simgrid::simix::simcall([this, pm]() { pimpl_vm_->setPm(pm); }); } e_surf_vm_state_t VirtualMachine::getState() { - return simgrid::simix::kernelImmediate([this]() { return pimpl_vm_->getState(); }); + return simgrid::simix::simcall([this]() { return pimpl_vm_->getState(); }); } size_t VirtualMachine::getRamsize() @@ -179,7 +179,7 @@ void VirtualMachine::setRamsize(size_t ramsize) */ void VirtualMachine::setBound(double bound) { - simgrid::simix::kernelImmediate([this, bound]() { pimpl_vm_->setBound(bound); }); + simgrid::simix::simcall([this, bound]() { pimpl_vm_->setBound(bound); }); } } // namespace simgrid diff --git a/src/s4u/s4u_Actor.cpp b/src/s4u/s4u_Actor.cpp index ed73dc983a..1267fdb683 100644 --- a/src/s4u/s4u_Actor.cpp +++ b/src/s4u/s4u_Actor.cpp @@ -69,12 +69,12 @@ void Actor::join(double timeout) void Actor::set_auto_restart(bool autorestart) { - simgrid::simix::kernelImmediate([this, autorestart]() { pimpl_->auto_restart = autorestart; }); + simgrid::simix::simcall([this, autorestart]() { pimpl_->auto_restart = autorestart; }); } void Actor::on_exit(int_f_pvoid_pvoid_t fun, void* data) { - simgrid::simix::kernelImmediate([this, fun, data] { SIMIX_process_on_exit(pimpl_, fun, data); }); + simgrid::simix::simcall([this, fun, data] { SIMIX_process_on_exit(pimpl_, fun, data); }); } /** @brief Moves the actor to another host @@ -90,7 +90,7 @@ void Actor::migrate(Host* new_host) { s4u::Actor::on_migration_start(this); - simgrid::simix::kernelImmediate([this, new_host]() { + simgrid::simix::simcall([this, new_host]() { if (pimpl_->waiting_synchro != nullptr) { // The actor is blocked on an activity. If it's an exec, migrate it too. // FIXME: implement the migration of other kind of activities @@ -112,7 +112,7 @@ s4u::Host* Actor::get_host() void Actor::daemonize() { - simgrid::simix::kernelImmediate([this]() { pimpl_->daemonize(); }); + simgrid::simix::simcall([this]() { pimpl_->daemonize(); }); } bool Actor::is_daemon() const @@ -148,13 +148,13 @@ void Actor::suspend() void Actor::resume() { - simgrid::simix::kernelImmediate([this] { pimpl_->resume(); }); + simgrid::simix::simcall([this] { pimpl_->resume(); }); s4u::Actor::on_resume(this); } int Actor::is_suspended() { - return simgrid::simix::kernelImmediate([this] { return pimpl_->suspended; }); + return simgrid::simix::simcall([this] { return pimpl_->suspended; }); } void Actor::set_kill_time(double time) @@ -173,7 +173,7 @@ void Actor::kill(aid_t pid) smx_actor_t killer = SIMIX_process_self(); smx_actor_t process = SIMIX_process_from_PID(pid); if (process != nullptr) { - simgrid::simix::kernelImmediate([killer, process] { SIMIX_process_kill(process, killer); }); + simgrid::simix::simcall([killer, process] { SIMIX_process_kill(process, killer); }); } else { std::ostringstream oss; oss << "kill: (" << pid << ") - No such actor" << std::endl; @@ -184,7 +184,7 @@ void Actor::kill(aid_t pid) void Actor::kill() { smx_actor_t process = SIMIX_process_self(); - simgrid::simix::kernelImmediate( + simgrid::simix::simcall( [this, process] { SIMIX_process_kill(pimpl_, (pimpl_ == simix_global->maestro_process) ? pimpl_ : process); }); } @@ -207,28 +207,28 @@ ActorPtr Actor::by_pid(aid_t pid) void Actor::kill_all() { smx_actor_t self = SIMIX_process_self(); - simgrid::simix::kernelImmediate([&self] { SIMIX_process_killall(self); }); + simgrid::simix::simcall([&self] { SIMIX_process_killall(self); }); } std::map* Actor::get_properties() { - return simgrid::simix::kernelImmediate([this] { return this->pimpl_->getProperties(); }); + return simgrid::simix::simcall([this] { return this->pimpl_->getProperties(); }); } /** Retrieve the property value (or nullptr if not set) */ const char* Actor::get_property(const char* key) { - return simgrid::simix::kernelImmediate([this, key] { return pimpl_->getProperty(key); }); + return simgrid::simix::simcall([this, key] { return pimpl_->getProperty(key); }); } void Actor::set_property(const char* key, const char* value) { - simgrid::simix::kernelImmediate([this, key, value] { pimpl_->setProperty(key, value); }); + simgrid::simix::simcall([this, key, value] { pimpl_->setProperty(key, value); }); } Actor* Actor::restart() { - return simgrid::simix::kernelImmediate([this]() { return pimpl_->restart(); }); + return simgrid::simix::simcall([this]() { return pimpl_->restart(); }); } // ***** this_actor ***** @@ -258,7 +258,7 @@ void sleep_for(double duration) void yield() { - simgrid::simix::kernelImmediate([] { /* do nothing*/ }); + simgrid::simix::simcall([] { /* do nothing*/ }); } XBT_PUBLIC void sleep_until(double timeout) @@ -342,20 +342,20 @@ void suspend() void resume() { smx_actor_t process = SIMIX_process_self(); - simgrid::simix::kernelImmediate([process] { process->resume(); }); + simgrid::simix::simcall([process] { process->resume(); }); simgrid::s4u::Actor::on_resume(process->iface()); } bool is_suspended() { smx_actor_t process = SIMIX_process_self(); - return simgrid::simix::kernelImmediate([process] { return process->suspended; }); + return simgrid::simix::simcall([process] { return process->suspended; }); } void kill() { smx_actor_t process = SIMIX_process_self(); - simgrid::simix::kernelImmediate([process] { SIMIX_process_kill(process, process); }); + simgrid::simix::simcall([process] { SIMIX_process_kill(process, process); }); } void on_exit(int_f_pvoid_pvoid_t fun, void* data) diff --git a/src/s4u/s4u_ConditionVariable.cpp b/src/s4u/s4u_ConditionVariable.cpp index 9df1f73507..2a08728eca 100644 --- a/src/s4u/s4u_ConditionVariable.cpp +++ b/src/s4u/s4u_ConditionVariable.cpp @@ -66,12 +66,12 @@ std::cv_status ConditionVariable::wait_until(std::unique_lock& lock, doub */ void ConditionVariable::notify_one() { - simgrid::simix::kernelImmediate([this]() { cond_->signal(); }); + simgrid::simix::simcall([this]() { cond_->signal(); }); } void ConditionVariable::notify_all() { - simgrid::simix::kernelImmediate([this]() { cond_->broadcast(); }); + simgrid::simix::simcall([this]() { cond_->broadcast(); }); } void intrusive_ptr_add_ref(ConditionVariable* cond) diff --git a/src/s4u/s4u_Engine.cpp b/src/s4u/s4u_Engine.cpp index 5860786bb5..ab520f2f59 100644 --- a/src/s4u/s4u_Engine.cpp +++ b/src/s4u/s4u_Engine.cpp @@ -244,14 +244,14 @@ std::vector Engine::get_all_netpoints() /** @brief Register a new netpoint to the system */ void Engine::netpoint_register(simgrid::kernel::routing::NetPoint* point) { - // simgrid::simix::kernelImmediate([&]{ FIXME: this segfaults in set_thread + // simgrid::simix::simcall([&]{ FIXME: this segfaults in set_thread pimpl->netpoints_[point->get_name()] = point; // }); } /** @brief Unregister a given netpoint */ void Engine::netpoint_unregister(simgrid::kernel::routing::NetPoint* point) { - simgrid::simix::kernelImmediate([this, point] { + simgrid::simix::simcall([this, point] { pimpl->netpoints_.erase(point->get_name()); delete point; }); diff --git a/src/s4u/s4u_Exec.cpp b/src/s4u/s4u_Exec.cpp index 41ffe89a21..607e50ebc5 100644 --- a/src/s4u/s4u_Exec.cpp +++ b/src/s4u/s4u_Exec.cpp @@ -99,7 +99,7 @@ Host* Exec::get_host() /** @brief Returns the amount of flops that remain to be done */ double Exec::get_remaining() { - return simgrid::simix::kernelImmediate( + return simgrid::simix::simcall( [this]() { return boost::static_pointer_cast(pimpl_)->get_remaining(); }); } @@ -109,7 +109,7 @@ double Exec::get_remaining() */ double Exec::get_remaining_ratio() { - return simgrid::simix::kernelImmediate([this]() { + return simgrid::simix::simcall([this]() { return boost::static_pointer_cast(pimpl_)->get_remaining_ratio(); }); } diff --git a/src/s4u/s4u_Host.cpp b/src/s4u/s4u_Host.cpp index 97dd8ba2a1..bd963f4da1 100644 --- a/src/s4u/s4u_Host.cpp +++ b/src/s4u/s4u_Host.cpp @@ -92,7 +92,7 @@ Host* Host::current() void Host::turnOn() { if (isOff()) { - simgrid::simix::kernelImmediate([this] { + simgrid::simix::simcall([this] { this->extension()->turnOn(); this->pimpl_cpu->turn_on(); onStateChange(*this); @@ -104,7 +104,7 @@ void Host::turnOff() { if (isOn()) { smx_actor_t self = SIMIX_process_self(); - simgrid::simix::kernelImmediate([this, self] { + simgrid::simix::simcall([this, self] { SIMIX_host_off(this, self); onStateChange(*this); }); @@ -168,7 +168,7 @@ void Host::routeTo(Host* dest, std::vector& links, /** Get the properties assigned to a host */ std::map* Host::getProperties() { - return simgrid::simix::kernelImmediate([this] { return this->pimpl_->getProperties(); }); + return simgrid::simix::simcall([this] { return this->pimpl_->getProperties(); }); } /** Retrieve the property value (or nullptr if not set) */ @@ -179,7 +179,7 @@ const char* Host::getProperty(const char* key) void Host::setProperty(std::string key, std::string value) { - simgrid::simix::kernelImmediate([this, key, value] { this->pimpl_->setProperty(key, value); }); + simgrid::simix::simcall([this, key, value] { this->pimpl_->setProperty(key, value); }); } /** Get the processes attached to the host */ @@ -199,8 +199,7 @@ int Host::get_actor_count() /** @brief Get the peak processor speed (in flops/s), at the specified pstate */ double Host::getPstateSpeed(int pstate_index) { - return simgrid::simix::kernelImmediate( - [this, pstate_index] { return this->pimpl_cpu->getPstateSpeed(pstate_index); }); + return simgrid::simix::simcall([this, pstate_index] { return this->pimpl_cpu->getPstateSpeed(pstate_index); }); } /** @brief Get the peak processor speed (under full load (=1.0), in flops/s), at the current pstate */ @@ -218,7 +217,7 @@ int Host::getCoreCount() /** @brief Set the pstate at which the host should run */ void Host::setPstate(int pstate_index) { - simgrid::simix::kernelImmediate([this, pstate_index] { this->pimpl_cpu->setPState(pstate_index); }); + simgrid::simix::simcall([this, pstate_index] { this->pimpl_cpu->setPState(pstate_index); }); } /** @brief Retrieve the pstate at which the host is currently running */ int Host::getPstate() @@ -233,13 +232,13 @@ int Host::getPstate() */ std::vector Host::get_attached_storages() { - return simgrid::simix::kernelImmediate([this] { return this->pimpl_->get_attached_storages(); }); + return simgrid::simix::simcall([this] { return this->pimpl_->get_attached_storages(); }); } void Host::getAttachedStorages(std::vector* storages) { std::vector local_storages = - simgrid::simix::kernelImmediate([this] { return this->pimpl_->get_attached_storages(); }); + simgrid::simix::simcall([this] { return this->pimpl_->get_attached_storages(); }); for (auto elm : local_storages) storages->push_back(elm); } diff --git a/src/s4u/s4u_Link.cpp b/src/s4u/s4u_Link.cpp index b6b1a5814d..954969d5f3 100644 --- a/src/s4u/s4u_Link.cpp +++ b/src/s4u/s4u_Link.cpp @@ -70,11 +70,11 @@ double Link::getUsage() void Link::turnOn() { - simgrid::simix::kernelImmediate([this]() { this->pimpl_->turn_on(); }); + simgrid::simix::simcall([this]() { this->pimpl_->turn_on(); }); } void Link::turnOff() { - simgrid::simix::kernelImmediate([this]() { this->pimpl_->turn_off(); }); + simgrid::simix::simcall([this]() { this->pimpl_->turn_off(); }); } void* Link::getData() @@ -83,20 +83,20 @@ void* Link::getData() } void Link::setData(void* d) { - simgrid::simix::kernelImmediate([this, d]() { this->pimpl_->setData(d); }); + simgrid::simix::simcall([this, d]() { this->pimpl_->setData(d); }); } void Link::setStateTrace(tmgr_trace_t trace) { - simgrid::simix::kernelImmediate([this, trace]() { this->pimpl_->setStateTrace(trace); }); + simgrid::simix::simcall([this, trace]() { this->pimpl_->setStateTrace(trace); }); } void Link::setBandwidthTrace(tmgr_trace_t trace) { - simgrid::simix::kernelImmediate([this, trace]() { this->pimpl_->setBandwidthTrace(trace); }); + simgrid::simix::simcall([this, trace]() { this->pimpl_->setBandwidthTrace(trace); }); } void Link::setLatencyTrace(tmgr_trace_t trace) { - simgrid::simix::kernelImmediate([this, trace]() { this->pimpl_->setLatencyTrace(trace); }); + simgrid::simix::simcall([this, trace]() { this->pimpl_->setLatencyTrace(trace); }); } const char* Link::getProperty(const char* key) @@ -105,7 +105,7 @@ const char* Link::getProperty(const char* key) } void Link::setProperty(std::string key, std::string value) { - simgrid::simix::kernelImmediate([this, key, value] { this->pimpl_->setProperty(key, value); }); + simgrid::simix::simcall([this, key, value] { this->pimpl_->setProperty(key, value); }); } } // namespace s4u } // namespace simgrid diff --git a/src/s4u/s4u_Mailbox.cpp b/src/s4u/s4u_Mailbox.cpp index c135ce70c3..f57874e673 100644 --- a/src/s4u/s4u_Mailbox.cpp +++ b/src/s4u/s4u_Mailbox.cpp @@ -30,7 +30,7 @@ MailboxPtr Mailbox::byName(const char* name) { kernel::activity::MailboxImpl* mbox = kernel::activity::MailboxImpl::byNameOrNull(name); if (mbox == nullptr) { - mbox = simix::kernelImmediate([name] { return kernel::activity::MailboxImpl::byNameOrCreate(name); }); + mbox = simix::simcall([name] { return kernel::activity::MailboxImpl::byNameOrCreate(name); }); } return MailboxPtr(&mbox->piface_, true); } @@ -57,7 +57,7 @@ smx_activity_t Mailbox::front() void Mailbox::setReceiver(ActorPtr actor) { - simix::kernelImmediate([this, actor]() { this->pimpl_->setReceiver(actor); }); + simix::simcall([this, actor]() { this->pimpl_->setReceiver(actor); }); } /** @brief get the receiver (process associated to the mailbox) */ diff --git a/src/s4u/s4u_Netzone.cpp b/src/s4u/s4u_Netzone.cpp index 5a60eeb44a..da67bc6aed 100644 --- a/src/s4u/s4u_Netzone.cpp +++ b/src/s4u/s4u_Netzone.cpp @@ -40,7 +40,7 @@ NetZone::~NetZone() std::unordered_map* NetZone::getProperties() { - return simgrid::simix::kernelImmediate([this] { return &properties_; }); + return simgrid::simix::simcall([this] { return &properties_; }); } /** Retrieve the property value (or nullptr if not set) */ @@ -50,7 +50,7 @@ const char* NetZone::getProperty(const char* key) } void NetZone::setProperty(const char* key, const char* value) { - simgrid::simix::kernelImmediate([this, key, value] { properties_[key] = value; }); + simgrid::simix::simcall([this, key, value] { properties_[key] = value; }); } /** @brief Returns the list of direct children (no grand-children) diff --git a/src/s4u/s4u_Storage.cpp b/src/s4u/s4u_Storage.cpp index 6080b06cbd..95e250c35a 100644 --- a/src/s4u/s4u_Storage.cpp +++ b/src/s4u/s4u_Storage.cpp @@ -57,7 +57,7 @@ Host* Storage::getHost() std::map* Storage::getProperties() { - return simgrid::simix::kernelImmediate([this] { return pimpl_->getProperties(); }); + return simgrid::simix::simcall([this] { return pimpl_->getProperties(); }); } const char* Storage::getProperty(std::string key) @@ -67,7 +67,7 @@ const char* Storage::getProperty(std::string key) void Storage::setProperty(std::string key, std::string value) { - simgrid::simix::kernelImmediate([this, key, value] { this->pimpl_->setProperty(key, value); }); + simgrid::simix::simcall([this, key, value] { this->pimpl_->setProperty(key, value); }); } sg_size_t Storage::read(sg_size_t size) diff --git a/src/simix/ActorImpl.cpp b/src/simix/ActorImpl.cpp index e0b79ebc2a..202aa8f3b8 100644 --- a/src/simix/ActorImpl.cpp +++ b/src/simix/ActorImpl.cpp @@ -814,7 +814,7 @@ smx_actor_t simcall_process_create(const char* name, std::function code, if (name == nullptr) name = ""; smx_actor_t self = SIMIX_process_self(); - return simgrid::simix::kernelImmediate([name, code, data, host, properties, self] { + return simgrid::simix::simcall([name, code, data, host, properties, self] { return SIMIX_process_create(name, std::move(code), data, host, properties, self); }); } diff --git a/src/simix/libsmx.cpp b/src/simix/libsmx.cpp index 298aaf4eda..13b9cc1bbd 100644 --- a/src/simix/libsmx.cpp +++ b/src/simix/libsmx.cpp @@ -65,7 +65,7 @@ smx_activity_t simcall_execution_start(const char* name, double flops_amount, do xbt_assert(std::isfinite(flops_amount), "flops_amount is not finite!"); xbt_assert(std::isfinite(priority), "priority is not finite!"); - return simgrid::simix::kernelImmediate([name, flops_amount, priority, bound, host] { + return simgrid::simix::simcall([name, flops_amount, priority, bound, host] { return SIMIX_execution_start(name, flops_amount, priority, bound, host); }); } @@ -101,7 +101,7 @@ smx_activity_t simcall_execution_parallel_start(const char* name, int host_nb, s xbt_assert(std::isfinite(rate), "rate is not finite!"); - return simgrid::simix::kernelImmediate([name, host_nb, host_list, flops_amount, bytes_amount, rate, timeout] { + return simgrid::simix::simcall([name, host_nb, host_list, flops_amount, bytes_amount, rate, timeout] { return SIMIX_execution_parallel_start(name, host_nb, host_list, flops_amount, bytes_amount, rate, timeout); }); } @@ -119,9 +119,7 @@ void simcall_execution_cancel(smx_activity_t execution) boost::static_pointer_cast(execution); if (exec->surf_action_ == nullptr) // FIXME: One test fails if I remove this, but I don't get why... return; - simgrid::simix::kernelImmediate([exec] { - exec->cancel(); - }); + simgrid::simix::simcall([exec] { exec->cancel(); }); } /** @@ -136,7 +134,7 @@ void simcall_execution_set_priority(smx_activity_t execution, double priority) { /* checking for infinite values */ xbt_assert(std::isfinite(priority), "priority is not finite!"); - simgrid::simix::kernelImmediate([execution, priority] { + simgrid::simix::simcall([execution, priority] { simgrid::kernel::activity::ExecImplPtr exec = boost::static_pointer_cast(execution); @@ -154,7 +152,7 @@ void simcall_execution_set_priority(smx_activity_t execution, double priority) */ void simcall_execution_set_bound(smx_activity_t execution, double bound) { - simgrid::simix::kernelImmediate([execution, bound] { + simgrid::simix::simcall([execution, bound] { simgrid::kernel::activity::ExecImplPtr exec = boost::static_pointer_cast(execution); exec->set_bound(bound); @@ -206,7 +204,7 @@ void simcall_process_suspend(smx_actor_t process) */ void simcall_process_set_data(smx_actor_t process, void *data) { - simgrid::simix::kernelImmediate([process, data] { process->setUserData(data); }); + simgrid::simix::simcall([process, data] { process->setUserData(data); }); } /** @@ -343,7 +341,7 @@ smx_activity_t simcall_comm_iprobe(smx_mailbox_t mbox, int type, */ void simcall_comm_cancel(smx_activity_t synchro) { - simgrid::simix::kernelImmediate([synchro] { + simgrid::simix::simcall([synchro] { simgrid::kernel::activity::CommImplPtr comm = boost::static_pointer_cast(synchro); comm->cancel(); @@ -389,7 +387,7 @@ void simcall_set_category(smx_activity_t synchro, const char *category) if (category == nullptr) { return; } - simgrid::simix::kernelImmediate([synchro, category] { SIMIX_set_category(synchro, category); }); + simgrid::simix::simcall([synchro, category] { SIMIX_set_category(synchro, category); }); } /** @@ -411,7 +409,7 @@ smx_mutex_t simcall_mutex_init() fprintf(stderr,"You must run MSG_init before using MSG\n"); // We can't use xbt_die since we may get there before the initialization xbt_abort(); } - return simgrid::simix::kernelImmediate([] { return new simgrid::kernel::activity::MutexImpl(); }); + return simgrid::simix::simcall([] { return new simgrid::kernel::activity::MutexImpl(); }); } /** @@ -447,7 +445,7 @@ void simcall_mutex_unlock(smx_mutex_t mutex) */ smx_cond_t simcall_cond_init() { - return simgrid::simix::kernelImmediate([] { return new simgrid::kernel::activity::ConditionVariableImpl(); }); + return simgrid::simix::simcall([] { return new simgrid::kernel::activity::ConditionVariableImpl(); }); } /** diff --git a/src/smpi/bindings/smpi_pmpi.cpp b/src/smpi/bindings/smpi_pmpi.cpp index 9028c78d38..2911844f5f 100644 --- a/src/smpi/bindings/smpi_pmpi.cpp +++ b/src/smpi/bindings/smpi_pmpi.cpp @@ -120,7 +120,7 @@ int PMPI_Abort(MPI_Comm /*comm*/, int /*errorcode*/) smpi_bench_end(); // FIXME: should kill all processes in comm instead smx_actor_t process = SIMIX_process_self(); - simgrid::simix::kernelImmediate([process] { SIMIX_process_kill(process, process); }); + simgrid::simix::simcall([process] { SIMIX_process_kill(process, process); }); return MPI_SUCCESS; } diff --git a/src/surf/plugins/host_energy.cpp b/src/surf/plugins/host_energy.cpp index e8f4fa4cb1..a90c80e9e0 100644 --- a/src/surf/plugins/host_energy.cpp +++ b/src/surf/plugins/host_energy.cpp @@ -307,7 +307,7 @@ double HostEnergy::getCurrentWattsValue(double cpu_load) double HostEnergy::getConsumedEnergy() { if (last_updated < surf_get_clock()) // We need to simcall this as it modifies the environment - simgrid::simix::kernelImmediate(std::bind(&HostEnergy::update, this)); + simgrid::simix::simcall(std::bind(&HostEnergy::update, this)); return total_energy; } @@ -473,7 +473,7 @@ void sg_host_energy_plugin_init() */ void sg_host_energy_update_all() { - simgrid::simix::kernelImmediate([]() { + simgrid::simix::simcall([]() { std::vector list = simgrid::s4u::Engine::get_instance()->get_all_hosts(); for (auto const& host : list) if (dynamic_cast(host) == nullptr) // Ignore virtual machines diff --git a/src/surf/plugins/link_energy.cpp b/src/surf/plugins/link_energy.cpp index 32dff1235b..bce16c3181 100644 --- a/src/surf/plugins/link_energy.cpp +++ b/src/surf/plugins/link_energy.cpp @@ -135,7 +135,7 @@ double LinkEnergy::getPower() double LinkEnergy::getConsumedEnergy() { if (lastUpdated_ < surf_get_clock()) // We need to simcall this as it modifies the environment - simgrid::simix::kernelImmediate(std::bind(&LinkEnergy::update, this)); + simgrid::simix::simcall(std::bind(&LinkEnergy::update, this)); return this->totalEnergy_; } } diff --git a/teshsuite/simix/generic-simcalls/generic-simcalls.cpp b/teshsuite/simix/generic-simcalls/generic-simcalls.cpp index 14f1c6d06e..94b9558f3e 100644 --- a/teshsuite/simix/generic-simcalls/generic-simcalls.cpp +++ b/teshsuite/simix/generic-simcalls/generic-simcalls.cpp @@ -35,7 +35,7 @@ static int master(int argc, char* argv[]) { // Test the simple immediate execution: XBT_INFO("Start"); - simgrid::simix::kernelImmediate([] { XBT_INFO("kernel"); }); + simgrid::simix::simcall([] { XBT_INFO("kernel"); }); XBT_INFO("kernel, returned"); // Synchronize on a successful Future: -- 2.20.1