From: Martin Quinson Date: Sun, 27 Jan 2019 09:03:25 +0000 (+0100) Subject: activity::CommImpl: stick to our naming standards for the fields X-Git-Tag: v3_22~467 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/4e73c03c087fd07184d9ed45224f7fbad24e686e activity::CommImpl: stick to our naming standards for the fields --- diff --git a/src/kernel/activity/CommImpl.cpp b/src/kernel/activity/CommImpl.cpp index b2a0f01e64..32c918e6ab 100644 --- a/src/kernel/activity/CommImpl.cpp +++ b/src/kernel/activity/CommImpl.cpp @@ -16,8 +16,8 @@ XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(simix_network); 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); } @@ -31,8 +31,8 @@ simgrid::kernel::activity::CommImpl::~CommImpl() /* 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) @@ -42,16 +42,16 @@ simgrid::kernel::activity::CommImpl::~CommImpl() 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() */ } @@ -65,53 +65,53 @@ void simgrid::kernel::activity::CommImpl::cancel() } 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(); diff --git a/src/kernel/activity/CommImpl.hpp b/src/kernel/activity/CommImpl.hpp index e4eded95b1..55828307c9 100644 --- a/src/kernel/activity/CommImpl.hpp +++ b/src/kernel/activity/CommImpl.hpp @@ -46,23 +46,23 @@ expectations of the other side, too. See */ 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; }; } } diff --git a/src/mc/checker/CommunicationDeterminismChecker.cpp b/src/mc/checker/CommunicationDeterminismChecker.cpp index b9c015e6e6..e40236d855 100644 --- a/src/mc/checker/CommunicationDeterminismChecker.cpp +++ b/src/mc/checker/CommunicationDeterminismChecker.cpp @@ -100,18 +100,18 @@ static void update_comm_pattern(simgrid::mc::PatternCommunication* comm_pattern, 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_)); } } @@ -193,7 +193,7 @@ void CommunicationDeterminismChecker::get_comm_pattern(xbt_dynar_t list, smx_sim char* remote_name = mc_model_checker->process().read( RemotePtr((uint64_t)(synchro->mbox ? &synchro->mbox->name_ : &synchro->mbox_cpy->name_))); pattern->rdv = mc_model_checker->process().read_string(RemotePtr(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 @@ -202,9 +202,9 @@ void CommunicationDeterminismChecker::get_comm_pattern(xbt_dynar_t list, smx_sim 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()){ @@ -243,7 +243,7 @@ void CommunicationDeterminismChecker::get_comm_pattern(xbt_dynar_t list, smx_sim &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(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); diff --git a/src/mc/mc_base.cpp b/src/mc/mc_base.cpp index 787326d566..27ad062792 100644 --- a/src/mc/mc_base.cpp +++ b/src/mc/mc_base.cpp @@ -88,23 +88,23 @@ bool actor_is_enabled(smx_actor_t actor) simgrid::kernel::activity::CommImpl* act = static_cast(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; diff --git a/src/mc/mc_request.cpp b/src/mc/mc_request.cpp index 813b2305ce..d1d1409347 100644 --- a/src/mc/mc_request.cpp +++ b/src/mc/mc_request.cpp @@ -71,22 +71,16 @@ bool request_depend_asymmetric(smx_simcall_t r1, smx_simcall_t r2) && 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; } @@ -99,30 +93,22 @@ bool request_depend_asymmetric(smx_simcall_t r1, smx_simcall_t r2) 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; @@ -157,12 +143,11 @@ bool request_depend(smx_simcall_t r1, smx_simcall_t r2) 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: @@ -271,8 +256,8 @@ std::string simgrid::mc::request_to_string(smx_simcall_t req, int value, simgrid } 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) : "", @@ -296,7 +281,7 @@ std::string simgrid::mc::request_to_string(smx_simcall_t req, int value, simgrid 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); @@ -304,8 +289,8 @@ std::string simgrid::mc::request_to_string(smx_simcall_t req, int value, simgrid 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)); @@ -418,7 +403,7 @@ bool request_is_enabled_by_idx(smx_simcall_t req, unsigned int idx) simgrid::mc::Remote temp_comm; mc_model_checker->process().read(temp_comm, remote(static_cast(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(); } @@ -477,8 +462,8 @@ std::string request_get_dot_output(smx_simcall_t req, int value) remote(static_cast(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, @@ -494,7 +479,7 @@ std::string request_get_dot_output(smx_simcall_t req, int value) simgrid::mc::Remote temp_comm; mc_model_checker->process().read(temp_comm, remote(static_cast(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 diff --git a/src/mc/mc_state.cpp b/src/mc/mc_state.cpp index 179f32d0e9..f18e7ea017 100644 --- a/src/mc/mc_state.cpp +++ b/src/mc/mc_state.cpp @@ -115,9 +115,9 @@ static inline smx_simcall_t MC_state_get_request_for_process(simgrid::mc::State* simgrid::mc::Remote 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; diff --git a/src/msg/msg_gos.cpp b/src/msg/msg_gos.cpp index 81ae5ad2c9..422ba8d58a 100644 --- a/src/msg/msg_gos.cpp +++ b/src/msg/msg_gos.cpp @@ -682,7 +682,7 @@ void MSG_comm_copy_data_from_SIMIX(smx_activity_t synchro, void* buff, size_t bu // notify the user callback if any if (msg_global->task_copy_callback) { msg_task_t task = static_cast(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()); } } @@ -833,7 +833,7 @@ int MSG_task_listen_from(const char *alias) if (not comm) return -1; - return MSG_process_get_PID(static_cast(comm->src_buff)->simdata->sender); + return MSG_process_get_PID(static_cast(comm->src_buff_)->simdata->sender); } /** diff --git a/src/simix/smx_host.cpp b/src/simix/smx_host.cpp index de72646319..7196bdc390 100644 --- a/src/simix/smx_host.cpp +++ b/src/simix/smx_host.cpp @@ -169,6 +169,6 @@ void SIMIX_set_category(smx_activity_t synchro, std::string category) simgrid::kernel::activity::CommImplPtr comm = boost::dynamic_pointer_cast(synchro); if (comm != nullptr) { - comm->surfAction_->set_category(category); + comm->surf_action_->set_category(category); } } diff --git a/src/simix/smx_network.cpp b/src/simix/smx_network.cpp index 1d8f5fcedf..e3cc2047d2 100644 --- a/src/simix/smx_network.cpp +++ b/src/simix/smx_network.cpp @@ -43,9 +43,9 @@ _find_matching_comm(boost::circular_buffer_space_optimized* dequ boost::dynamic_pointer_cast(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()))) { @@ -107,7 +107,7 @@ XBT_PRIVATE smx_activity_t simcall_HANDLER_comm_isend( 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()); @@ -130,12 +130,12 @@ XBT_PRIVATE smx_activity_t simcall_HANDLER_comm_isend( } /* 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; @@ -194,7 +194,7 @@ SIMIX_comm_irecv(smx_actor_t dst_proc, smx_mailbox_t mbox, void* dst_buff, size_ 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; @@ -225,13 +225,13 @@ SIMIX_comm_irecv(smx_actor_t dst_proc, smx_mailbox_t mbox, void* dst_buff, size_ } /* 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; @@ -299,7 +299,7 @@ void simcall_HANDLER_comm_wait(smx_simcall_t simcall, smx_activity_t synchro, do simgrid::kernel::activity::CommImplPtr comm = boost::static_pointer_cast(synchro); - if (comm->src_proc == simcall->issuer) + if (comm->src_actor_ == simcall->issuer) comm->state_ = SIMIX_SRC_TIMEOUT; else comm->state_ = SIMIX_DST_TIMEOUT; @@ -319,10 +319,10 @@ void simcall_HANDLER_comm_wait(smx_simcall_t simcall, smx_activity_t synchro, do simgrid::kernel::activity::CommImplPtr comm = boost::static_pointer_cast(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; } } @@ -334,7 +334,7 @@ void simcall_HANDLER_comm_test(smx_simcall_t simcall, smx_activity_t synchro) 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 { @@ -447,18 +447,18 @@ static inline void SIMIX_comm_start(simgrid::kernel::activity::CommImplPtr comm) /* 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; @@ -467,17 +467,17 @@ static inline void SIMIX_comm_start(simgrid::kernel::activity::CommImplPtr comm) /* 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(); } } } @@ -543,7 +543,7 @@ void SIMIX_comm_finish(smx_activity_t synchro) 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 = @@ -551,7 +551,7 @@ void SIMIX_comm_finish(smx_activity_t synchro) 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 = @@ -561,12 +561,12 @@ void SIMIX_comm_finish(smx_activity_t synchro) 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"); @@ -576,7 +576,7 @@ void SIMIX_comm_finish(smx_activity_t synchro) 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"); @@ -630,17 +630,16 @@ void SIMIX_comm_finish(smx_activity_t synchro) 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); } } @@ -664,7 +663,7 @@ void SIMIX_comm_copy_pointer_callback(smx_activity_t synchro, void* buff, size_t boost::static_pointer_cast(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) @@ -673,10 +672,10 @@ void SIMIX_comm_copy_buffer_callback(smx_activity_t synchro, void* buff, size_t boost::static_pointer_cast(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; } } @@ -689,28 +688,28 @@ void SIMIX_comm_copy_data(smx_activity_t synchro) simgrid::kernel::activity::CommImplPtr comm = boost::static_pointer_cast(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 */ diff --git a/src/smpi/internals/smpi_global.cpp b/src/smpi/internals/smpi_global.cpp index 3eca3f2fad..8e3316530e 100644 --- a/src/smpi/internals/smpi_global.cpp +++ b/src/smpi/internals/smpi_global.cpp @@ -184,8 +184,8 @@ void smpi_comm_copy_buffer_callback(smx_activity_t synchro, void *buff, size_t b 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 { @@ -201,18 +201,19 @@ void smpi_comm_copy_buffer_callback(smx_activity_t synchro, void *buff, size_t b (static_cast(buff) >= smpi_data_exe_start) && (static_cast(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(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 @@ -220,7 +221,7 @@ void smpi_comm_copy_buffer_callback(smx_activity_t synchro, void *buff, size_t b 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); diff --git a/src/smpi/mpi/smpi_request.cpp b/src/smpi/mpi/smpi_request.cpp index 242c12f4fb..dc751be4bf 100644 --- a/src/smpi/mpi/smpi_request.cpp +++ b/src/smpi/mpi/smpi_request.cpp @@ -712,9 +712,8 @@ void Request::iprobe(int source, int tag, MPI_Comm comm, int* flag, MPI_Status* } if (request->action_ != nullptr){ - simgrid::kernel::activity::CommImplPtr sync_comm = - boost::static_pointer_cast(request->action_); - MPI_Request req = static_cast(sync_comm->src_data); + kernel::activity::CommImplPtr sync_comm = boost::static_pointer_cast(request->action_); + MPI_Request req = static_cast(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_);