std::string tracing_category_ = "";
std::atomic_int_fast32_t refcount_{0};
/* FIXME: expose these elements in the API */
- int detached_ = 0;
+ bool detached_ = false;
int (*match_fun_)(void*, void*, kernel::activity::CommImpl*) = nullptr;
void (*clean_fun_)(void*) = nullptr;
void (*copy_data_function_)(kernel::activity::CommImpl*, void*, size_t) = nullptr;
int (*match_fun)(void*, void*, simgrid::kernel::activity::CommImpl*),
void (*clean_fun)(void*),
void (*copy_data_fun)(simgrid::kernel::activity::CommImpl*, void*, size_t),
- void* data, int detached);
+ void* data, bool detached);
XBT_PUBLIC void simcall_comm_recv(smx_actor_t receiver, smx_mailbox_t mbox, void* dst_buff, size_t* dst_buff_size,
int (*match_fun)(void*, void*, simgrid::kernel::activity::CommImpl*),
size_t src_buff_size, int (*match_fun)(void*, void*, simgrid::kernel::activity::CommImpl*),
void (*clean_fun)(void*), // used to free the synchro in case of problem after a detached send
void (*copy_data_fun)(simgrid::kernel::activity::CommImpl*, void*, size_t), // used to copy data if not default one
- void* data, int detached)
+ void* data, bool detached)
{
XBT_DEBUG("send from mailbox %p", mbox);
}
if (detached) {
- other_comm->detached = true;
+ other_comm->detached_ = true;
other_comm->clean_fun = clean_fun;
} else {
other_comm->clean_fun = nullptr;
{
XBT_DEBUG("Copy the data over");
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
+ 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;
CommImpl::~CommImpl()
{
- XBT_DEBUG("Really free communication %p in state %d (detached = %d)", this, static_cast<int>(state_),
- static_cast<int>(detached));
+ XBT_DEBUG("Really free communication %p in state %d (detached = %d)", this, static_cast<int>(state_), detached_);
cleanupSurf();
- if (detached && state_ != SIMIX_DONE) {
+ if (detached_ && state_ != SIMIX_DONE) {
/* the communication has failed and was detached:
* we have to free the buffer */
if (clean_fun)
{
/* if the synchro is a waiting state means that it is still in a mbox so remove from it and delete it */
if (state_ == SIMIX_WAITING) {
- if (not detached) {
+ if (not detached_) {
mbox->remove(this);
state_ = SIMIX_CANCELED;
}
state_ = SIMIX_DONE;
XBT_DEBUG("SIMIX_post_comm: comm %p, state %d, src_proc %p, dst_proc %p, detached: %d", this, (int)state_,
- src_actor_.get(), dst_actor_.get(), detached);
+ src_actor_.get(), dst_actor_.get(), detached_);
/* destroy the surf actions associated with the Simix communication */
cleanupSurf();
"detached:%d",
this, src_actor_ ? src_actor_->get_host()->get_cname() : nullptr,
dst_actor_ ? dst_actor_->get_host()->get_cname() : nullptr, simcall->issuer->get_cname(),
- simcall->issuer, detached);
+ simcall->issuer, detached_);
if (src_actor_ == simcall->issuer) {
XBT_DEBUG("I'm source");
} else if (dst_actor_ == simcall->issuer) {
simcall->issuer->waiting_synchro = nullptr;
simcall->issuer->comms.remove(this);
- if (detached) {
+ if (detached_) {
if (simcall->issuer == src_actor_) {
if (dst_actor_)
dst_actor_->comms.remove(this);
(comm.mbox set to nullptr when the communication is removed from the mailbox
(used as garbage collector)) */
#endif
- bool detached = false; /* If detached or not */
+ bool detached_ = false; /* If detached or not */
void (*clean_fun)(void*) = nullptr; /* Function to clean the detached src_buf if something goes wrong */
int (*match_fun)(void*, void*, CommImpl*) = nullptr; /* Filter function used by the other side. It is used when
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 &&
+ else if (act->detached_ && act->src_actor_ == nullptr &&
act->type_ == simgrid::kernel::activity::CommImpl::Type::READY)
return (act->dst_actor_ != nullptr);
return (act->src_actor_ && act->dst_actor_);
if (act->src_actor_.get() && act->dst_actor_.get())
state->transition.argument = 0;
else if (act->src_actor_.get() == nullptr && act->type_ == simgrid::kernel::activity::CommImpl::Type::READY &&
- act->detached == 1)
+ act->detached_)
state->transition.argument = 0;
else
state->transition.argument = -1;
int (*match_fun)(void*, void*, simgrid::kernel::activity::CommImpl*),
void (*clean_fun)(void*),
void (*copy_data_fun)(simgrid::kernel::activity::CommImpl*, void*, size_t),
- void* data, int detached)
+ void* data, bool detached)
{
/* checking for infinite values */
xbt_assert(std::isfinite(task_size), "task_size is not finite!");
{
return simgrid::simix::unmarshal_raw<simgrid::kernel::activity::ExecImpl*>(simcall->args[0]);
}
-static inline void simcall_execution_wait__set__execution(smx_simcall_t simcall,
- simgrid::kernel::activity::ExecImpl* arg)
+static inline void simcall_execution_wait__set__execution(smx_simcall_t simcall, simgrid::kernel::activity::ExecImpl* arg)
{
simgrid::simix::marshal<simgrid::kernel::activity::ExecImpl*>(simcall->args[0], arg);
}
{
return simgrid::simix::unmarshal_raw<simgrid::kernel::activity::ExecImpl*>(simcall->args[0]);
}
-static inline void simcall_execution_test__set__execution(smx_simcall_t simcall,
- simgrid::kernel::activity::ExecImpl* arg)
+static inline void simcall_execution_test__set__execution(smx_simcall_t simcall, simgrid::kernel::activity::ExecImpl* arg)
{
simgrid::simix::marshal<simgrid::kernel::activity::ExecImpl*>(simcall->args[0], arg);
}
{
simgrid::simix::marshal<void*>(simcall->args[9], arg);
}
-static inline int simcall_comm_isend__get__detached(smx_simcall_t simcall)
+static inline bool simcall_comm_isend__get__detached(smx_simcall_t simcall)
{
- return simgrid::simix::unmarshal<int>(simcall->args[10]);
+ return simgrid::simix::unmarshal<bool>(simcall->args[10]);
}
-static inline int simcall_comm_isend__getraw__detached(smx_simcall_t simcall)
+static inline bool simcall_comm_isend__getraw__detached(smx_simcall_t simcall)
{
- return simgrid::simix::unmarshal_raw<int>(simcall->args[10]);
+ return simgrid::simix::unmarshal_raw<bool>(simcall->args[10]);
}
-static inline void simcall_comm_isend__set__detached(smx_simcall_t simcall, int arg)
+static inline void simcall_comm_isend__set__detached(smx_simcall_t simcall, bool arg)
{
- simgrid::simix::marshal<int>(simcall->args[10], arg);
+ simgrid::simix::marshal<bool>(simcall->args[10], arg);
}
static inline boost::intrusive_ptr<simgrid::kernel::activity::ActivityImpl> simcall_comm_isend__get__result(smx_simcall_t simcall)
{
XBT_PRIVATE void simcall_HANDLER_execution_wait(smx_simcall_t simcall, simgrid::kernel::activity::ExecImpl* execution);
XBT_PRIVATE void simcall_HANDLER_execution_test(smx_simcall_t simcall, simgrid::kernel::activity::ExecImpl* execution);
XBT_PRIVATE void simcall_HANDLER_comm_send(smx_simcall_t simcall, smx_actor_t sender, smx_mailbox_t mbox, double task_size, double rate, void* src_buff, size_t src_buff_size, simix_match_func_t match_fun, simix_copy_data_func_t copy_data_fun, void* data, double timeout);
-XBT_PRIVATE boost::intrusive_ptr<simgrid::kernel::activity::ActivityImpl> simcall_HANDLER_comm_isend(smx_simcall_t simcall, smx_actor_t sender, smx_mailbox_t mbox, double task_size, double rate, void* src_buff, size_t src_buff_size, simix_match_func_t match_fun, simix_clean_func_t clean_fun, simix_copy_data_func_t copy_data_fun, void* data, int detached);
+XBT_PRIVATE boost::intrusive_ptr<simgrid::kernel::activity::ActivityImpl> simcall_HANDLER_comm_isend(smx_simcall_t simcall, smx_actor_t sender, smx_mailbox_t mbox, double task_size, double rate, void* src_buff, size_t src_buff_size, simix_match_func_t match_fun, simix_clean_func_t clean_fun, simix_copy_data_func_t copy_data_fun, void* data, bool detached);
XBT_PRIVATE void simcall_HANDLER_comm_recv(smx_simcall_t simcall, smx_actor_t receiver, smx_mailbox_t mbox, void* dst_buff, size_t* dst_buff_size, simix_match_func_t match_fun, simix_copy_data_func_t copy_data_fun, void* data, double timeout, double rate);
XBT_PRIVATE boost::intrusive_ptr<simgrid::kernel::activity::ActivityImpl> simcall_HANDLER_comm_irecv(smx_simcall_t simcall, smx_actor_t receiver, smx_mailbox_t mbox, void* dst_buff, size_t* dst_buff_size, simix_match_func_t match_fun, simix_copy_data_func_t copy_data_fun, void* data, double rate);
-XBT_PRIVATE void simcall_HANDLER_comm_waitany(smx_simcall_t simcall, simgrid::kernel::activity::CommImpl** comms,
- size_t count, double timeout);
-XBT_PRIVATE void simcall_HANDLER_comm_wait(smx_simcall_t simcall, simgrid::kernel::activity::CommImpl* comm,
- double timeout);
+XBT_PRIVATE void simcall_HANDLER_comm_waitany(smx_simcall_t simcall, simgrid::kernel::activity::CommImpl** comms, size_t count, double timeout);
+XBT_PRIVATE void simcall_HANDLER_comm_wait(smx_simcall_t simcall, simgrid::kernel::activity::CommImpl* comm, double timeout);
XBT_PRIVATE void simcall_HANDLER_comm_test(smx_simcall_t simcall, simgrid::kernel::activity::CommImpl* comm);
-XBT_PRIVATE void simcall_HANDLER_comm_testany(smx_simcall_t simcall, simgrid::kernel::activity::CommImpl** comms,
- size_t count);
+XBT_PRIVATE void simcall_HANDLER_comm_testany(smx_simcall_t simcall, simgrid::kernel::activity::CommImpl** comms, size_t count);
XBT_PRIVATE void simcall_HANDLER_mutex_lock(smx_simcall_t simcall, smx_mutex_t mutex);
XBT_PRIVATE int simcall_HANDLER_mutex_trylock(smx_simcall_t simcall, smx_mutex_t mutex);
XBT_PRIVATE void simcall_HANDLER_mutex_unlock(smx_simcall_t simcall, smx_mutex_t mutex);
return simcall<void, smx_actor_t, smx_mailbox_t, double, double, void*, size_t, simix_match_func_t, simix_copy_data_func_t, void*, double>(SIMCALL_COMM_SEND, sender, mbox, task_size, rate, src_buff, src_buff_size, match_fun, copy_data_fun, data, timeout);
}
-inline static boost::intrusive_ptr<simgrid::kernel::activity::ActivityImpl> simcall_BODY_comm_isend(smx_actor_t sender, smx_mailbox_t mbox, double task_size, double rate, void* src_buff, size_t src_buff_size, simix_match_func_t match_fun, simix_clean_func_t clean_fun, simix_copy_data_func_t copy_data_fun, void* data, int detached)
+inline static boost::intrusive_ptr<simgrid::kernel::activity::ActivityImpl> simcall_BODY_comm_isend(smx_actor_t sender, smx_mailbox_t mbox, double task_size, double rate, void* src_buff, size_t src_buff_size, simix_match_func_t match_fun, simix_clean_func_t clean_fun, simix_copy_data_func_t copy_data_fun, void* data, bool detached)
{
if (0) /* Go to that function to follow the code flow through the simcall barrier */
simcall_HANDLER_comm_isend(&SIMIX_process_self()->simcall, sender, mbox, task_size, rate, src_buff, src_buff_size, match_fun, clean_fun, copy_data_fun, data, detached);
- return simcall<boost::intrusive_ptr<simgrid::kernel::activity::ActivityImpl>, smx_actor_t, smx_mailbox_t, double, double, void*, size_t, simix_match_func_t, simix_clean_func_t, simix_copy_data_func_t, void*, int>(SIMCALL_COMM_ISEND, sender, mbox, task_size, rate, src_buff, src_buff_size, match_fun, clean_fun, copy_data_fun, data, detached);
+ return simcall<boost::intrusive_ptr<simgrid::kernel::activity::ActivityImpl>, smx_actor_t, smx_mailbox_t, double, double, void*, size_t, simix_match_func_t, simix_clean_func_t, simix_copy_data_func_t, void*, bool>(SIMCALL_COMM_ISEND, sender, mbox, task_size, rate, src_buff, src_buff_size, match_fun, clean_fun, copy_data_fun, data, detached);
}
inline static void simcall_BODY_comm_recv(smx_actor_t receiver, smx_mailbox_t mbox, void* dst_buff, size_t* dst_buff_size, simix_match_func_t match_fun, simix_copy_data_func_t copy_data_fun, void* data, double timeout, double rate)
{
if (0) /* Go to that function to follow the code flow through the simcall barrier */
simcall_HANDLER_comm_waitany(&SIMIX_process_self()->simcall, comms, count, timeout);
- return simcall<int, simgrid::kernel::activity::CommImpl**, size_t, double>(SIMCALL_COMM_WAITANY, comms, count,
- timeout);
+ return simcall<int, simgrid::kernel::activity::CommImpl**, size_t, double>(SIMCALL_COMM_WAITANY, comms, count, timeout);
}
inline static void simcall_BODY_comm_wait(simgrid::kernel::activity::CommImpl* comm, double timeout)
break;
case SIMCALL_EXECUTION_WAIT:
- simcall_HANDLER_execution_wait(simcall,
- simgrid::simix::unmarshal<simgrid::kernel::activity::ExecImpl*>(simcall->args[0]));
+ simcall_HANDLER_execution_wait(simcall, simgrid::simix::unmarshal<simgrid::kernel::activity::ExecImpl*>(simcall->args[0]));
break;
case SIMCALL_EXECUTION_TEST:
- simcall_HANDLER_execution_test(simcall,
- simgrid::simix::unmarshal<simgrid::kernel::activity::ExecImpl*>(simcall->args[0]));
+ simcall_HANDLER_execution_test(simcall, simgrid::simix::unmarshal<simgrid::kernel::activity::ExecImpl*>(simcall->args[0]));
break;
case SIMCALL_COMM_SEND:
break;
case SIMCALL_COMM_ISEND:
- simgrid::simix::marshal<boost::intrusive_ptr<simgrid::kernel::activity::ActivityImpl>>(simcall->result, simcall_HANDLER_comm_isend(simcall, simgrid::simix::unmarshal<smx_actor_t>(simcall->args[0]), simgrid::simix::unmarshal<smx_mailbox_t>(simcall->args[1]), simgrid::simix::unmarshal<double>(simcall->args[2]), simgrid::simix::unmarshal<double>(simcall->args[3]), simgrid::simix::unmarshal<void*>(simcall->args[4]), simgrid::simix::unmarshal<size_t>(simcall->args[5]), simgrid::simix::unmarshal<simix_match_func_t>(simcall->args[6]), simgrid::simix::unmarshal<simix_clean_func_t>(simcall->args[7]), simgrid::simix::unmarshal<simix_copy_data_func_t>(simcall->args[8]), simgrid::simix::unmarshal<void*>(simcall->args[9]), simgrid::simix::unmarshal<int>(simcall->args[10])));
+ simgrid::simix::marshal<boost::intrusive_ptr<simgrid::kernel::activity::ActivityImpl>>(simcall->result, simcall_HANDLER_comm_isend(simcall, simgrid::simix::unmarshal<smx_actor_t>(simcall->args[0]), simgrid::simix::unmarshal<smx_mailbox_t>(simcall->args[1]), simgrid::simix::unmarshal<double>(simcall->args[2]), simgrid::simix::unmarshal<double>(simcall->args[3]), simgrid::simix::unmarshal<void*>(simcall->args[4]), simgrid::simix::unmarshal<size_t>(simcall->args[5]), simgrid::simix::unmarshal<simix_match_func_t>(simcall->args[6]), simgrid::simix::unmarshal<simix_clean_func_t>(simcall->args[7]), simgrid::simix::unmarshal<simix_copy_data_func_t>(simcall->args[8]), simgrid::simix::unmarshal<void*>(simcall->args[9]), simgrid::simix::unmarshal<bool>(simcall->args[10])));
SIMIX_simcall_answer(simcall);
break;
break;
case SIMCALL_COMM_WAITANY:
- simcall_HANDLER_comm_waitany(
- simcall, simgrid::simix::unmarshal<simgrid::kernel::activity::CommImpl**>(simcall->args[0]),
- simgrid::simix::unmarshal<size_t>(simcall->args[1]), simgrid::simix::unmarshal<double>(simcall->args[2]));
+ simcall_HANDLER_comm_waitany(simcall, simgrid::simix::unmarshal<simgrid::kernel::activity::CommImpl**>(simcall->args[0]), simgrid::simix::unmarshal<size_t>(simcall->args[1]), simgrid::simix::unmarshal<double>(simcall->args[2]));
break;
case SIMCALL_COMM_WAIT:
- simcall_HANDLER_comm_wait(simcall, simgrid::simix::unmarshal<simgrid::kernel::activity::CommImpl*>(simcall->args[0]),
- simgrid::simix::unmarshal<double>(simcall->args[1]));
+ simcall_HANDLER_comm_wait(simcall, simgrid::simix::unmarshal<simgrid::kernel::activity::CommImpl*>(simcall->args[0]), simgrid::simix::unmarshal<double>(simcall->args[1]));
break;
case SIMCALL_COMM_TEST:
break;
case SIMCALL_COMM_TESTANY:
- simcall_HANDLER_comm_testany(simcall,
- simgrid::simix::unmarshal<simgrid::kernel::activity::CommImpl**>(simcall->args[0]),
- simgrid::simix::unmarshal<size_t>(simcall->args[1]));
+ simcall_HANDLER_comm_testany(simcall, simgrid::simix::unmarshal<simgrid::kernel::activity::CommImpl**>(simcall->args[0]), simgrid::simix::unmarshal<size_t>(simcall->args[1]));
break;
case SIMCALL_MUTEX_LOCK:
int execution_test(simgrid::kernel::activity::ExecImpl* execution) [[block]];
void comm_send(smx_actor_t sender, smx_mailbox_t mbox, double task_size, double rate, void* src_buff, size_t src_buff_size, simix_match_func_t match_fun, simix_copy_data_func_t copy_data_fun, void* data, double timeout) [[block]];
-boost::intrusive_ptr<simgrid::kernel::activity::ActivityImpl> comm_isend(smx_actor_t sender, smx_mailbox_t mbox, double task_size, double rate, void* src_buff, size_t src_buff_size, simix_match_func_t match_fun, simix_clean_func_t clean_fun, simix_copy_data_func_t copy_data_fun, void* data, int detached);
+boost::intrusive_ptr<simgrid::kernel::activity::ActivityImpl> comm_isend(smx_actor_t sender, smx_mailbox_t mbox, double task_size, double rate, void* src_buff, size_t src_buff_size, simix_match_func_t match_fun, simix_clean_func_t clean_fun, simix_copy_data_func_t copy_data_fun, void* data, bool detached);
void comm_recv(smx_actor_t receiver, smx_mailbox_t mbox, void* dst_buff, size_t* dst_buff_size, simix_match_func_t match_fun, simix_copy_data_func_t copy_data_fun, void* data, double timeout, double rate) [[block]];
boost::intrusive_ptr<simgrid::kernel::activity::ActivityImpl> comm_irecv(smx_actor_t receiver, smx_mailbox_t mbox, void* dst_buff, size_t* dst_buff_size, simix_match_func_t match_fun, simix_copy_data_func_t copy_data_fun, void* data, double rate);
int comm_waitany(simgrid::kernel::activity::CommImpl** comms, size_t count, double timeout) [[block]];
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 (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);