Finally, my trick works with it. MPI ranks are not garbage collected
as soon as they end because the MPI instance keeps a reference on
them. With this, by_pid() works properly, even on dead but not
collected actors.
But this only works until the trash is emptied, obviously. This seem
to be enough for the test I wanted to get running, so I will not fix
that point tonight.
-ActorImpl::~ActorImpl() {
+ActorImpl::~ActorImpl()
+{
context_->iwannadie = false; // don't let the simcall's yield() do a Context::stop(), to avoid infinite loops
simgrid::simix::simcall([this] { simgrid::s4u::Actor::on_destruction(*ciface()); });
context_->iwannadie = true;
context_->iwannadie = false; // don't let the simcall's yield() do a Context::stop(), to avoid infinite loops
simgrid::simix::simcall([this] { simgrid::s4u::Actor::on_destruction(*ciface()); });
context_->iwannadie = true;
/** @brief Returns the process from PID. */
smx_actor_t SIMIX_process_from_PID(aid_t PID)
{
/** @brief Returns the process from PID. */
smx_actor_t SIMIX_process_from_PID(aid_t PID)
{
- auto actor = simix_global->process_list.find(PID);
- return actor == simix_global->process_list.end() ? nullptr : actor->second;
+ auto item = simix_global->process_list.find(PID);
+ if (item == simix_global->process_list.end()) {
+ for (auto& a : simix_global->actors_to_destroy)
+ if (a.get_pid() == PID)
+ return &a;
+ return nullptr; // Not found, even in the trash
+ }
+ return item->second;
}
void SIMIX_process_on_exit(smx_actor_t actor, int_f_pvoid_pvoid_t fun, void* data)
}
void SIMIX_process_on_exit(smx_actor_t actor, int_f_pvoid_pvoid_t fun, void* data)