From: Frederic Suter Date: Tue, 10 Dec 2019 08:10:42 +0000 (+0100) Subject: namespacing cleanups X-Git-Tag: v3.25~309 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/96143e570f085e4217506ca72245a522fd5c24e1 namespacing cleanups --- diff --git a/include/simgrid/smpi/replay.hpp b/include/simgrid/smpi/replay.hpp index c25ab907f1..d295586b74 100644 --- a/include/simgrid/smpi/replay.hpp +++ b/include/simgrid/smpi/replay.hpp @@ -49,7 +49,7 @@ class RequestStorage; // Forward decl class ActionArgParser { public: virtual ~ActionArgParser() = default; - virtual void parse(simgrid::xbt::ReplayAction& action, const std::string& name) { CHECK_ACTION_PARAMS(action, 0, 0) } + virtual void parse(xbt::ReplayAction& action, const std::string& name) { CHECK_ACTION_PARAMS(action, 0, 0) } }; class WaitTestParser : public ActionArgParser { @@ -58,7 +58,7 @@ public: int dst; int tag; - void parse(simgrid::xbt::ReplayAction& action, const std::string& name) override; + void parse(xbt::ReplayAction& action, const std::string& name) override; }; class SendRecvParser : public ActionArgParser { @@ -69,21 +69,21 @@ public: int tag; MPI_Datatype datatype1 = MPI_DEFAULT_TYPE; - void parse(simgrid::xbt::ReplayAction& action, const std::string& name) override; + void parse(xbt::ReplayAction& action, const std::string& name) override; }; class ComputeParser : public ActionArgParser { public: double flops; - void parse(simgrid::xbt::ReplayAction& action, const std::string& name) override; + void parse(xbt::ReplayAction& action, const std::string& name) override; }; class SleepParser : public ActionArgParser { public: double time; - void parse(simgrid::xbt::ReplayAction& action, const std::string& name) override; + void parse(xbt::ReplayAction& action, const std::string& name) override; }; class LocationParser : public ActionArgParser { @@ -91,7 +91,7 @@ public: std::string filename; int line; - void parse(simgrid::xbt::ReplayAction& action, const std::string& name) override; + void parse(xbt::ReplayAction& action, const std::string& name) override; }; class CollCommParser : public ActionArgParser { @@ -108,27 +108,27 @@ public: class BcastArgParser : public CollCommParser { public: - void parse(simgrid::xbt::ReplayAction& action, const std::string& name) override; + void parse(xbt::ReplayAction& action, const std::string& name) override; }; class ReduceArgParser : public CollCommParser { public: - void parse(simgrid::xbt::ReplayAction& action, const std::string& name) override; + void parse(xbt::ReplayAction& action, const std::string& name) override; }; class AllReduceArgParser : public CollCommParser { public: - void parse(simgrid::xbt::ReplayAction& action, const std::string& name) override; + void parse(xbt::ReplayAction& action, const std::string& name) override; }; class AllToAllArgParser : public CollCommParser { public: - void parse(simgrid::xbt::ReplayAction& action, const std::string& name) override; + void parse(xbt::ReplayAction& action, const std::string& name) override; }; class GatherArgParser : public CollCommParser { public: - void parse(simgrid::xbt::ReplayAction& action, const std::string& name) override; + void parse(xbt::ReplayAction& action, const std::string& name) override; }; class GatherVArgParser : public CollCommParser { @@ -136,12 +136,12 @@ public: int recv_size_sum; std::shared_ptr> recvcounts; std::vector disps; - void parse(simgrid::xbt::ReplayAction& action, const std::string& name) override; + void parse(xbt::ReplayAction& action, const std::string& name) override; }; class ScatterArgParser : public CollCommParser { public: - void parse(simgrid::xbt::ReplayAction& action, const std::string& name) override; + void parse(xbt::ReplayAction& action, const std::string& name) override; }; class ScatterVArgParser : public CollCommParser { @@ -150,7 +150,7 @@ public: int send_size_sum; std::shared_ptr> sendcounts; std::vector disps; - void parse(simgrid::xbt::ReplayAction& action, const std::string& name) override; + void parse(xbt::ReplayAction& action, const std::string& name) override; }; class ReduceScatterArgParser : public CollCommParser { @@ -158,7 +158,7 @@ public: int recv_size_sum; std::shared_ptr> recvcounts; std::vector disps; - void parse(simgrid::xbt::ReplayAction& action, const std::string& name) override; + void parse(xbt::ReplayAction& action, const std::string& name) override; }; class AllToAllVArgParser : public CollCommParser { @@ -171,7 +171,7 @@ public: std::vector recvdisps; int send_buf_size; int recv_buf_size; - void parse(simgrid::xbt::ReplayAction& action, const std::string& name) override; + void parse(xbt::ReplayAction& action, const std::string& name) override; }; /** @@ -187,10 +187,10 @@ protected: T args; public: - explicit ReplayAction(const std::string& name) : name(name), my_proc_id(simgrid::s4u::this_actor::get_pid()) {} + explicit ReplayAction(const std::string& name) : name(name), my_proc_id(s4u::this_actor::get_pid()) {} virtual ~ReplayAction() = default; - void execute(simgrid::xbt::ReplayAction& action) + void execute(xbt::ReplayAction& action) { // Needs to be re-initialized for every action, hence here double start_time = smpi_process()->simulated_elapsed(); @@ -206,48 +206,45 @@ public: }; class WaitAction : public ReplayAction { -private: RequestStorage& req_storage; public: explicit WaitAction(RequestStorage& storage) : ReplayAction("Wait"), req_storage(storage) {} - void kernel(simgrid::xbt::ReplayAction& action) override; + void kernel(xbt::ReplayAction& action) override; }; class SendAction : public ReplayAction { -private: RequestStorage& req_storage; public: explicit SendAction(const std::string& name, RequestStorage& storage) : ReplayAction(name), req_storage(storage) {} - void kernel(simgrid::xbt::ReplayAction& action) override; + void kernel(xbt::ReplayAction& action) override; }; class RecvAction : public ReplayAction { -private: RequestStorage& req_storage; public: explicit RecvAction(const std::string& name, RequestStorage& storage) : ReplayAction(name), req_storage(storage) {} - void kernel(simgrid::xbt::ReplayAction& action) override; + void kernel(xbt::ReplayAction& action) override; }; class ComputeAction : public ReplayAction { public: explicit ComputeAction() : ReplayAction("compute") {} - void kernel(simgrid::xbt::ReplayAction& action) override; + void kernel(xbt::ReplayAction& action) override; }; class SleepAction : public ReplayAction { public: explicit SleepAction() : ReplayAction("sleep") {} - void kernel(simgrid::xbt::ReplayAction& action) override; + void kernel(xbt::ReplayAction& action) override; }; class LocationAction : public ReplayAction { public: explicit LocationAction() : ReplayAction("location") {} - void kernel(simgrid::xbt::ReplayAction& action) override; + void kernel(xbt::ReplayAction& action) override; }; class TestAction : public ReplayAction { @@ -256,97 +253,97 @@ private: public: explicit TestAction(RequestStorage& storage) : ReplayAction("Test"), req_storage(storage) {} - void kernel(simgrid::xbt::ReplayAction& action) override; + void kernel(xbt::ReplayAction& action) override; }; class InitAction : public ReplayAction { public: explicit InitAction() : ReplayAction("Init") {} - void kernel(simgrid::xbt::ReplayAction& action) override; + void kernel(xbt::ReplayAction& action) override; }; class CommunicatorAction : public ReplayAction { public: explicit CommunicatorAction() : ReplayAction("Comm") {} - void kernel(simgrid::xbt::ReplayAction& action) override; + void kernel(xbt::ReplayAction& action) override; }; class WaitAllAction : public ReplayAction { -private: RequestStorage& req_storage; public: explicit WaitAllAction(RequestStorage& storage) : ReplayAction("waitall"), req_storage(storage) {} - void kernel(simgrid::xbt::ReplayAction& action) override; + void kernel(xbt::ReplayAction& action) override; }; class BarrierAction : public ReplayAction { public: explicit BarrierAction() : ReplayAction("barrier") {} - void kernel(simgrid::xbt::ReplayAction& action) override; + void kernel(xbt::ReplayAction& action) override; }; class BcastAction : public ReplayAction { public: explicit BcastAction() : ReplayAction("bcast") {} - void kernel(simgrid::xbt::ReplayAction& action) override; + void kernel(xbt::ReplayAction& action) override; }; class ReduceAction : public ReplayAction { public: explicit ReduceAction() : ReplayAction("reduce") {} - void kernel(simgrid::xbt::ReplayAction& action) override; + void kernel(xbt::ReplayAction& action) override; }; class AllReduceAction : public ReplayAction { public: explicit AllReduceAction() : ReplayAction("allreduce") {} - void kernel(simgrid::xbt::ReplayAction& action) override; + void kernel(xbt::ReplayAction& action) override; }; class AllToAllAction : public ReplayAction { public: explicit AllToAllAction() : ReplayAction("alltoall") {} - void kernel(simgrid::xbt::ReplayAction& action) override; + void kernel(xbt::ReplayAction& action) override; }; class GatherAction : public ReplayAction { public: explicit GatherAction(const std::string& name) : ReplayAction(name) {} - void kernel(simgrid::xbt::ReplayAction& action) override; + void kernel(xbt::ReplayAction& action) override; }; class GatherVAction : public ReplayAction { public: explicit GatherVAction(const std::string& name) : ReplayAction(name) {} - void kernel(simgrid::xbt::ReplayAction& action) override; + void kernel(xbt::ReplayAction& action) override; }; class ScatterAction : public ReplayAction { public: explicit ScatterAction() : ReplayAction("scatter") {} - void kernel(simgrid::xbt::ReplayAction& action) override; + void kernel(xbt::ReplayAction& action) override; }; class ScatterVAction : public ReplayAction { public: explicit ScatterVAction() : ReplayAction("scatterv") {} - void kernel(simgrid::xbt::ReplayAction& action) override; + void kernel(xbt::ReplayAction& action) override; }; class ReduceScatterAction : public ReplayAction { public: explicit ReduceScatterAction() : ReplayAction("reducescatter") {} - void kernel(simgrid::xbt::ReplayAction& action) override; + void kernel(xbt::ReplayAction& action) override; }; class AllToAllVAction : public ReplayAction { public: explicit AllToAllVAction() : ReplayAction("alltoallv") {} - void kernel(simgrid::xbt::ReplayAction& action) override; + void kernel(xbt::ReplayAction& action) override; }; -} -} -} + +} // namespace replay +} // namespace smpi +} // namespace simgrid #endif diff --git a/src/kernel/EngineImpl.cpp b/src/kernel/EngineImpl.cpp index 07e067317c..24459fa638 100644 --- a/src/kernel/EngineImpl.cpp +++ b/src/kernel/EngineImpl.cpp @@ -51,7 +51,7 @@ void EngineImpl::load_deployment(const std::string& file) void EngineImpl::register_function(const std::string& name, xbt_main_func_t code) { simix_global->registered_functions[name] = [code](std::vector args) { - return simgrid::xbt::wrap_main(code, std::move(args)); + return xbt::wrap_main(code, std::move(args)); }; } @@ -65,7 +65,7 @@ void EngineImpl::register_function(const std::string& name, void (*code)(std::ve void EngineImpl::register_default(xbt_main_func_t code) { simix_global->default_function = [code](std::vector args) { - return simgrid::xbt::wrap_main(code, std::move(args)); + return xbt::wrap_main(code, std::move(args)); }; } diff --git a/src/kernel/actor/ActorImpl.cpp b/src/kernel/actor/ActorImpl.cpp index 89052da6d9..1e5e15e512 100644 --- a/src/kernel/actor/ActorImpl.cpp +++ b/src/kernel/actor/ActorImpl.cpp @@ -52,7 +52,7 @@ ActorImpl* ActorImpl::self() return (self_context != nullptr) ? self_context->get_actor() : nullptr; } -ActorImpl::ActorImpl(simgrid::xbt::string name, s4u::Host* host) : host_(host), name_(std::move(name)), piface_(this) +ActorImpl::ActorImpl(xbt::string name, s4u::Host* host) : host_(host), name_(std::move(name)), piface_(this) { pid_ = maxpid++; simcall.issuer_ = this; @@ -63,7 +63,7 @@ ActorImpl::~ActorImpl() if (simix_global != nullptr && this != simix_global->maestro_) { if (context_.get() != nullptr) /* the actor was not start()ed yet. This happens if its host was initially off */ context_->iwannadie = false; // don't let the simcall's yield() do a Context::stop(), to avoid infinite loops - simgrid::kernel::actor::simcall([this] { simgrid::s4u::Actor::on_destruction(*ciface()); }); + actor::simcall([this] { s4u::Actor::on_destruction(*ciface()); }); if (context_.get() != nullptr) context_->iwannadie = true; } @@ -86,7 +86,7 @@ ActorImplPtr ActorImpl::attach(const std::string& name, void* data, s4u::Host* h if (not host->is_on()) { XBT_WARN("Cannot launch process '%s' on failed host '%s'", name.c_str(), host->get_cname()); - throw simgrid::HostFailureException(XBT_THROW_POINT, "Cannot attach actor on failed host."); + throw HostFailureException(XBT_THROW_POINT, "Cannot attach actor on failed host."); } ActorImpl* actor = new ActorImpl(xbt::string(name), host); @@ -111,12 +111,12 @@ ActorImplPtr ActorImpl::attach(const std::string& name, void* data, s4u::Host* h simix_global->actors_to_run.push_back(actor); intrusive_ptr_add_ref(actor); - auto* context = dynamic_cast(actor->context_.get()); + auto* context = dynamic_cast(actor->context_.get()); xbt_assert(nullptr != context, "Not a suitable context"); context->attach_start(); /* The on_creation() signal must be delayed until there, where the pid and everything is set */ - simgrid::s4u::Actor::on_creation(*actor->ciface()); + s4u::Actor::on_creation(*actor->ciface()); return ActorImplPtr(actor); } @@ -188,7 +188,7 @@ void ActorImpl::cleanup() simix_global->mutex.unlock(); context_->iwannadie = false; // don't let the simcall's yield() do a Context::stop(), to avoid infinite loops - simgrid::kernel::actor::simcall([this] { simgrid::s4u::Actor::on_termination(*ciface()); }); + actor::simcall([this] { s4u::Actor::on_termination(*ciface()); }); context_->iwannadie = true; } @@ -404,7 +404,7 @@ activity::ActivityImplPtr ActorImpl::join(ActorImpl* actor, double timeout) activity::ActivityImplPtr ActorImpl::sleep(double duration) { if (not host_->is_on()) - throw_exception(std::make_exception_ptr(simgrid::HostFailureException( + throw_exception(std::make_exception_ptr(HostFailureException( XBT_THROW_POINT, std::string("Host ") + host_->get_cname() + " failed, you cannot sleep there."))); auto sleep = new activity::SleepImpl(); @@ -472,7 +472,7 @@ ActorImpl* ActorImpl::start(const simix::ActorCode& code) if (not host_->is_on()) { XBT_WARN("Cannot launch actor '%s' on failed host '%s'", name_.c_str(), host_->get_cname()); intrusive_ptr_release(this); - throw simgrid::HostFailureException(XBT_THROW_POINT, "Cannot start actor on failed host."); + throw HostFailureException(XBT_THROW_POINT, "Cannot start actor on failed host."); } this->code_ = code; diff --git a/src/kernel/lmm/maxmin.hpp b/src/kernel/lmm/maxmin.hpp index a473208124..08627d5a1b 100644 --- a/src/kernel/lmm/maxmin.hpp +++ b/src/kernel/lmm/maxmin.hpp @@ -371,7 +371,7 @@ inline void Element::make_active() inline void Element::make_inactive() { if (active_element_set_hook.is_linked()) - simgrid::xbt::intrusive_erase(constraint->active_element_set_, *this); + xbt::intrusive_erase(constraint->active_element_set_, *this); } /** @@ -475,9 +475,9 @@ private: void remove_variable(Variable * var) { if (var->variable_set_hook_.is_linked()) - simgrid::xbt::intrusive_erase(variable_set, *var); + xbt::intrusive_erase(variable_set, *var); if (var->saturated_variable_set_hook_.is_linked()) - simgrid::xbt::intrusive_erase(saturated_variable_set, *var); + xbt::intrusive_erase(saturated_variable_set, *var); } void make_constraint_active(Constraint * cnst) { @@ -487,9 +487,9 @@ private: void make_constraint_inactive(Constraint * cnst) { if (cnst->active_constraint_set_hook_.is_linked()) - simgrid::xbt::intrusive_erase(active_constraint_set, *cnst); + xbt::intrusive_erase(active_constraint_set, *cnst); if (cnst->modified_constraint_set_hook_.is_linked()) - simgrid::xbt::intrusive_erase(modified_constraint_set, *cnst); + xbt::intrusive_erase(modified_constraint_set, *cnst); } void enable_var(Variable * var); @@ -564,8 +564,8 @@ XBT_PUBLIC System* make_new_maxmin_system(bool selective_update); XBT_PUBLIC System* make_new_fair_bottleneck_system(bool selective_update); /** @} */ -} -} -} +} // namespace lmm +} // namespace kernel +} // namespace simgrid #endif diff --git a/src/s4u/s4u_Exec.cpp b/src/s4u/s4u_Exec.cpp index 2511d76097..ffe6962a94 100644 --- a/src/s4u/s4u_Exec.cpp +++ b/src/s4u/s4u_Exec.cpp @@ -126,7 +126,7 @@ ExecPtr Exec::set_priority(double priority) ExecSeq::ExecSeq(sg_host_t host, double flops_amount) : Exec(), flops_amount_(flops_amount) { Activity::set_remaining(flops_amount_); - boost::static_pointer_cast(pimpl_)->set_host(host); + boost::static_pointer_cast(pimpl_)->set_host(host); } Exec* ExecSeq::start() @@ -154,16 +154,16 @@ ExecPtr ExecSeq::set_host(Host* host) xbt_assert(state_ == State::INITED || state_ == State::STARTED, "Cannot change the host of an exec once it's done (state: %d)", (int)state_); if (state_ == State::STARTED) - boost::static_pointer_cast(pimpl_)->migrate(host); - boost::static_pointer_cast(pimpl_)->set_host(host); + boost::static_pointer_cast(pimpl_)->migrate(host); + boost::static_pointer_cast(pimpl_)->set_host(host); return this; } /** @brief Returns the amount of flops that remain to be done */ double ExecSeq::get_remaining() { - return simgrid::kernel::actor::simcall( - [this]() { return boost::static_pointer_cast(pimpl_)->get_remaining(); }); + return kernel::actor::simcall( + [this]() { return boost::static_pointer_cast(pimpl_)->get_remaining(); }); } /** @brief Returns the ratio of elements that are still to do @@ -172,9 +172,8 @@ double ExecSeq::get_remaining() */ double ExecSeq::get_remaining_ratio() { - return simgrid::kernel::actor::simcall([this]() { - return boost::static_pointer_cast(pimpl_)->get_seq_remaining_ratio(); - }); + return kernel::actor::simcall( + [this]() { return boost::static_pointer_cast(pimpl_)->get_seq_remaining_ratio(); }); } ///////////// PARALLEL EXECUTIONS ////////