> [ 3.000000] (maestro@) Oops! Deadlock or code not perfectly clean.
> [ 3.000000] (maestro@) 1 actors are still running, waiting for something.
> [ 3.000000] (maestro@) Legend of the following listing: "Actor <pid> (<name>@<host>): <status>"
-> [ 3.000000] (maestro@) Actor 3 (C@Ginette): waiting for communication activity 0xdeadbeef () in state 0 to finish
+> [ 3.000000] (maestro@) Actor 3 (C@Ginette): waiting for communication activity 0xdeadbeef () in state WAITING to finish
> [ 3.000000] (C@Ginette) I was killed!
> [ 3.000000] (C@Ginette) The backtrace would be displayed here if --log=no_loc would not have been passed
> [ 3.000000] (maestro@) Oops! Deadlock or code not perfectly clean.
> [ 3.000000] (maestro@) 1 actors are still running, waiting for something.
> [ 3.000000] (maestro@) Legend of the following listing: "Actor <pid> (<name>@<host>): <status>"
-> [ 3.000000] (maestro@) Actor 3 (C@Ginette): waiting for communication activity 0xdeadbeef () in state 0 to finish
+> [ 3.000000] (maestro@) Actor 3 (C@Ginette): waiting for communication activity 0xdeadbeef () in state WAITING to finish
> [ 3.000000] (C@Ginette) I was killed!
> [ 3.000000] (C@Ginette) The backtrace would be displayed here if --log=no_loc would not have been passed
> [ 3.000000] (maestro@) Actor C terminates now
if (boost::dynamic_pointer_cast<kernel::activity::IoImpl>(actor->waiting_synchro_) != nullptr)
synchro_description = "I/O";
- XBT_INFO("Actor %ld (%s@%s): waiting for %s activity %#zx (%s) in state %d to finish", actor->get_pid(),
+ XBT_INFO("Actor %ld (%s@%s): waiting for %s activity %#zx (%s) in state %s to finish", actor->get_pid(),
actor->get_cname(), actor->get_host()->get_cname(), synchro_description,
(xbt_log_no_loc ? (size_t)0xDEADBEEF : (size_t)actor->waiting_synchro_.get()),
- actor->waiting_synchro_->get_cname(), (int)actor->waiting_synchro_->state_);
+ actor->waiting_synchro_->get_cname(), actor->waiting_synchro_->get_state_str());
} else {
XBT_INFO("Actor %ld (%s@%s) simcall %s", actor->get_pid(), actor->get_cname(), actor->get_host()->get_cname(),
SIMIX_simcall_name(actor->simcall_));
class XBT_PUBLIC ActivityImpl {
std::atomic_int_fast32_t refcount_{0};
std::string name_ = "";
+ actor::ActorImpl* actor_ = nullptr;
+ State state_ = State::WAITING; /* State of the activity */
+ double start_time_ = -1.0;
+ double finish_time_ = -1.0;
public:
virtual ~ActivityImpl();
ActivityImpl() = default;
- State state_ = State::WAITING; /* State of the activity */
std::list<smx_simcall_t> simcalls_; /* List of simcalls waiting for this activity */
- resource::Action* surf_action_ = nullptr;
- actor::ActorImpl* actor_ = nullptr;
s4u::Activity* piface_ = nullptr;
- double start_time_ = -1.0;
- double finish_time_ = -1.0;
+ resource::Action* surf_action_ = nullptr;
protected:
void inline set_name(const std::string& name)
// child type
name_ = name;
}
+ void set_start_time(double start_time) { start_time_ = start_time; }
public:
const std::string& get_name() const { return name_; }
void set_iface(s4u::Activity* iface) { piface_ = iface; }
s4u::Activity* get_iface() { return piface_; }
+ void set_state(State state) { state_ = state; }
+ const State& get_state() const { return state_; }
+ const char* get_state_str() const;
+
double get_start_time() const { return start_time_; }
void set_finish_time(double finish_time) { finish_time_ = finish_time; }
double get_finish_time() const { return finish_time_; }
void unregister_simcall(smx_simcall_t simcall);
void clean_action();
virtual double get_remaining() const;
- const char* get_state_str() const;
// Support for the boost::intrusive_ptr<ActivityImpl> datatype
friend XBT_PUBLIC void intrusive_ptr_add_ref(ActivityImpl* activity);
friend XBT_PUBLIC void intrusive_ptr_release(ActivityImpl* activity);
* The difficulty is that set_name() must return a qualified child class, not the generic ancestor
* But the getter is still in the ancestor to be usable on generic activities with no downcast */
template <class AnyActivityImpl> class ActivityImpl_T : public ActivityImpl {
-private:
std::string tracing_category_ = "";
public:
if (mbox->is_permanent()) {
// this mailbox is for small messages, which have to be sent right now
- other_comm->state_ = simgrid::kernel::activity::State::READY;
+ other_comm->set_state(simgrid::kernel::activity::State::READY);
other_comm->dst_actor_ = mbox->get_permanent_receiver().get();
mbox->push_done(other_comm);
XBT_DEBUG("pushing a message into the permanent receive list %p, comm %p", mbox, other_comm.get());
} else {
XBT_DEBUG("Receive already pushed");
- other_comm->state_ = simgrid::kernel::activity::State::READY;
+ other_comm->set_state(simgrid::kernel::activity::State::READY);
}
if (detached) {
other_comm->copy_data_fun = copy_data_fun;
if (MC_is_active() || MC_record_replay_is_active())
- other_comm->state_ = simgrid::kernel::activity::State::RUNNING;
+ other_comm->set_state(simgrid::kernel::activity::State::RUNNING);
else
other_comm->start();
} else {
if (other_comm->surf_action_ && other_comm->get_remaining() < 1e-12) {
XBT_DEBUG("comm %p has been already sent, and is finished, destroy it", other_comm.get());
- other_comm->state_ = simgrid::kernel::activity::State::DONE;
+ other_comm->set_state(simgrid::kernel::activity::State::DONE);
other_comm->set_mailbox(nullptr);
}
}
} else {
XBT_DEBUG("Match my %p with the existing %p", this_synchro.get(), other_comm.get());
- other_comm->state_ = simgrid::kernel::activity::State::READY;
+ other_comm->set_state(simgrid::kernel::activity::State::READY);
}
receiver->activities_.emplace_back(other_comm);
}
other_comm->copy_data_fun = copy_data_fun;
if (MC_is_active() || MC_record_replay_is_active()) {
- other_comm->state_ = simgrid::kernel::activity::State::RUNNING;
+ other_comm->set_state(simgrid::kernel::activity::State::RUNNING);
return other_comm;
}
other_comm->start();
CommImpl::CommImpl(s4u::Host* from, s4u::Host* to, double bytes) : size_(bytes), detached_(true), from_(from), to_(to)
{
- state_ = State::READY;
+ set_state(State::READY);
}
CommImpl::~CommImpl()
cleanup_surf();
- if (detached_ && state_ != State::DONE) {
+ if (detached_ && get_state() != State::DONE) {
/* the communication has failed and was detached:
* we have to free the buffer */
if (clean_fun)
CommImpl* CommImpl::start()
{
/* If both the sender and the receiver are already there, start the communication */
- if (state_ == State::READY) {
+ if (get_state() == State::READY) {
from_ = from_ != nullptr ? from_ : src_actor_->get_host();
to_ = to_ != nullptr ? to_ : dst_actor_->get_host();
/* Getting the network_model from the origin host
surf_action_ = net_model->communicate(from_, to_, size_, rate_);
surf_action_->set_activity(this);
surf_action_->set_category(get_tracing_category());
- start_time_ = surf_action_->get_start_time();
- state_ = State::RUNNING;
+ set_start_time(surf_action_->get_start_time());
+ set_state(State::RUNNING);
on_start(*this);
XBT_DEBUG("Starting communication %p from '%s' to '%s' (surf_action: %p; state: %s)", this, from_->get_cname(),
if (surf_action_->get_state() == resource::Action::State::FAILED) {
XBT_DEBUG("Communication from '%s' to '%s' failed to start because of a link failure", from_->get_cname(),
to_->get_cname());
- state_ = State::LINK_FAILURE;
+ set_state(State::LINK_FAILURE);
post();
} else if ((src_actor_ != nullptr && src_actor_->is_suspended()) ||
std::vector<s4u::Link*> CommImpl::get_traversed_links() const
{
- xbt_assert(state_ != State::WAITING, "You cannot use %s() if your communication is not ready (%s)", __FUNCTION__,
+ xbt_assert(get_state() != State::WAITING, "You cannot use %s() if your communication is not ready (%s)", __FUNCTION__,
get_state_str());
std::vector<s4u::Link*> vlinks;
XBT_ATTRIB_UNUSED double res = 0;
bool CommImpl::test()
{
if ((MC_is_active() || MC_record_replay_is_active()) && src_actor_ && dst_actor_)
- state_ = State::DONE;
+ set_state(State::DONE);
return ActivityImpl::test();
}
void CommImpl::wait_for(actor::ActorImpl* issuer, double timeout)
{
- XBT_DEBUG("CommImpl::wait_for(%g), %p, state %s", timeout, this, to_c_str(state_));
+ XBT_DEBUG("CommImpl::wait_for(%g), %p, state %s", timeout, this, get_state_str());
/* Associate this simcall to the wait synchro */
register_simcall(&issuer->simcall_);
if (MC_is_active() || MC_record_replay_is_active()) {
int idx = issuer->simcall_.mc_value_;
if (idx == 0) {
- state_ = State::DONE;
+ set_state(State::DONE);
} else {
/* If we reached this point, the wait simcall must have a timeout */
/* Otherwise it shouldn't be enabled and executed by the MC */
if (timeout < 0.0)
THROW_IMPOSSIBLE;
- state_ = (issuer == src_actor_ ? State::SRC_TIMEOUT : State::DST_TIMEOUT);
+ set_state(issuer == src_actor_ ? State::SRC_TIMEOUT : State::DST_TIMEOUT);
}
finish();
return;
/* If the synchro has already finish perform the error handling, */
/* otherwise set up a waiting timeout on the right side */
- if (state_ != State::WAITING && state_ != State::RUNNING) {
+ if (get_state() != State::WAITING && get_state() != State::RUNNING) {
finish();
} else { /* we need a sleep action (even when there is no timeout) to be notified of host failures */
resource::Action* sleep = issuer->get_host()->get_cpu()->sleep(timeout);
auto* comm = comms[idx];
comm->simcalls_.push_back(&issuer->simcall_);
simcall_comm_waitany__set__result(&issuer->simcall_, idx);
- comm->state_ = State::DONE;
+ comm->set_state(State::DONE);
comm->finish();
return;
}
comm->simcalls_.push_back(&issuer->simcall_);
/* see if the synchro is already finished */
- if (comm->state_ != State::WAITING && comm->state_ != State::RUNNING) {
+ if (comm->get_state() != State::WAITING && comm->get_state() != State::RUNNING) {
comm->finish();
break;
}
void CommImpl::cancel()
{
/* if the synchro is a waiting state means that it is still in a mbox so remove from it and delete it */
- if (state_ == State::WAITING) {
+ if (get_state() == State::WAITING) {
if (not detached_) {
mbox_->remove(this);
- state_ = State::CANCELED;
+ set_state(State::CANCELED);
}
} else if (not MC_is_active() /* when running the MC there are no surf actions */
- && not MC_record_replay_is_active() && (state_ == State::READY || state_ == State::RUNNING)) {
+ && not MC_record_replay_is_active() && (get_state() == State::READY || get_state() == State::RUNNING)) {
surf_action_->cancel();
}
}
/* Update synchro state */
if (src_timeout_ && src_timeout_->get_state() == resource::Action::State::FINISHED)
- state_ = State::SRC_TIMEOUT;
+ set_state(State::SRC_TIMEOUT);
else if (dst_timeout_ && dst_timeout_->get_state() == resource::Action::State::FINISHED)
- state_ = State::DST_TIMEOUT;
+ set_state(State::DST_TIMEOUT);
else if (src_timeout_ && src_timeout_->get_state() == resource::Action::State::FAILED)
- state_ = State::SRC_HOST_FAILURE;
+ set_state(State::SRC_HOST_FAILURE);
else if (dst_timeout_ && dst_timeout_->get_state() == resource::Action::State::FAILED)
- state_ = State::DST_HOST_FAILURE;
+ set_state(State::DST_HOST_FAILURE);
else if (surf_action_ && surf_action_->get_state() == resource::Action::State::FAILED) {
- state_ = State::LINK_FAILURE;
+ set_state(State::LINK_FAILURE);
} else
- state_ = State::DONE;
+ set_state(State::DONE);
XBT_DEBUG("CommImpl::post(): comm %p, state %s, src_proc %p, dst_proc %p, detached: %d", this, get_state_str(),
src_actor_.get(), dst_actor_.get(), detached_);
}
void CommImpl::set_exception(actor::ActorImpl* issuer)
{
- switch (state_) {
+ switch (get_state()) {
case State::FAILED:
issuer->exception_ = std::make_exception_ptr(NetworkFailureException(XBT_THROW_POINT, "Remote peer failed"));
break;
if (issuer == src_actor_)
issuer->context_->set_wannadie();
else {
- state_ = kernel::activity::State::FAILED;
+ set_state(State::FAILED);
issuer->exception_ = std::make_exception_ptr(NetworkFailureException(XBT_THROW_POINT, "Remote peer failed"));
}
break;
if (issuer == dst_actor_)
issuer->context_->set_wannadie();
else {
- state_ = kernel::activity::State::FAILED;
+ set_state(State::FAILED);
issuer->exception_ = std::make_exception_ptr(NetworkFailureException(XBT_THROW_POINT, "Remote peer failed"));
}
break;
} else {
XBT_DEBUG("I'm neither source nor dest");
}
- state_ = kernel::activity::State::FAILED;
+ set_state(State::FAILED);
issuer->throw_exception(std::make_exception_ptr(NetworkFailureException(XBT_THROW_POINT, "Link failure")));
break;
break;
default:
- xbt_assert(state_ == State::DONE, "Internal error in CommImpl::finish(): unexpected synchro state %s",
- to_c_str(state_));
+ xbt_assert(get_state() == State::DONE, "Internal error in CommImpl::finish(): unexpected synchro state %s",
+ get_state_str());
}
}
void CommImpl::finish()
{
- XBT_DEBUG("CommImpl::finish() in state %s", to_c_str(state_));
+ XBT_DEBUG("CommImpl::finish() in state %s", get_state_str());
/* If the synchro is still in a rendez-vous point then remove from it */
if (mbox_)
mbox_->remove(this);
- if (state_ == State::DONE)
+ if (get_state() == State::DONE)
copy_data();
while (not simcalls_.empty()) {
ExecImpl* ExecImpl::start()
{
- state_ = State::RUNNING;
+ set_state(State::RUNNING);
if (not MC_is_active() && not MC_record_replay_is_active()) {
if (hosts_.size() == 1) {
surf_action_ = hosts_.front()->get_cpu()->execution_start(flops_amounts_.front(), bound_);
surf_action_ = host_model->execute_parallel(hosts_, flops_amounts_.data(), bytes_amounts_.data(), -1);
}
surf_action_->set_activity(this);
- start_time_ = surf_action_->get_start_time();
+ set_start_time(surf_action_->get_start_time());
}
XBT_DEBUG("Create execute synchro %p: %s", this, get_cname());
double ExecImpl::get_remaining() const
{
- if (state_ == State::WAITING || state_ == State::FAILED)
+ if (get_state() == State::WAITING || get_state() == State::FAILED)
return flops_amounts_.front();
return ActivityImpl::get_remaining();
}
double ExecImpl::get_seq_remaining_ratio()
{
- if (state_ == State::WAITING)
+ if (get_state() == State::WAITING)
return 1;
return (surf_action_ == nullptr) ? 0 : surf_action_->get_remains() / surf_action_->get_cost();
}
double ExecImpl::get_par_remaining_ratio()
{
// parallel task: their remain is already between 0 and 1
- if (state_ == State::WAITING)
+ if (get_state() == State::WAITING)
return 1;
return (surf_action_ == nullptr) ? 0 : surf_action_->get_remains();
}
if (std::any_of(hosts_.begin(), hosts_.end(), [](const s4u::Host* host) { return not host->is_on(); })) {
/* If one of the hosts running the synchro failed, notice it. This way, the asking
* process can be killed if it runs on that host itself */
- state_ = State::FAILED;
+ set_state(State::FAILED);
} else if (surf_action_->get_state() == resource::Action::State::FAILED) {
/* If all the hosts are running the synchro didn't fail, then the synchro was canceled */
- state_ = State::CANCELED;
+ set_state(State::CANCELED);
} else if (timeout_detector_ && timeout_detector_->get_state() == resource::Action::State::FINISHED) {
if (surf_action_->get_remains() > 0.0) {
surf_action_->set_state(resource::Action::State::FAILED);
- state_ = State::TIMEOUT;
+ set_state(State::TIMEOUT);
} else {
- state_ = State::DONE;
+ set_state(State::DONE);
}
} else {
- state_ = State::DONE;
+ set_state(State::DONE);
}
clean_action();
if (get_actor() != nullptr) {
get_actor()->activities_.remove(this);
}
- if (state_ != State::FAILED && cb_id_ >= 0)
+ if (get_state() != State::FAILED && cb_id_ >= 0)
s4u::Host::on_state_change.disconnect(cb_id_);
/* Answer all simcalls associated with the synchro */
finish();
void ExecImpl::set_exception(actor::ActorImpl* issuer)
{
- switch (state_) {
+ switch (get_state()) {
case State::FAILED:
static_cast<s4u::Exec*>(get_iface())->complete(s4u::Activity::State::FAILED);
if (issuer->get_host()->is_on())
break;
default:
- xbt_assert(state_ == State::DONE, "Internal error in ExecImpl::finish(): unexpected synchro state %s",
- to_c_str(state_));
+ xbt_assert(get_state() == State::DONE, "Internal error in ExecImpl::finish(): unexpected synchro state %s",
+ get_state_str());
}
}
void ExecImpl::finish()
{
- XBT_DEBUG("ExecImpl::finish() in state %s", to_c_str(state_));
+ XBT_DEBUG("ExecImpl::finish() in state %s", get_state_str());
while (not simcalls_.empty()) {
smx_simcall_t simcall = simcalls_.front();
simcalls_.pop_front();
hosts_.clear();
bytes_amounts_.clear();
flops_amounts_.clear();
- start_time_ = -1.0;
+ set_start_time(-1.0);
}
ActivityImpl* ExecImpl::migrate(s4u::Host* to)
/* associate this simcall to the the synchro */
exec->simcalls_.push_back(&issuer->simcall_);
/* see if the synchro is already finished */
- if (exec->state_ != State::WAITING && exec->state_ != State::RUNNING) {
+ if (exec->get_state() != State::WAITING && exec->get_state() != State::RUNNING) {
exec->finish();
break;
}
IoImpl* IoImpl::start()
{
- state_ = State::RUNNING;
+ set_state(State::RUNNING);
surf_action_ =
disk_->get_host()->get_netpoint()->get_englobing_zone()->get_disk_model()->io_start(disk_, size_, type_);
surf_action_->set_sharing_penalty(sharing_penalty_);
surf_action_->set_activity(this);
- start_time_ = surf_action_->get_start_time();
+ set_start_time(surf_action_->get_start_time());
XBT_DEBUG("Create IO synchro %p %s", this, get_cname());
performed_ioops_ = surf_action_->get_cost();
if (surf_action_->get_state() == resource::Action::State::FAILED) {
if (disk_ && not disk_->is_on())
- state_ = State::FAILED;
+ set_state(State::FAILED);
else
- state_ = State::CANCELED;
+ set_state(State::CANCELED);
} else if (timeout_detector_ && timeout_detector_->get_state() == resource::Action::State::FINISHED) {
if (surf_action_->get_remains() > 0.0) {
surf_action_->set_state(resource::Action::State::FAILED);
- state_ = State::TIMEOUT;
+ set_state(State::TIMEOUT);
} else {
- state_ = State::DONE;
+ set_state(State::DONE);
}
} else {
- state_ = State::DONE;
+ set_state(State::DONE);
}
clean_action();
}
void IoImpl::set_exception(actor::ActorImpl* issuer)
{
- switch (state_) {
+ switch (get_state()) {
case State::FAILED:
issuer->context_->set_wannadie();
static_cast<s4u::Io*>(get_iface())->complete(s4u::Activity::State::FAILED);
issuer->exception_ = std::make_exception_ptr(TimeoutException(XBT_THROW_POINT, "Timeouted"));
break;
default:
- xbt_assert(state_ == State::DONE, "Internal error in IoImpl::finish(): unexpected synchro state %s",
- to_c_str(state_));
+ xbt_assert(get_state() == State::DONE, "Internal error in IoImpl::finish(): unexpected synchro state %s",
+ get_state_str());
}
}
void IoImpl::finish()
{
- XBT_DEBUG("IoImpl::finish() in state %s", to_c_str(state_));
+ XBT_DEBUG("IoImpl::finish() in state %s", get_state_str());
while (not simcalls_.empty()) {
smx_simcall_t simcall = simcalls_.front();
simcalls_.pop_front();
io->simcalls_.push_back(&issuer->simcall_);
/* see if the synchro is already finished */
- if (io->state_ != State::WAITING && io->state_ != State::RUNNING) {
+ if (io->get_state() != State::WAITING && io->get_state() != State::RUNNING) {
io->finish();
break;
}
{
if (surf_action_->get_state() == resource::Action::State::FAILED) {
if (host_ && not host_->is_on())
- state_ = State::SRC_HOST_FAILURE;
+ set_state(State::SRC_HOST_FAILURE);
else
- state_ = State::CANCELED;
+ set_state(State::CANCELED);
} else if (surf_action_->get_state() == resource::Action::State::FINISHED) {
- state_ = State::DONE;
+ set_state(State::DONE);
}
clean_action();
}
void SleepImpl::finish()
{
- XBT_DEBUG("SleepImpl::finish() in state %s", to_c_str(state_));
+ XBT_DEBUG("SleepImpl::finish() in state %s", get_state_str());
while (not simcalls_.empty()) {
const s_smx_simcall* simcall = simcalls_.front();
simcalls_.pop_front();
void RawImpl::post()
{
- if (surf_action_->get_state() == resource::Action::State::FAILED) {
- state_ = State::FAILED;
- } else if (surf_action_->get_state() == resource::Action::State::FINISHED) {
- state_ = State::SRC_TIMEOUT;
- }
+ if (surf_action_->get_state() == resource::Action::State::FAILED)
+ set_state(State::FAILED);
+ else if (surf_action_->get_state() == resource::Action::State::FINISHED)
+ set_state(State::SRC_TIMEOUT);
clean_action();
/* Answer all simcalls associated with the synchro */
}
void RawImpl::set_exception(actor::ActorImpl* issuer)
{
- if (state_ == State::FAILED) {
+ if (get_state() == State::FAILED) {
issuer->context_->set_wannadie();
issuer->exception_ = std::make_exception_ptr(HostFailureException(XBT_THROW_POINT, "Host failed"));
} else {
- xbt_assert(state_ == State::SRC_TIMEOUT, "Internal error in RawImpl::finish() unexpected synchro state %s",
- to_c_str(state_));
+ xbt_assert(get_state() == State::SRC_TIMEOUT, "Internal error in RawImpl::finish() unexpected synchro state %s",
+ get_state_str());
}
}
void RawImpl::finish()
{
- XBT_DEBUG("RawImpl::finish() in state %s", to_c_str(state_));
+ XBT_DEBUG("RawImpl::finish() in state %s", get_state_str());
xbt_assert(simcalls_.size() == 1, "Unexpected number of simcalls waiting: %zu", simcalls_.size());
smx_simcall_t simcall = simcalls_.front();
simcalls_.pop_front();
/* destroy the blocking synchro if any */
if (waiting_synchro_ != nullptr) {
waiting_synchro_->cancel();
- waiting_synchro_->state_ = activity::State::FAILED;
+ waiting_synchro_->set_state(activity::State::FAILED);
activity::ExecImplPtr exec = boost::dynamic_pointer_cast<activity::ExecImpl>(waiting_synchro_);
activity::CommImplPtr comm = boost::dynamic_pointer_cast<activity::CommImpl>(waiting_synchro_);
return true;
}
/* On the other hand if it hasn't a timeout, check if the comm is ready.*/
- else if (act->detached() && act->src_actor_ == nullptr && act->state_ == simgrid::kernel::activity::State::READY)
+ else if (act->detached() && act->src_actor_ == nullptr &&
+ act->get_state() == simgrid::kernel::activity::State::READY)
return (act->dst_actor_ != nullptr);
return (act->src_actor_ && act->dst_actor_);
}
auto current_iter = iter;
++iter;
- if (action != nullptr && action->get_finish_time() != now && activity->state_ == kernel::activity::State::RUNNING) {
+ if (action != nullptr && action->get_finish_time() != now &&
+ activity->get_state() == kernel::activity::State::RUNNING) {
if (remaining_cost_after_last_update == activity_uninitialized_remaining_cost) {
remaining_cost_after_last_update = action->get_cost();
}
double computed_flops_since_last_update = remaining_cost_after_last_update - /*remaining now*/activity->get_remaining();
computed_flops_ += computed_flops_since_last_update;
remaining_cost_after_last_update = activity->get_remaining();
- } else if (activity->state_ == kernel::activity::State::DONE) {
+ } else if (activity->get_state() == kernel::activity::State::DONE) {
computed_flops_ += remaining_cost_after_last_update;
current_activities.erase(current_iter);
}
Comm::~Comm()
{
if (state_ == State::STARTED && not detached_ &&
- (pimpl_ == nullptr || pimpl_->state_ == kernel::activity::State::RUNNING)) {
+ (pimpl_ == nullptr || pimpl_->get_state() == kernel::activity::State::RUNNING)) {
XBT_INFO("Comm %p freed before its completion. Did you forget to detach it? (state: %s)", this, get_state_str());
if (pimpl_ != nullptr)
XBT_INFO("pimpl_->state: %s", pimpl_->get_state_str());
changed_pos = simcall_comm_waitany(rcomms.data(), rcomms.size(), timeout);
} catch (const NetworkFailureException& e) {
for (auto c : comms) {
- if (c->pimpl_->state_ == kernel::activity::State::FAILED) {
+ if (c->pimpl_->get_state() == kernel::activity::State::FAILED) {
c->complete(State::FAILED);
}
}
{
auto pimpl = kernel::activity::ExecImplPtr(new kernel::activity::ExecImpl());
unsigned int cb_id = Host::on_state_change.connect([pimpl](s4u::Host const& h) {
- if (not h.is_on() && pimpl->state_ == kernel::activity::State::RUNNING &&
+ if (not h.is_on() && pimpl->get_state() == kernel::activity::State::RUNNING &&
std::find(pimpl->get_hosts().begin(), pimpl->get_hosts().end(), &h) != pimpl->get_hosts().end()) {
- pimpl->state_ = kernel::activity::State::FAILED;
+ pimpl->set_state(kernel::activity::State::FAILED);
pimpl->post();
}
});
{
bool comm_ready = false;
if (not pimpl_->empty()) {
- comm_ready = pimpl_->front()->state_ == kernel::activity::State::DONE;
+ comm_ready = pimpl_->front()->get_state() == kernel::activity::State::DONE;
} else if (pimpl_->is_permanent() && pimpl_->has_some_done_comm()) {
- comm_ready = pimpl_->done_front()->state_ == kernel::activity::State::DONE;
+ comm_ready = pimpl_->done_front()->get_state() == kernel::activity::State::DONE;
}
return comm_ready;
}
auto hosts = exec->get_hosts();
if (std::find(hosts.begin(), hosts.end(), &piface_) != hosts.end()) {
exec->cancel();
- exec->state_ = activity::State::FAILED;
+ exec->set_state(activity::State::FAILED);
}
}
}