simgrid::kernel::activity::CommImpl::CommImpl(e_smx_comm_type_t _type) : type(_type)
{
state_ = SIMIX_WAITING;
- src_data = nullptr;
- dst_data = nullptr;
+ src_data_ = nullptr;
+ dst_data_ = nullptr;
XBT_DEBUG("Create comm activity %p", this);
}
/* the communication has failed and was detached:
* we have to free the buffer */
if (clean_fun)
- clean_fun(src_buff);
- src_buff = nullptr;
+ clean_fun(src_buff_);
+ src_buff_ = nullptr;
}
if (mbox)
void simgrid::kernel::activity::CommImpl::suspend()
{
/* FIXME: shall we suspend also the timeout synchro? */
- if (surfAction_)
- surfAction_->suspend();
- /* in the other case, the action will be suspended on creation, in SIMIX_comm_start() */
+ if (surf_action_)
+ surf_action_->suspend();
+ /* if not created yet, 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 (surfAction_)
- surfAction_->resume();
+ if (surf_action_)
+ surf_action_->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)) {
- surfAction_->cancel();
+ surf_action_->cancel();
}
}
/** @brief get the amount remaining from the communication */
double simgrid::kernel::activity::CommImpl::remains()
{
- return surfAction_->get_remains();
+ return surf_action_->get_remains();
}
/** @brief This is part of the cleanup process, probably an internal command */
void simgrid::kernel::activity::CommImpl::cleanupSurf()
{
- if (surfAction_) {
- surfAction_->unref();
- surfAction_ = nullptr;
+ if (surf_action_) {
+ surf_action_->unref();
+ surf_action_ = nullptr;
}
- if (src_timeout) {
- src_timeout->unref();
- src_timeout = nullptr;
+ if (src_timeout_) {
+ src_timeout_->unref();
+ src_timeout_ = nullptr;
}
- if (dst_timeout) {
- dst_timeout->unref();
- dst_timeout = nullptr;
+ if (dst_timeout_) {
+ dst_timeout_->unref();
+ dst_timeout_ = nullptr;
}
}
void simgrid::kernel::activity::CommImpl::post()
{
/* Update synchro state */
- if (src_timeout && src_timeout->get_state() == simgrid::kernel::resource::Action::State::FINISHED)
+ if (src_timeout_ && src_timeout_->get_state() == simgrid::kernel::resource::Action::State::FINISHED)
state_ = SIMIX_SRC_TIMEOUT;
- else if (dst_timeout && dst_timeout->get_state() == simgrid::kernel::resource::Action::State::FINISHED)
+ else if (dst_timeout_ && dst_timeout_->get_state() == simgrid::kernel::resource::Action::State::FINISHED)
state_ = SIMIX_DST_TIMEOUT;
- else if (src_timeout && src_timeout->get_state() == simgrid::kernel::resource::Action::State::FAILED)
+ else if (src_timeout_ && src_timeout_->get_state() == simgrid::kernel::resource::Action::State::FAILED)
state_ = SIMIX_SRC_HOST_FAILURE;
- else if (dst_timeout && dst_timeout->get_state() == simgrid::kernel::resource::Action::State::FAILED)
+ else if (dst_timeout_ && dst_timeout_->get_state() == simgrid::kernel::resource::Action::State::FAILED)
state_ = SIMIX_DST_HOST_FAILURE;
- else if (surfAction_ && surfAction_->get_state() == simgrid::kernel::resource::Action::State::FAILED) {
+ else if (surf_action_ && surf_action_->get_state() == simgrid::kernel::resource::Action::State::FAILED) {
state_ = SIMIX_LINK_FAILURE;
} else
state_ = SIMIX_DONE;
XBT_DEBUG("SIMIX_post_comm: comm %p, state %d, src_proc %p, dst_proc %p, detached: %d", this, (int)state_,
- src_proc.get(), dst_proc.get(), detached);
+ src_actor_.get(), dst_actor_.get(), detached);
/* destroy the surf actions associated with the Simix communication */
cleanupSurf();
void (*copy_data_fun)(smx_activity_t, void*, size_t) = nullptr;
/* Surf action data */
- resource::Action* surfAction_ = nullptr; /* The Surf communication action encapsulated */
- resource::Action* src_timeout = nullptr; /* Surf's actions to instrument the timeouts */
- resource::Action* dst_timeout = nullptr; /* Surf's actions to instrument the timeouts */
- actor::ActorImplPtr src_proc = nullptr;
- actor::ActorImplPtr dst_proc = nullptr;
- double rate = 0.0;
- double task_size = 0.0;
+ resource::Action* surf_action_ = nullptr; /* The Surf communication action encapsulated */
+ resource::Action* src_timeout_ = nullptr; /* Surf's actions to instrument the timeouts */
+ resource::Action* dst_timeout_ = nullptr; /* Surf's actions to instrument the timeouts */
+ actor::ActorImplPtr src_actor_ = nullptr;
+ actor::ActorImplPtr dst_actor_ = nullptr;
+ double rate_ = 0.0;
+ double task_size_ = 0.0;
/* Data to be transfered */
- void* src_buff = nullptr;
- void* dst_buff = nullptr;
- size_t src_buff_size = 0;
- size_t* dst_buff_size = nullptr;
+ void* src_buff_ = nullptr;
+ void* dst_buff_ = nullptr;
+ size_t src_buff_size_ = 0;
+ size_t* dst_buff_size_ = nullptr;
bool copied = false; /* whether the data were already copied */
- void* src_data = nullptr; /* User data associated to communication */
- void* dst_data = nullptr;
+ void* src_data_ = nullptr; /* User data associated to the communication */
+ void* dst_data_ = nullptr;
};
}
}
mc_model_checker->process().read(temp_comm, comm_addr);
simgrid::kernel::activity::CommImpl* comm = temp_comm.getBuffer();
- smx_actor_t src_proc = mc_model_checker->process().resolveActor(simgrid::mc::remote(comm->src_proc.get()));
- smx_actor_t dst_proc = mc_model_checker->process().resolveActor(simgrid::mc::remote(comm->dst_proc.get()));
+ smx_actor_t src_proc = mc_model_checker->process().resolveActor(simgrid::mc::remote(comm->src_actor_.get()));
+ smx_actor_t dst_proc = mc_model_checker->process().resolveActor(simgrid::mc::remote(comm->dst_actor_.get()));
comm_pattern->src_proc = src_proc->pid_;
comm_pattern->dst_proc = dst_proc->pid_;
comm_pattern->src_host = MC_smx_actor_get_host_name(src_proc);
comm_pattern->dst_host = MC_smx_actor_get_host_name(dst_proc);
- if (comm_pattern->data.size() == 0 && comm->src_buff != nullptr) {
+ if (comm_pattern->data.size() == 0 && comm->src_buff_ != nullptr) {
size_t buff_size;
- mc_model_checker->process().read(&buff_size, remote(comm->dst_buff_size));
+ mc_model_checker->process().read(&buff_size, remote(comm->dst_buff_size_));
comm_pattern->data.resize(buff_size);
mc_model_checker->process().read_bytes(comm_pattern->data.data(), comm_pattern->data.size(),
- remote(comm->src_buff));
+ remote(comm->src_buff_));
}
}
char* remote_name = mc_model_checker->process().read<char*>(
RemotePtr<char*>((uint64_t)(synchro->mbox ? &synchro->mbox->name_ : &synchro->mbox_cpy->name_)));
pattern->rdv = mc_model_checker->process().read_string(RemotePtr<char>(remote_name));
- pattern->src_proc = mc_model_checker->process().resolveActor(simgrid::mc::remote(synchro->src_proc.get()))->pid_;
+ pattern->src_proc = mc_model_checker->process().resolveActor(simgrid::mc::remote(synchro->src_actor_.get()))->pid_;
pattern->src_host = MC_smx_actor_get_host_name(issuer);
#if HAVE_SMPI
pattern->tag = mpi_request.tag();
#endif
- if (synchro->src_buff != nullptr) {
- pattern->data.resize(synchro->src_buff_size);
- mc_model_checker->process().read_bytes(pattern->data.data(), pattern->data.size(), remote(synchro->src_buff));
+ if (synchro->src_buff_ != nullptr) {
+ pattern->data.resize(synchro->src_buff_size_);
+ mc_model_checker->process().read_bytes(pattern->data.data(), pattern->data.size(), remote(synchro->src_buff_));
}
#if HAVE_SMPI
if(mpi_request.detached()){
&remote_name, remote(comm->mbox ? &simgrid::xbt::string::to_string_data(comm->mbox->name_).data
: &simgrid::xbt::string::to_string_data(comm->mbox_cpy->name_).data));
pattern->rdv = mc_model_checker->process().read_string(RemotePtr<char>(remote_name));
- pattern->dst_proc = mc_model_checker->process().resolveActor(simgrid::mc::remote(comm->dst_proc.get()))->pid_;
+ pattern->dst_proc = mc_model_checker->process().resolveActor(simgrid::mc::remote(comm->dst_actor_.get()))->pid_;
pattern->dst_host = MC_smx_actor_get_host_name(issuer);
} else
xbt_die("Unexpected call_type %i", (int) call_type);
simgrid::kernel::activity::CommImpl* act =
static_cast<simgrid::kernel::activity::CommImpl*>(simcall_comm_wait__getraw__comm(req));
- if (act->src_timeout || act->dst_timeout) {
+ if (act->src_timeout_ || act->dst_timeout_) {
/* If it has a timeout it will be always be enabled (regardless of who declared the timeout),
* because even if the communication is not ready, it can timeout and won't block. */
if (_sg_mc_timeout == 1)
return true;
}
/* On the other hand if it hasn't a timeout, check if the comm is ready.*/
- else if (act->detached && act->src_proc == nullptr && act->type == SIMIX_COMM_READY)
- return (act->dst_proc != nullptr);
- return (act->src_proc && act->dst_proc);
+ else if (act->detached && act->src_actor_ == nullptr && act->type == SIMIX_COMM_READY)
+ return (act->dst_actor_ != nullptr);
+ return (act->src_actor_ && act->dst_actor_);
}
case SIMCALL_COMM_WAITANY: {
xbt_dynar_t comms = simcall_comm_waitany__get__comms(req);
for (unsigned int index = 0; index < comms->used; ++index) {
simgrid::kernel::activity::CommImpl* act = xbt_dynar_get_as(comms, index, simgrid::kernel::activity::CommImpl*);
- if (act->src_proc && act->dst_proc)
+ if (act->src_actor_ && act->dst_actor_)
return true;
}
return false;
&& simcall_comm_wait__get__timeout(r2) <= 0)
return false;
- if ((r1->issuer != synchro2->src_proc)
- && (r1->issuer != synchro2->dst_proc)
- && simcall_comm_wait__get__timeout(r2) <= 0)
+ if ((r1->issuer != synchro2->src_actor_.get()) && (r1->issuer != synchro2->dst_actor_.get()) &&
+ simcall_comm_wait__get__timeout(r2) <= 0)
return false;
- if ((r1->call == SIMCALL_COMM_ISEND)
- && (synchro2->type == SIMIX_COMM_SEND)
- && (synchro2->src_buff !=
- simcall_comm_isend__get__src_buff(r1))
- && simcall_comm_wait__get__timeout(r2) <= 0)
+ if ((r1->call == SIMCALL_COMM_ISEND) && (synchro2->type == SIMIX_COMM_SEND) &&
+ (synchro2->src_buff_ != simcall_comm_isend__get__src_buff(r1)) && simcall_comm_wait__get__timeout(r2) <= 0)
return false;
- if ((r1->call == SIMCALL_COMM_IRECV)
- && (synchro2->type == SIMIX_COMM_RECEIVE)
- && (synchro2->dst_buff != simcall_comm_irecv__get__dst_buff(r1))
- && simcall_comm_wait__get__timeout(r2) <= 0)
+ if ((r1->call == SIMCALL_COMM_IRECV) && (synchro2->type == SIMIX_COMM_RECEIVE) &&
+ (synchro2->dst_buff_ != simcall_comm_irecv__get__dst_buff(r1)) && simcall_comm_wait__get__timeout(r2) <= 0)
return false;
}
return false;
#endif
- if (r1->call == SIMCALL_COMM_WAIT
- && (r2->call == SIMCALL_COMM_WAIT || r2->call == SIMCALL_COMM_TEST)
- && (synchro1->src_proc == nullptr || synchro1->dst_proc == nullptr))
+ if (r1->call == SIMCALL_COMM_WAIT && (r2->call == SIMCALL_COMM_WAIT || r2->call == SIMCALL_COMM_TEST) &&
+ (synchro1->src_actor_.get() == nullptr || synchro1->dst_actor_.get() == nullptr))
return false;
if (r1->call == SIMCALL_COMM_TEST &&
- (simcall_comm_test__get__comm(r1) == nullptr
- || synchro1->src_buff == nullptr
- || synchro1->dst_buff == nullptr))
+ (simcall_comm_test__get__comm(r1) == nullptr || synchro1->src_buff_ == nullptr || synchro1->dst_buff_ == nullptr))
return false;
- if (r1->call == SIMCALL_COMM_TEST && r2->call == SIMCALL_COMM_WAIT
- && synchro1->src_buff == synchro2->src_buff
- && synchro1->dst_buff == synchro2->dst_buff)
+ if (r1->call == SIMCALL_COMM_TEST && r2->call == SIMCALL_COMM_WAIT && synchro1->src_buff_ == synchro2->src_buff_ &&
+ synchro1->dst_buff_ == synchro2->dst_buff_)
return false;
- if (r1->call == SIMCALL_COMM_WAIT && r2->call == SIMCALL_COMM_TEST
- && synchro1->src_buff != nullptr
- && synchro1->dst_buff != nullptr
- && synchro2->src_buff != nullptr
- && synchro2->dst_buff != nullptr
- && synchro1->dst_buff != synchro2->src_buff
- && synchro1->dst_buff != synchro2->dst_buff
- && synchro2->dst_buff != synchro1->src_buff)
+ if (r1->call == SIMCALL_COMM_WAIT && r2->call == SIMCALL_COMM_TEST && synchro1->src_buff_ != nullptr &&
+ synchro1->dst_buff_ != nullptr && synchro2->src_buff_ != nullptr && synchro2->dst_buff_ != nullptr &&
+ synchro1->dst_buff_ != synchro2->src_buff_ && synchro1->dst_buff_ != synchro2->dst_buff_ &&
+ synchro2->dst_buff_ != synchro1->src_buff_)
return false;
return true;
return simcall_comm_irecv__get__mbox(r1)
== simcall_comm_irecv__get__mbox(r2);
case SIMCALL_COMM_WAIT:
- if (synchro1->src_buff == synchro2->src_buff
- && synchro1->dst_buff == synchro2->dst_buff)
+ if (synchro1->src_buff_ == synchro2->src_buff_ && synchro1->dst_buff_ == synchro2->dst_buff_)
return false;
- if (synchro1->src_buff != nullptr && synchro1->dst_buff != nullptr && synchro2->src_buff != nullptr &&
- synchro2->dst_buff != nullptr && synchro1->dst_buff != synchro2->src_buff &&
- synchro1->dst_buff != synchro2->dst_buff && synchro2->dst_buff != synchro1->src_buff)
+ if (synchro1->src_buff_ != nullptr && synchro1->dst_buff_ != nullptr && synchro2->src_buff_ != nullptr &&
+ synchro2->dst_buff_ != nullptr && synchro1->dst_buff_ != synchro2->src_buff_ &&
+ synchro1->dst_buff_ != synchro2->dst_buff_ && synchro2->dst_buff_ != synchro1->src_buff_)
return false;
return true;
default:
} else
act = remote_act;
- smx_actor_t src_proc = mc_model_checker->process().resolveActor(simgrid::mc::remote(act->src_proc.get()));
- smx_actor_t dst_proc = mc_model_checker->process().resolveActor(simgrid::mc::remote(act->dst_proc.get()));
+ smx_actor_t src_proc = mc_model_checker->process().resolveActor(simgrid::mc::remote(act->src_actor_.get()));
+ smx_actor_t dst_proc = mc_model_checker->process().resolveActor(simgrid::mc::remote(act->dst_actor_.get()));
args =
bprintf("comm=%s [(%ld)%s (%s)-> (%ld)%s (%s)]", p, src_proc ? src_proc->pid_ : 0,
src_proc ? MC_smx_actor_get_host_name(src_proc) : "", src_proc ? MC_smx_actor_get_name(src_proc) : "",
act = remote_act;
char* p;
- if (act->src_proc == nullptr || act->dst_proc == nullptr) {
+ if (act->src_actor_.get() == nullptr || act->dst_actor_.get() == nullptr) {
type = "Test FALSE";
p = pointer_to_string(remote_act);
args = bprintf("comm=%s", p);
type = "Test TRUE";
p = pointer_to_string(remote_act);
- smx_actor_t src_proc = mc_model_checker->process().resolveActor(simgrid::mc::remote(act->src_proc.get()));
- smx_actor_t dst_proc = mc_model_checker->process().resolveActor(simgrid::mc::remote(act->dst_proc.get()));
+ smx_actor_t src_proc = mc_model_checker->process().resolveActor(simgrid::mc::remote(act->src_actor_.get()));
+ smx_actor_t dst_proc = mc_model_checker->process().resolveActor(simgrid::mc::remote(act->dst_actor_.get()));
args = bprintf("comm=%s [(%ld)%s (%s) -> (%ld)%s (%s)]", p, src_proc->pid_, MC_smx_actor_get_name(src_proc),
MC_smx_actor_get_host_name(src_proc), dst_proc->pid_, MC_smx_actor_get_name(dst_proc),
MC_smx_actor_get_host_name(dst_proc));
simgrid::mc::Remote<simgrid::kernel::activity::CommImpl> temp_comm;
mc_model_checker->process().read(temp_comm, remote(static_cast<simgrid::kernel::activity::CommImpl*>(remote_act)));
simgrid::kernel::activity::CommImpl* comm = temp_comm.getBuffer();
- return comm->src_proc && comm->dst_proc;
+ return comm->src_actor_.get() && comm->dst_actor_.get();
}
remote(static_cast<simgrid::kernel::activity::CommImpl*>(remote_act)));
simgrid::kernel::activity::CommImpl* comm = temp_comm.getBuffer();
- smx_actor_t src_proc = mc_model_checker->process().resolveActor(simgrid::mc::remote(comm->src_proc.get()));
- smx_actor_t dst_proc = mc_model_checker->process().resolveActor(simgrid::mc::remote(comm->dst_proc.get()));
+ smx_actor_t src_proc = mc_model_checker->process().resolveActor(simgrid::mc::remote(comm->src_actor_.get()));
+ smx_actor_t dst_proc = mc_model_checker->process().resolveActor(simgrid::mc::remote(comm->dst_actor_.get()));
if (issuer->host_)
label = simgrid::xbt::string_printf("[(%ld)%s] Wait [(%ld)->(%ld)]", issuer->pid_,
MC_smx_actor_get_host_name(issuer), src_proc ? src_proc->pid_ : 0,
simgrid::mc::Remote<simgrid::kernel::activity::CommImpl> temp_comm;
mc_model_checker->process().read(temp_comm, remote(static_cast<simgrid::kernel::activity::CommImpl*>(remote_act)));
simgrid::kernel::activity::CommImpl* comm = temp_comm.getBuffer();
- if (comm->src_proc == nullptr || comm->dst_proc == nullptr) {
+ if (comm->src_actor_.get() == nullptr || comm->dst_actor_.get() == nullptr) {
if (issuer->host_)
label = simgrid::xbt::string_printf("[(%ld)%s] Test FALSE", issuer->pid_, MC_smx_actor_get_host_name(issuer));
else
simgrid::mc::Remote<simgrid::kernel::activity::CommImpl> temp_act;
mc_model_checker->process().read(temp_act, remote_act);
simgrid::kernel::activity::CommImpl* act = temp_act.getBuffer();
- if (act->src_proc && act->dst_proc)
+ if (act->src_actor_.get() && act->dst_actor_.get())
state->transition.argument = 0;
- else if (act->src_proc == nullptr && act->type == SIMIX_COMM_READY && act->detached == 1)
+ else if (act->src_actor_.get() == nullptr && act->type == SIMIX_COMM_READY && act->detached == 1)
state->transition.argument = 0;
else
state->transition.argument = -1;
// notify the user callback if any
if (msg_global->task_copy_callback) {
msg_task_t task = static_cast<msg_task_t>(buff);
- msg_global->task_copy_callback(task, comm->src_proc->ciface(), comm->dst_proc->ciface());
+ msg_global->task_copy_callback(task, comm->src_actor_->ciface(), comm->dst_actor_->ciface());
}
}
if (not comm)
return -1;
- return MSG_process_get_PID(static_cast<msg_task_t>(comm->src_buff)->simdata->sender);
+ return MSG_process_get_PID(static_cast<msg_task_t>(comm->src_buff_)->simdata->sender);
}
/**
simgrid::kernel::activity::CommImplPtr comm =
boost::dynamic_pointer_cast<simgrid::kernel::activity::CommImpl>(synchro);
if (comm != nullptr) {
- comm->surfAction_->set_category(category);
+ comm->surf_action_->set_category(category);
}
}
boost::dynamic_pointer_cast<simgrid::kernel::activity::CommImpl>(std::move(*it));
if (comm->type == SIMIX_COMM_SEND) {
- other_user_data = comm->src_data;
+ other_user_data = comm->src_data_;
} else if (comm->type == SIMIX_COMM_RECEIVE) {
- other_user_data = comm->dst_data;
+ other_user_data = comm->dst_data_;
}
if (comm->type == type && (match_fun == nullptr || match_fun(this_user_data, other_user_data, comm.get())) &&
(not comm->match_fun || comm->match_fun(other_user_data, this_user_data, my_synchro.get()))) {
if (mbox->permanent_receiver_ != nullptr) {
//this mailbox is for small messages, which have to be sent right now
other_comm->state_ = SIMIX_READY;
- other_comm->dst_proc = mbox->permanent_receiver_.get();
+ other_comm->dst_actor_ = mbox->permanent_receiver_.get();
mbox->done_comm_queue_.push_back(other_comm);
XBT_DEBUG("pushing a message into the permanent receive list %p, comm %p", mbox, other_comm.get());
}
/* Setup the communication synchro */
- other_comm->src_proc = src_proc;
- other_comm->task_size = task_size;
- other_comm->rate = rate;
- other_comm->src_buff = src_buff;
- other_comm->src_buff_size = src_buff_size;
- other_comm->src_data = data;
+ other_comm->src_actor_ = src_proc;
+ other_comm->task_size_ = task_size;
+ other_comm->rate_ = rate;
+ other_comm->src_buff_ = src_buff;
+ other_comm->src_buff_size_ = src_buff_size;
+ other_comm->src_data_ = data;
other_comm->match_fun = match_fun;
other_comm->copy_data_fun = copy_data_fun;
other_comm = std::move(this_synchro);
mbox->push(other_comm);
} else {
- if (other_comm->surfAction_ && other_comm->remains() < 1e-12) {
+ if (other_comm->surf_action_ && 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;
}
/* Setup communication synchro */
- other_comm->dst_proc = dst_proc;
- other_comm->dst_buff = dst_buff;
- other_comm->dst_buff_size = dst_buff_size;
- other_comm->dst_data = data;
+ other_comm->dst_actor_ = dst_proc;
+ other_comm->dst_buff_ = dst_buff;
+ other_comm->dst_buff_size_ = dst_buff_size;
+ other_comm->dst_data_ = data;
- if (rate > -1.0 && (other_comm->rate < 0.0 || rate < other_comm->rate))
- other_comm->rate = rate;
+ if (rate > -1.0 && (other_comm->rate_ < 0.0 || rate < other_comm->rate_))
+ other_comm->rate_ = rate;
other_comm->match_fun = match_fun;
other_comm->copy_data_fun = copy_data_fun;
simgrid::kernel::activity::CommImplPtr comm =
boost::static_pointer_cast<simgrid::kernel::activity::CommImpl>(synchro);
- if (comm->src_proc == simcall->issuer)
+ if (comm->src_actor_ == simcall->issuer)
comm->state_ = SIMIX_SRC_TIMEOUT;
else
comm->state_ = SIMIX_DST_TIMEOUT;
simgrid::kernel::activity::CommImplPtr comm =
boost::static_pointer_cast<simgrid::kernel::activity::CommImpl>(synchro);
- if (simcall->issuer == comm->src_proc)
- comm->src_timeout = sleep;
+ if (simcall->issuer == comm->src_actor_)
+ comm->src_timeout_ = sleep;
else
- comm->dst_timeout = sleep;
+ comm->dst_timeout_ = sleep;
}
}
int res;
if (MC_is_active() || MC_record_replay_is_active()){
- res = comm->src_proc && comm->dst_proc;
+ res = comm->src_actor_ && comm->dst_actor_;
if (res)
synchro->state_ = SIMIX_DONE;
} else {
/* If both the sender and the receiver are already there, start the communication */
if (comm->state_ == SIMIX_READY) {
- simgrid::s4u::Host* sender = comm->src_proc->host_;
- simgrid::s4u::Host* receiver = comm->dst_proc->host_;
+ simgrid::s4u::Host* sender = comm->src_actor_->host_;
+ simgrid::s4u::Host* receiver = comm->dst_actor_->host_;
- comm->surfAction_ = surf_network_model->communicate(sender, receiver, comm->task_size, comm->rate);
- comm->surfAction_->set_data(comm.get());
+ comm->surf_action_ = surf_network_model->communicate(sender, receiver, comm->task_size_, comm->rate_);
+ comm->surf_action_->set_data(comm.get());
comm->state_ = SIMIX_RUNNING;
XBT_DEBUG("Starting communication %p from '%s' to '%s' (surf_action: %p)", comm.get(), sender->get_cname(),
- receiver->get_cname(), comm->surfAction_);
+ receiver->get_cname(), comm->surf_action_);
/* If a link is failed, detect it immediately */
- if (comm->surfAction_->get_state() == simgrid::kernel::resource::Action::State::FAILED) {
+ if (comm->surf_action_->get_state() == simgrid::kernel::resource::Action::State::FAILED) {
XBT_DEBUG("Communication from '%s' to '%s' failed to start because of a link failure", sender->get_cname(),
receiver->get_cname());
comm->state_ = SIMIX_LINK_FAILURE;
/* If any of the process is suspended, create the synchro but stop its execution,
it will be restarted when the sender process resume */
- if (comm->src_proc->is_suspended() || comm->dst_proc->is_suspended()) {
- if (comm->src_proc->is_suspended())
+ if (comm->src_actor_->is_suspended() || comm->dst_actor_->is_suspended()) {
+ if (comm->src_actor_->is_suspended())
XBT_DEBUG("The communication is suspended on startup because src (%s@%s) was suspended since it initiated the "
"communication",
- comm->src_proc->get_cname(), comm->src_proc->host_->get_cname());
+ comm->src_actor_->get_cname(), comm->src_actor_->host_->get_cname());
else
XBT_DEBUG("The communication is suspended on startup because dst (%s@%s) was suspended since it initiated the "
"communication",
- comm->dst_proc->get_cname(), comm->dst_proc->host_->get_cname());
+ comm->dst_actor_->get_cname(), comm->dst_actor_->host_->get_cname());
- comm->surfAction_->suspend();
+ comm->surf_action_->suspend();
}
}
}
break;
case SIMIX_SRC_HOST_FAILURE:
- if (simcall->issuer == comm->src_proc)
+ if (simcall->issuer == comm->src_actor_)
simcall->issuer->context_->iwannadie = true;
else
simcall->issuer->exception =
break;
case SIMIX_DST_HOST_FAILURE:
- if (simcall->issuer == comm->dst_proc)
+ if (simcall->issuer == comm->dst_actor_)
simcall->issuer->context_->iwannadie = true;
else
simcall->issuer->exception =
case SIMIX_LINK_FAILURE:
XBT_DEBUG("Link failure in synchro %p between '%s' and '%s': posting an exception to the issuer: %s (%p) "
"detached:%d",
- synchro.get(), comm->src_proc ? comm->src_proc->host_->get_cname() : nullptr,
- comm->dst_proc ? comm->dst_proc->host_->get_cname() : nullptr, simcall->issuer->get_cname(),
+ synchro.get(), comm->src_actor_ ? comm->src_actor_->host_->get_cname() : nullptr,
+ comm->dst_actor_ ? comm->dst_actor_->host_->get_cname() : nullptr, simcall->issuer->get_cname(),
simcall->issuer, comm->detached);
- if (comm->src_proc == simcall->issuer) {
+ if (comm->src_actor_ == simcall->issuer) {
XBT_DEBUG("I'm source");
- } else if (comm->dst_proc == simcall->issuer) {
+ } else if (comm->dst_actor_ == simcall->issuer) {
XBT_DEBUG("I'm dest");
} else {
XBT_DEBUG("I'm neither source nor dest");
break;
case SIMIX_CANCELED:
- if (simcall->issuer == comm->dst_proc)
+ if (simcall->issuer == comm->dst_actor_)
SMX_EXCEPTION(simcall->issuer, cancel_error, 0, "Communication canceled by the sender");
else
SMX_EXCEPTION(simcall->issuer, cancel_error, 0, "Communication canceled by the receiver");
simcall->issuer->waiting_synchro = nullptr;
simcall->issuer->comms.remove(synchro);
if(comm->detached){
- if(simcall->issuer == comm->src_proc){
- if(comm->dst_proc)
- comm->dst_proc->comms.remove(synchro);
- }
- else if(simcall->issuer == comm->dst_proc){
- if(comm->src_proc)
- comm->src_proc->comms.remove(synchro);
+ if (simcall->issuer == comm->src_actor_) {
+ if (comm->dst_actor_)
+ comm->dst_actor_->comms.remove(synchro);
+ } else if (simcall->issuer == comm->dst_actor_) {
+ if (comm->src_actor_)
+ comm->src_actor_->comms.remove(synchro);
}
else{
- comm->dst_proc->comms.remove(synchro);
- comm->src_proc->comms.remove(synchro);
+ comm->dst_actor_->comms.remove(synchro);
+ comm->src_actor_->comms.remove(synchro);
}
}
boost::static_pointer_cast<simgrid::kernel::activity::CommImpl>(synchro);
xbt_assert((buff_size == sizeof(void *)), "Cannot copy %zu bytes: must be sizeof(void*)", buff_size);
- *(void **) (comm->dst_buff) = buff;
+ *(void**)(comm->dst_buff_) = buff;
}
void SIMIX_comm_copy_buffer_callback(smx_activity_t synchro, void* buff, size_t buff_size)
boost::static_pointer_cast<simgrid::kernel::activity::CommImpl>(synchro);
XBT_DEBUG("Copy the data over");
- memcpy(comm->dst_buff, buff, buff_size);
+ memcpy(comm->dst_buff_, buff, buff_size);
if (comm->detached) { // if this is a detached send, the source buffer was duplicated by SMPI sender to make the original buffer available to the application ASAP
xbt_free(buff);
- comm->src_buff = nullptr;
+ comm->src_buff_ = nullptr;
}
}
simgrid::kernel::activity::CommImplPtr comm =
boost::static_pointer_cast<simgrid::kernel::activity::CommImpl>(synchro);
- size_t buff_size = comm->src_buff_size;
+ size_t buff_size = comm->src_buff_size_;
/* If there is no data to copy then return */
- if (not comm->src_buff || not comm->dst_buff || comm->copied)
+ if (not comm->src_buff_ || not comm->dst_buff_ || comm->copied)
return;
XBT_DEBUG("Copying comm %p data from %s (%p) -> %s (%p) (%zu bytes)", comm.get(),
- comm->src_proc ? comm->src_proc->host_->get_cname() : "a finished process", comm->src_buff,
- comm->dst_proc ? comm->dst_proc->host_->get_cname() : "a finished process", comm->dst_buff, buff_size);
+ comm->src_actor_ ? comm->src_actor_->host_->get_cname() : "a finished process", comm->src_buff_,
+ comm->dst_actor_ ? comm->dst_actor_->host_->get_cname() : "a finished process", comm->dst_buff_, buff_size);
/* Copy at most dst_buff_size bytes of the message to receiver's buffer */
- if (comm->dst_buff_size)
- buff_size = std::min(buff_size, *(comm->dst_buff_size));
+ if (comm->dst_buff_size_)
+ buff_size = std::min(buff_size, *(comm->dst_buff_size_));
/* Update the receiver's buffer size to the copied amount */
- if (comm->dst_buff_size)
- *comm->dst_buff_size = buff_size;
+ if (comm->dst_buff_size_)
+ *comm->dst_buff_size_ = buff_size;
if (buff_size > 0){
if(comm->copy_data_fun)
- comm->copy_data_fun (comm, comm->src_buff, buff_size);
+ comm->copy_data_fun(comm, comm->src_buff_, buff_size);
else
- SIMIX_comm_copy_data_callback (comm, comm->src_buff, buff_size);
+ SIMIX_comm_copy_data_callback(comm, comm->src_buff_, buff_size);
}
/* Set the copied flag so we copy data only once */
src_private_blocks.clear();
src_private_blocks.push_back(std::make_pair(0, buff_size));
}
- if((dst_shared=smpi_is_shared((char*)comm->dst_buff, dst_private_blocks, &dst_offset))) {
- XBT_DEBUG("Receiver %p is shared. Let's ignore it.", (char*)comm->dst_buff);
+ if ((dst_shared = smpi_is_shared((char*)comm->dst_buff_, dst_private_blocks, &dst_offset))) {
+ XBT_DEBUG("Receiver %p is shared. Let's ignore it.", (char*)comm->dst_buff_);
dst_private_blocks = shift_and_frame_private_blocks(dst_private_blocks, dst_offset, buff_size);
}
else {
(static_cast<char*>(buff) >= smpi_data_exe_start) &&
(static_cast<char*>(buff) < smpi_data_exe_start + smpi_data_exe_size)) {
XBT_DEBUG("Privatization : We are copying from a zone inside global memory... Saving data to temp buffer !");
- smpi_switch_data_segment(comm->src_proc->iface());
+ smpi_switch_data_segment(comm->src_actor_->iface());
tmpbuff = static_cast<void*>(xbt_malloc(buff_size));
memcpy_private(tmpbuff, buff, private_blocks);
}
- if ((smpi_privatize_global_variables == SmpiPrivStrategies::MMAP) && ((char*)comm->dst_buff >= smpi_data_exe_start) &&
- ((char*)comm->dst_buff < smpi_data_exe_start + smpi_data_exe_size)) {
+ if ((smpi_privatize_global_variables == SmpiPrivStrategies::MMAP) &&
+ ((char*)comm->dst_buff_ >= smpi_data_exe_start) &&
+ ((char*)comm->dst_buff_ < smpi_data_exe_start + smpi_data_exe_size)) {
XBT_DEBUG("Privatization : We are copying to a zone inside global memory - Switch data segment");
- smpi_switch_data_segment(comm->dst_proc->iface());
+ smpi_switch_data_segment(comm->dst_actor_->iface());
}
- XBT_DEBUG("Copying %zu bytes from %p to %p", buff_size, tmpbuff,comm->dst_buff);
- memcpy_private(comm->dst_buff, tmpbuff, private_blocks);
+ XBT_DEBUG("Copying %zu bytes from %p to %p", buff_size, tmpbuff, comm->dst_buff_);
+ memcpy_private(comm->dst_buff_, tmpbuff, private_blocks);
if (comm->detached) {
// if this is a detached send, the source buffer was duplicated by SMPI
xbt_free(buff);
//It seems that the request is used after the call there this should be free somewhere else but where???
//xbt_free(comm->comm.src_data);// inside SMPI the request is kept inside the user data and should be free
- comm->src_buff = nullptr;
+ comm->src_buff_ = nullptr;
}
if (tmpbuff != buff)
xbt_free(tmpbuff);
}
if (request->action_ != nullptr){
- simgrid::kernel::activity::CommImplPtr sync_comm =
- boost::static_pointer_cast<simgrid::kernel::activity::CommImpl>(request->action_);
- MPI_Request req = static_cast<MPI_Request>(sync_comm->src_data);
+ kernel::activity::CommImplPtr sync_comm = boost::static_pointer_cast<kernel::activity::CommImpl>(request->action_);
+ MPI_Request req = static_cast<MPI_Request>(sync_comm->src_data_);
*flag = 1;
if (status != MPI_STATUS_IGNORE && (req->flags_ & MPI_REQ_PREPARED) == 0) {
status->MPI_SOURCE = comm->group()->rank(req->src_);