S4U:
- Actor: Merge signals on_migration_start/end into on_host_change
+- Actor: Rename migrate() into set_host()
Kernel:
- In simgrid::kernel::resource::Model, the methods next_occuring_event*() have
this_actor.info("Let's move to {:s} to execute {:.2f} Mflops (5sec on {:s} and 5sec on {:s})".format(
first_host.name, flop_amount / 1e6, first_host.name, second_host.name))
- this_actor.migrate(first_host)
+ this_actor.set_host(first_host)
this_actor.execute(flop_amount)
this_actor.info("I wake up on {:s}. Let's suspend a bit".format(
this_actor.info(
"After 5 seconds, move the process to {:s}".format(jacquelin.name))
- actor.migrate(jacquelin)
+ actor.host = jacquelin
this_actor.sleep_until(15)
this_actor.info(
"At t=15, move the process to {:s} and resume it.".format(fafard.name))
- actor.migrate(fafard)
+ actor.host = fafard
actor.resume()
XBT_INFO("Let's move to %s to execute %.2f Mflops (5sec on %s and 5sec on %s)", first->get_cname(), flopAmount / 1e6,
first->get_cname(), second->get_cname());
- simgrid::s4u::this_actor::migrate(first);
+ simgrid::s4u::this_actor::set_host(first);
simgrid::s4u::this_actor::execute(flopAmount);
XBT_INFO("I wake up on %s. Let's suspend a bit", simgrid::s4u::this_actor::get_host()->get_cname());
simgrid::s4u::this_actor::sleep_for(5);
XBT_INFO("After 5 seconds, move the process to %s", jacquelin->get_cname());
- actor->migrate(jacquelin);
+ actor->set_host(jacquelin);
simgrid::s4u::this_actor::sleep_until(15);
XBT_INFO("At t=15, move the process to %s and resume it.", fafard->get_cname());
- actor->migrate(fafard);
+ actor->set_host(fafard);
actor->resume();
}
XBT_PUBLIC sg_actor_t sg_actor_restart(sg_actor_t actor);
void sg_actor_set_auto_restart(sg_actor_t actor, int auto_restart);
XBT_PUBLIC void sg_actor_daemonize(sg_actor_t actor);
-XBT_PUBLIC void sg_actor_migrate(sg_actor_t process, sg_host_t host);
+XBT_PUBLIC
+XBT_ATTRIB_DEPRECATED_v329("Please use sg_actor_set_host() instead") void sg_actor_migrate(sg_actor_t process,
+ sg_host_t host);
+XBT_PUBLIC void sg_actor_set_host(sg_actor_t process, sg_host_t host);
XBT_PUBLIC void sg_actor_join(sg_actor_t actor, double timeout);
XBT_PUBLIC void sg_actor_kill(sg_actor_t actor);
XBT_PUBLIC void sg_actor_kill_all();
* Asynchronous activities started by the actor are not migrated automatically, so you have
* to take care of this yourself (only you knows which ones should be migrated).
*/
- void migrate(Host * new_host);
+ void set_host(Host* new_host);
+#ifndef DOXYGEN
+ XBT_ATTRIB_DEPRECATED_v329("Please use set_host() instead") void migrate(Host* new_host) { set_host(new_host); }
+#endif
/** Ask the actor to die.
*
XBT_PUBLIC void on_exit(const std::function<void(bool)>& fun);
/** @brief Migrate the current actor to a new host. */
-XBT_PUBLIC void migrate(Host* new_host);
+XBT_PUBLIC void set_host(Host* new_host);
+#ifndef DOXYGEN
+XBT_PUBLIC
+XBT_ATTRIB_DEPRECATED_v329("Please use set_host() instead") void migrate(Host* new_host);
+#endif
/** @} */
}
py::arg("flops"), py::arg("priority") = 1);
m2.def("exec_init", [](double flops){return simgrid::s4u::this_actor::exec_init(flops);});
m2.def("get_host", &simgrid::s4u::this_actor::get_host, "Retrieves host on which the current actor is located");
- m2.def("migrate", &simgrid::s4u::this_actor::migrate, "Moves the current actor to another host, see :cpp:func:`void simgrid::s4u::this_actor::migrate()`",
- py::arg("dest"));
+ m2.def("set_host", &simgrid::s4u::this_actor::set_host,
+ "Moves the current actor to another host, see :cpp:func:`void simgrid::s4u::this_actor::set_host()`",
+ py::arg("dest"));
m2.def("sleep_for", sleep_for_fun,
"Block the actor sleeping for that amount of seconds, see :cpp:func:`void simgrid::s4u::this_actor::sleep_for`", py::arg("duration"));
m2.def("sleep_until", sleep_until_fun,
});
},
"Create an actor from a function or an object.")
- .def_property("host", &Actor::get_host, &Actor::migrate, "The host on which this actor is located")
+ .def_property("host", &Actor::get_host, &Actor::set_host, "The host on which this actor is located")
.def_property_readonly("name", &Actor::get_cname, "The name of this actor.")
.def_property_readonly("pid", &Actor::get_pid, "The PID (unique identifier) of this actor.")
.def_property_readonly("ppid", &Actor::get_ppid,
"Wait for the actor to finish (more info in the C++ documentation).", py::arg("timeout"))
.def("kill", [](ActorPtr act) { act->kill(); }, "Kill that actor")
.def("kill_all", &Actor::kill_all, "Kill all actors but the caller.")
- .def("migrate", &Actor::migrate, "Moves that actor to another host (more info in the C++ documentation).",
- py::arg("dest"))
.def("self", &Actor::self, "Retrieves the current actor.")
.def("is_suspended", &Actor::is_suspended, "Returns True if that actor is currently suspended.")
.def("suspend", &Actor::suspend, "Suspend that actor, that is blocked until resume()ed by another actor.")
}
void MSG_process_migrate(sg_actor_t actor, sg_host_t host)
{
- sg_actor_migrate(actor, host);
+ sg_actor_set_host(actor, host);
}
void MSG_process_join(sg_actor_t actor, double timeout)
{
kernel::actor::simcall([this, &fun] { SIMIX_process_on_exit(pimpl_, fun); });
}
-void Actor::migrate(Host* new_host)
+void Actor::set_host(Host* new_host)
{
if (s4u::Actor::on_migration_start.get_slot_count() > 0) { // XBT_ATTRIB_DEPRECATED_v329
static bool already_warned = false;
*
* @see simgrid::s4u::Actor::migrate() for more information
*/
-void migrate(Host* new_host)
+void set_host(Host* new_host)
{
- SIMIX_process_self()->iface()->migrate(new_host);
+ SIMIX_process_self()->iface()->set_host(new_host);
+}
+void migrate(Host* new_host) // deprecated
+{
+ set_host(new_host);
}
} // namespace this_actor
*
* This function changes the value of the #sg_host_t on which @a actor is running.
*/
-void sg_actor_migrate(sg_actor_t process, sg_host_t host)
+void sg_actor_set_host(sg_actor_t process, sg_host_t host)
+{
+ process->set_host(host);
+}
+void sg_actor_migrate(sg_actor_t process, sg_host_t host) // deprecated
{
- process->migrate(host);
+ process->set_host(host);
}
/** @ingroup m_actor_management
// Update the process and host mapping in SimGrid.
XBT_DEBUG("Migrating process %li from %s to %s", my_proc_id, cur_host->get_cname(), migrate_to_host->get_cname());
TRACE_smpi_process_change_host(my_proc_id, migrate_to_host);
- simgrid::s4u::this_actor::migrate(migrate_to_host);
+ simgrid::s4u::this_actor::set_host(migrate_to_host);
}
smpilb_bar.wait();
static void emigrant()
{
XBT_INFO("I'll look for a new job on another machine ('Boivin') where the grass is greener.");
- simgrid::s4u::this_actor::migrate(
+ simgrid::s4u::this_actor::set_host(
simgrid::s4u::Host::by_name("Boivin")); /* - First, move to another host by myself */
XBT_INFO("Yeah, found something to do");
simgrid::s4u::this_actor::execute(98095000); /* - Execute some work there */
simgrid::s4u::this_actor::sleep_for(2);
XBT_INFO("Moving back home after work");
- simgrid::s4u::this_actor::migrate(simgrid::s4u::Host::by_name("Jacquelin")); /* - Move back to original location */
- simgrid::s4u::this_actor::migrate(simgrid::s4u::Host::by_name("Boivin")); /* - Go back to the other host to sleep*/
+ simgrid::s4u::this_actor::set_host(simgrid::s4u::Host::by_name("Jacquelin")); /* - Move back to original location */
+ simgrid::s4u::this_actor::set_host(simgrid::s4u::Host::by_name("Boivin")); /* - Go back to the other host to sleep*/
simgrid::s4u::this_actor::sleep_for(4);
controlled_process = simgrid::s4u::Actor::self(); /* - Get controlled at checkpoint */
barrier->wait();
{
XBT_INFO("Wait at the checkpoint."); /* - block on the mutex+condition */
barrier->wait();
- controlled_process->migrate(simgrid::s4u::Host::by_name("Jacquelin")); /* - Move an emigrant to Jacquelin */
+ controlled_process->set_host(simgrid::s4u::Host::by_name("Jacquelin")); /* - Move an emigrant to Jacquelin */
XBT_INFO("I moved the emigrant");
controlled_process->resume();
}