void simgrid::kernel::activity::CommImpl::suspend()
{
/* FIXME: shall we suspend also the timeout synchro? */
- if (surf_comm)
- surf_comm->suspend();
+ if (surfAction_)
+ surfAction_->suspend();
/* in the other case, the action will be suspended on creation, in SIMIX_comm_start() */
}
void simgrid::kernel::activity::CommImpl::resume()
{
/*FIXME: check what happen with the timeouts */
- if (surf_comm)
- surf_comm->resume();
+ if (surfAction_)
+ surfAction_->resume();
/* in the other case, the synchro were not really suspended yet, see SIMIX_comm_suspend() and SIMIX_comm_start() */
}
} else if (not MC_is_active() /* when running the MC there are no surf actions */
&& not MC_record_replay_is_active() && (state == SIMIX_READY || state == SIMIX_RUNNING)) {
- surf_comm->cancel();
+ surfAction_->cancel();
}
}
/** @brief get the amount remaining from the communication */
double simgrid::kernel::activity::CommImpl::remains()
{
- return surf_comm->getRemains();
+ return surfAction_->getRemains();
}
/** @brief This is part of the cleanup process, probably an internal command */
void simgrid::kernel::activity::CommImpl::cleanupSurf()
{
- if (surf_comm) {
- surf_comm->unref();
- surf_comm = nullptr;
+ if (surfAction_) {
+ surfAction_->unref();
+ surfAction_ = nullptr;
}
if (src_timeout) {
state = SIMIX_SRC_HOST_FAILURE;
else if (dst_timeout && dst_timeout->getState() == simgrid::surf::Action::State::failed)
state = SIMIX_DST_HOST_FAILURE;
- else if (surf_comm && surf_comm->getState() == simgrid::surf::Action::State::failed) {
+ else if (surfAction_ && surfAction_->getState() == simgrid::surf::Action::State::failed) {
state = SIMIX_LINK_FAILURE;
} else
state = SIMIX_DONE;
void (*copy_data_fun)(smx_activity_t, void*, size_t) = nullptr;
/* Surf action data */
- surf_action_t surf_comm = nullptr; /* The Surf communication action encapsulated */
+ surf_action_t surfAction_ = nullptr; /* The Surf communication action encapsulated */
surf_action_t src_timeout = nullptr; /* Surf's actions to instrument the timeouts */
surf_action_t dst_timeout = nullptr; /* Surf's actions to instrument the timeouts */
smx_actor_t src_proc = nullptr;
simgrid::kernel::activity::ExecImpl::~ExecImpl()
{
- if (surf_exec)
- surf_exec->unref();
+ if (surfAction_)
+ surfAction_->unref();
if (timeoutDetector)
timeoutDetector->unref();
XBT_DEBUG("Destroy exec %p", this);
}
void simgrid::kernel::activity::ExecImpl::suspend()
{
- XBT_VERB("This exec is suspended (remain: %f)", surf_exec->getRemains());
- if (surf_exec)
- surf_exec->suspend();
+ XBT_VERB("This exec is suspended (remain: %f)", surfAction_->getRemains());
+ if (surfAction_)
+ surfAction_->suspend();
}
void simgrid::kernel::activity::ExecImpl::resume()
{
- XBT_VERB("This exec is resumed (remain: %f)", surf_exec->getRemains());
- if (surf_exec)
- surf_exec->resume();
+ XBT_VERB("This exec is resumed (remain: %f)", surfAction_->getRemains());
+ if (surfAction_)
+ surfAction_->resume();
}
double simgrid::kernel::activity::ExecImpl::remains()
{
- return surf_exec->getRemains();
+ return surfAction_->getRemains();
}
void simgrid::kernel::activity::ExecImpl::post()
/* If the host running the synchro failed, notice it. This way, the asking
* process can be killed if it runs on that host itself */
state = SIMIX_FAILED;
- } else if (surf_exec->getState() == simgrid::surf::Action::State::failed) {
+ } else if (surfAction_->getState() == simgrid::surf::Action::State::failed) {
/* If the host running the synchro didn't fail, then the synchro was canceled */
state = SIMIX_CANCELED;
} else if (timeoutDetector && timeoutDetector->getState() == simgrid::surf::Action::State::done) {
state = SIMIX_DONE;
}
- if (surf_exec) {
- surf_exec->unref();
- surf_exec = nullptr;
+ if (surfAction_) {
+ surfAction_->unref();
+ surfAction_ = nullptr;
}
if (timeoutDetector) {
timeoutDetector->unref();
void post() override;
double remains();
- sg_host_t host_ =
- nullptr; /* The host where the execution takes place. If nullptr, then this is a parallel exec (and only surf
+ /* The host where the execution takes place. If nullptr, then this is a parallel exec (and only surf
knows the hosts) */
- surf_action_t surf_exec = nullptr; /* The Surf execution action encapsulated */
+ sg_host_t host_ = nullptr;
+ surf_action_t surfAction_ = nullptr; /* The Surf execution action encapsulated */
surf::Action* timeoutDetector = nullptr;
};
}
boost::dynamic_pointer_cast<simgrid::kernel::activity::IoImpl>(process->waiting_synchro);
if (exec != nullptr) {
- if (exec->surf_exec) {
- exec->surf_exec->cancel();
- exec->surf_exec->unref();
- exec->surf_exec = nullptr;
+ if (exec->surfAction_) {
+ exec->surfAction_->cancel();
+ exec->surfAction_->unref();
+ exec->surfAction_ = nullptr;
}
} else if (comm != nullptr) {
process->comms.remove(process->waiting_synchro);
simgrid::kernel::activity::ExecImplPtr exec =
boost::dynamic_pointer_cast<simgrid::kernel::activity::ExecImpl>(process->waiting_synchro);
- if (exec != nullptr && exec->surf_exec)
- exec->surf_exec->cancel();
+ if (exec != nullptr && exec->surfAction_)
+ exec->surfAction_->cancel();
simgrid::kernel::activity::CommImplPtr comm =
boost::dynamic_pointer_cast<simgrid::kernel::activity::CommImpl>(process->waiting_synchro);
{
simgrid::kernel::activity::ExecImplPtr exec =
boost::static_pointer_cast<simgrid::kernel::activity::ExecImpl>(execution);
- if (not exec->surf_exec)
+ if (not exec->surfAction_)
return;
simgrid::simix::kernelImmediate([exec] {
XBT_DEBUG("Cancel synchro %p", exec.get());
- if (exec->surf_exec)
- exec->surf_exec->cancel();
+ if (exec->surfAction_)
+ exec->surfAction_->cancel();
});
}
simgrid::kernel::activity::ExecImplPtr exec =
boost::static_pointer_cast<simgrid::kernel::activity::ExecImpl>(execution);
- if (exec->surf_exec)
- exec->surf_exec->setSharingWeight(priority);
+ if (exec->surfAction_)
+ exec->surfAction_->setSharingWeight(priority);
});
}
simgrid::simix::kernelImmediate([execution, bound] {
simgrid::kernel::activity::ExecImplPtr exec =
boost::static_pointer_cast<simgrid::kernel::activity::ExecImpl>(execution);
- if (exec->surf_exec)
- static_cast<simgrid::surf::CpuAction*>(exec->surf_exec)->setBound(bound);
+ if (exec->surfAction_)
+ exec->surfAction_->setBound(bound);
});
}
/* set surf's action */
if (not MC_is_active() && not MC_record_replay_is_active()) {
- exec->surf_exec = issuer->host->pimpl_cpu->execution_start(flops_amount);
- exec->surf_exec->setData(exec.get());
- exec->surf_exec->setSharingWeight(priority);
+ exec->surfAction_ = issuer->host->pimpl_cpu->execution_start(flops_amount);
+ exec->surfAction_->setData(exec.get());
+ exec->surfAction_->setSharingWeight(priority);
if (bound > 0)
- static_cast<simgrid::surf::CpuAction*>(exec->surf_exec)->setBound(bound);
+ static_cast<simgrid::surf::CpuAction*>(exec->surfAction_)->setBound(bound);
}
XBT_DEBUG("Create execute synchro %p: %s", exec.get(), exec->name.c_str());
/* set surf's synchro */
sg_host_t* host_list_cpy = new sg_host_t[host_nb];
std::copy_n(host_list, host_nb, host_list_cpy);
- exec->surf_exec = surf_host_model->executeParallelTask(host_nb, host_list_cpy, flops_amount, bytes_amount, rate);
- exec->surf_exec->setData(exec.get());
+ exec->surfAction_ = surf_host_model->executeParallelTask(host_nb, host_list_cpy, flops_amount, bytes_amount, rate);
+ exec->surfAction_->setData(exec.get());
if (timeout > 0) {
exec->timeoutDetector = host_list[0]->pimpl_cpu->sleep(timeout);
exec->timeoutDetector->setData(exec.get());
simgrid::kernel::activity::ExecImplPtr exec =
boost::dynamic_pointer_cast<simgrid::kernel::activity::ExecImpl>(synchro);
if (exec != nullptr) {
- exec->surf_exec->setCategory(category);
+ exec->surfAction_->setCategory(category);
return;
}
simgrid::kernel::activity::CommImplPtr comm =
boost::dynamic_pointer_cast<simgrid::kernel::activity::CommImpl>(synchro);
if (comm != nullptr) {
- comm->surf_comm->setCategory(category);
+ comm->surfAction_->setCategory(category);
}
}
other_comm = std::move(this_synchro);
mbox->push(other_comm);
} else {
- if (other_comm->surf_comm && other_comm->remains() < 1e-12) {
+ if (other_comm->surfAction_ && other_comm->remains() < 1e-12) {
XBT_DEBUG("comm %p has been already sent, and is finished, destroy it", other_comm.get());
other_comm->state = SIMIX_DONE;
other_comm->type = SIMIX_COMM_DONE;
simgrid::s4u::Host* sender = comm->src_proc->host;
simgrid::s4u::Host* receiver = comm->dst_proc->host;
- comm->surf_comm = surf_network_model->communicate(sender, receiver, comm->task_size, comm->rate);
- comm->surf_comm->setData(comm.get());
+ comm->surfAction_ = surf_network_model->communicate(sender, receiver, comm->task_size, comm->rate);
+ comm->surfAction_->setData(comm.get());
comm->state = SIMIX_RUNNING;
XBT_DEBUG("Starting communication %p from '%s' to '%s' (surf_action: %p)", comm.get(), sender->getCname(),
- receiver->getCname(), comm->surf_comm);
+ receiver->getCname(), comm->surfAction_);
/* If a link is failed, detect it immediately */
- if (comm->surf_comm->getState() == simgrid::surf::Action::State::failed) {
+ if (comm->surfAction_->getState() == simgrid::surf::Action::State::failed) {
XBT_DEBUG("Communication from '%s' to '%s' failed to start because of a link failure", sender->getCname(),
receiver->getCname());
comm->state = SIMIX_LINK_FAILURE;
"communication",
comm->dst_proc->getCname(), comm->dst_proc->host->getCname());
- comm->surf_comm->suspend();
+ comm->surfAction_->suspend();
}
}
}