From 501b1d3f4293a4a3c27ad38fd74e995584799576 Mon Sep 17 00:00:00 2001 From: Martin Quinson Date: Mon, 20 Nov 2023 21:22:48 +0100 Subject: [PATCH 01/16] f --- docs/find-missing.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/find-missing.py b/docs/find-missing.py index d9d3849992..ac61890030 100755 --- a/docs/find-missing.py +++ b/docs/find-missing.py @@ -94,15 +94,15 @@ def handle_python_module(fullname, englobing, elm): elif isinstance(elm, (int, str)): # We do have such a data, directly in the SimGrid top module found_decl("data", fullname) # print('.. autodata:: {}'.format(fullname)) + elif inspect.isclass(type(elm)): # Enum classes are of that kind + found_decl("data", fullname) + #print('.. autodata:: {}'.format(fullname)) elif inspect.ismodule(elm) or inspect.isclass(elm): for name, data in inspect.getmembers(elm): if name.startswith('__'): continue # print("Recurse on {}.{}".format(fullname, name)) handle_python_module("{}.{}".format(fullname, name), elm, data) - elif inspect.isclass(type(elm)): - found_decl("enumvalue", fullname) - print('.. autoenumvalue:: {}'.format(fullname)) else: print('UNHANDLED TYPE {} : {!r} Type: {} Englobing: {} str: {} Members: \n{}\n'.format(fullname, elm, type(elm), englobing, str(elm), inspect.getmembers(elm))) -- 2.20.1 From 3fad6617c013e4fca6b2333a85751079421baaf4 Mon Sep 17 00:00:00 2001 From: Fred Suter Date: Mon, 20 Nov 2023 19:23:34 -0500 Subject: [PATCH 02/16] strenghten the behavior of Message queues after some Wrench breaking --- src/kernel/activity/MessImpl.cpp | 11 ++++++++++- src/kernel/activity/MessImpl.hpp | 3 +++ src/kernel/activity/MessageQueueImpl.cpp | 23 +++++++++++++++++++++++ src/kernel/activity/MessageQueueImpl.hpp | 3 +++ 4 files changed, 39 insertions(+), 1 deletion(-) diff --git a/src/kernel/activity/MessImpl.cpp b/src/kernel/activity/MessImpl.cpp index 28679c2a4b..3a3e307b77 100644 --- a/src/kernel/activity/MessImpl.cpp +++ b/src/kernel/activity/MessImpl.cpp @@ -130,9 +130,18 @@ void MessImpl::wait_for(actor::ActorImpl* issuer, double timeout) ActivityImpl::wait_for(issuer, timeout); } +void MessImpl::cancel() +{ + /* if the synchro is a waiting state means that it is still in a mbox so remove from it and delete it */ + if (get_state() == State::WAITING) { + queue_->remove(this); + set_state(State::CANCELED); + } +} + void MessImpl::finish() { - XBT_DEBUG("MessImpl::finish() comm %p, state %s, src_proc %p, dst_proc %p", this, get_state_str(), + XBT_DEBUG("MessImpl::finish() mess %p, state %s, src_proc %p, dst_proc %p", this, get_state_str(), src_actor_.get(), dst_actor_.get()); if (get_iface()) { diff --git a/src/kernel/activity/MessImpl.hpp b/src/kernel/activity/MessImpl.hpp index fad011c7b1..2b2932f311 100644 --- a/src/kernel/activity/MessImpl.hpp +++ b/src/kernel/activity/MessImpl.hpp @@ -39,6 +39,9 @@ public: void wait_for(actor::ActorImpl* issuer, double timeout) override; MessImpl* start(); + void suspend() override { /* no action to suspend for Mess */ } + void resume() override { /* no action to resume for Mess */ } + void cancel() override; void set_exception(actor::ActorImpl* issuer) override {}; void finish() override; diff --git a/src/kernel/activity/MessageQueueImpl.cpp b/src/kernel/activity/MessageQueueImpl.cpp index 714f86bdd6..d649e6ee0b 100644 --- a/src/kernel/activity/MessageQueueImpl.cpp +++ b/src/kernel/activity/MessageQueueImpl.cpp @@ -13,6 +13,29 @@ namespace simgrid::kernel::activity { unsigned MessageQueueImpl::next_id_ = 0; +MessageQueueImpl::~MessageQueueImpl() +{ + try { + clear(); + } catch (const std::bad_alloc& ba) { + XBT_ERROR("MessageQueueImpl::clear() failure: %s", ba.what()); + } +} + +/** @brief Removes all message activities from a message queue */ +void MessageQueueImpl::clear() +{ + while (not queue_.empty()) { + auto mess = queue_.back(); + if (mess->get_state() == State::WAITING) { + mess->cancel(); + mess->set_state(State::FAILED); + } else + queue_.pop_back(); + } + xbt_assert(queue_.empty()); +} + void MessageQueueImpl::push(const MessImplPtr& mess) { mess->set_queue(this); diff --git a/src/kernel/activity/MessageQueueImpl.hpp b/src/kernel/activity/MessageQueueImpl.hpp index 4bc010f956..3016e049d5 100644 --- a/src/kernel/activity/MessageQueueImpl.hpp +++ b/src/kernel/activity/MessageQueueImpl.hpp @@ -31,6 +31,8 @@ class MessageQueueImpl { MessageQueueImpl& operator=(const MailboxImpl&) = delete; public: + ~MessageQueueImpl(); + /** @brief Public interface */ unsigned get_id() const { return id_; } @@ -41,6 +43,7 @@ public: const char* get_cname() const { return name_.c_str(); } void push(const MessImplPtr& mess); void remove(const MessImplPtr& mess); + void clear(); bool empty() const { return queue_.empty(); } size_t size() const { return queue_.size(); } const MessImplPtr& front() const { return queue_.front(); } -- 2.20.1 From cef6554994ae17d8f56c9245ad2c10c7cf39af8c Mon Sep 17 00:00:00 2001 From: Martin Quinson Date: Tue, 21 Nov 2023 13:08:53 +0100 Subject: [PATCH 03/16] further improvement to the doxygen doc --- docs/source/app_s4u.rst | 52 +++++++++++++++++++------- include/simgrid/s4u/Link.hpp | 16 +++++++- src/bindings/python/simgrid_python.cpp | 16 +++++--- 3 files changed, 64 insertions(+), 20 deletions(-) diff --git a/docs/source/app_s4u.rst b/docs/source/app_s4u.rst index 8c5a6e8ffe..cf257475d5 100644 --- a/docs/source/app_s4u.rst +++ b/docs/source/app_s4u.rst @@ -1200,11 +1200,17 @@ Querying info .. doxygenfunction:: simgrid::s4u::Disk::set_property(const std::string &, const std::string &value) .. doxygenfunction:: simgrid::s4u::Disk::set_sharing_policy + .. doxygenenum:: simgrid::s4u::Disk::Operation + .. doxygenenum:: simgrid::s4u::Disk::SharingPolicy + .. group-tab:: Python .. autoattribute:: simgrid.Disk.name .. automethod:: simgrid.Disk.set_sharing_policy + .. autoclass:: simgrid.Disk.Operation + .. autoclass:: simgrid.Disk.SharingPolicy + I/O operations -------------- @@ -1611,52 +1617,70 @@ Querying info .. group-tab:: C++ - .. doxygenfunction:: simgrid::s4u::Link::get_bandwidth() const .. doxygenfunction:: simgrid::s4u::Link::get_cname() const - .. doxygenfunction:: simgrid::s4u::Link::get_latency() const .. doxygenfunction:: simgrid::s4u::Link::get_name() const - .. doxygenfunction:: simgrid::s4u::Link::get_sharing_policy() const - .. doxygenfunction:: simgrid::s4u::Link::get_concurrency_limit() const .. doxygenfunction:: simgrid::s4u::Link::get_load() const .. doxygenfunction:: simgrid::s4u::Link::is_used() const .. group-tab:: Python - .. autoattribute:: simgrid.Link.bandwidth - .. autoattribute:: simgrid.Link.latency + .. autoattribute:: simgrid.Link.name .. group-tab:: C - .. doxygenfunction:: sg_link_get_bandwidth(const_sg_link_t link) - .. doxygenfunction:: sg_link_get_latency(const_sg_link_t link) .. doxygenfunction:: sg_link_get_name(const_sg_link_t link) .. doxygenfunction:: sg_link_is_shared(const_sg_link_t link) -Modifying characteristics -------------------------- +Performance +----------- .. tabs:: .. group-tab:: C++ + .. doxygenfunction:: simgrid::s4u::Link::get_bandwidth() const + .. doxygenfunction:: simgrid::s4u::Link::get_latency() const .. doxygenfunction:: simgrid::s4u::Link::set_bandwidth(double value) .. doxygenfunction:: simgrid::s4u::Link::set_latency(double value) .. doxygenfunction:: simgrid::s4u::Link::set_latency(const std::string& value) - .. doxygenfunction:: simgrid::s4u::Link::set_concurrency_limit(int limit) - .. doxygenfunction:: simgrid::s4u::Link::set_sharing_policy .. group-tab:: Python + .. autoattribute:: simgrid.Link.bandwidth + .. autoattribute:: simgrid.Link.latency .. automethod:: simgrid.Link.set_bandwidth .. automethod:: simgrid.Link.set_latency - .. automethod:: simgrid.Link.set_concurrency_limit - .. automethod:: simgrid.Link.set_sharing_policy .. group-tab:: C + .. doxygenfunction:: sg_link_get_bandwidth(const_sg_link_t link) + .. doxygenfunction:: sg_link_get_latency(const_sg_link_t link) .. doxygenfunction:: sg_link_set_bandwidth(sg_link_t link, double value) .. doxygenfunction:: sg_link_set_latency(sg_link_t link, double value) +Model policy +------------ + +.. tabs:: + + .. group-tab:: C++ + + .. doxygenenum:: simgrid::s4u::Link::SharingPolicy + + .. doxygenfunction:: simgrid::s4u::Link::get_sharing_policy() const + .. doxygenfunction:: simgrid::s4u::Link::set_sharing_policy + + .. doxygenfunction:: simgrid::s4u::Link::get_concurrency_limit() const + .. doxygenfunction:: simgrid::s4u::Link::set_concurrency_limit(int limit) + + .. group-tab:: Python + + .. automethod:: simgrid.Link.set_concurrency_limit + .. automethod:: simgrid.Link.set_sharing_policy + + .. group-tab:: C + + User data and properties ------------------------ diff --git a/include/simgrid/s4u/Link.hpp b/include/simgrid/s4u/Link.hpp index c79ca462ac..c2ac18e036 100644 --- a/include/simgrid/s4u/Link.hpp +++ b/include/simgrid/s4u/Link.hpp @@ -45,7 +45,21 @@ protected: #endif public: - enum class SharingPolicy { NONLINEAR = 4, WIFI = 3, SPLITDUPLEX = 2, SHARED = 1, FATPIPE = 0 }; + /** Specifies how a given link is shared between concurrent communications */ + enum class SharingPolicy { + /// This policy takes a callback that specifies the maximal capacity as a function of the number of usage. See the + /// examples with 'degradation' in their name. + NONLINEAR = 4, + /// Pseudo-sharing policy requesting wifi-specific sharing. + WIFI = 3, + /// Each link is split in 2, UP and DOWN, one per direction. These links are SHARED. + SPLITDUPLEX = 2, + /// The bandwidth is shared between all comms using that link, regardless of their direction. + SHARED = 1, + /// Each comm can use the link fully, with no sharing (only a maximum). This is intended to represent the backbone + /// links that cannot be saturated by concurrent links, but have a maximal bandwidth. + FATPIPE = 0 + }; kernel::resource::StandardLinkImpl* get_impl() const; diff --git a/src/bindings/python/simgrid_python.cpp b/src/bindings/python/simgrid_python.cpp index 8dd178a1ab..41e86465b6 100644 --- a/src/bindings/python/simgrid_python.cpp +++ b/src/bindings/python/simgrid_python.cpp @@ -571,11 +571,17 @@ PYBIND11_MODULE(simgrid, m) "__repr__", [](const Link* l) { return "Link(" + l->get_name() + ")"; }, "Textual representation of the Link"); py::enum_(link, "SharingPolicy") - .value("NONLINEAR", Link::SharingPolicy::NONLINEAR) - .value("WIFI", Link::SharingPolicy::WIFI) - .value("SPLITDUPLEX", Link::SharingPolicy::SPLITDUPLEX) - .value("SHARED", Link::SharingPolicy::SHARED) - .value("FATPIPE", Link::SharingPolicy::FATPIPE); + .value("NONLINEAR", Link::SharingPolicy::NONLINEAR, + "This policy takes a callback that specifies the maximal capacity as a function of the number of usage. " + "See the examples with 'degradation' in their name.") + .value("WIFI", Link::SharingPolicy::WIFI, "Pseudo-sharing policy requesting wifi-specific sharing.") + .value("SPLITDUPLEX", Link::SharingPolicy::SPLITDUPLEX, + "Each link is split in 2, UP and DOWN, one per direction. These links are SHARED.") + .value("SHARED", Link::SharingPolicy::SHARED, + "The bandwidth is shared between all comms using that link, regardless of their direction.") + .value("FATPIPE", Link::SharingPolicy::FATPIPE, + "Each comm can use the link fully, with no sharing (only a maximum). This is intended to represent the " + "backbone links that cannot be saturated by concurrent links, but have a maximal bandwidth."); /* Class LinkInRoute */ py::class_ linkinroute(m, "LinkInRoute", "Abstraction to add link in routes"); -- 2.20.1 From 3f9b311ec56db95ec539001a860ae3c838c48312 Mon Sep 17 00:00:00 2001 From: Martin Quinson Date: Tue, 21 Nov 2023 14:53:20 +0100 Subject: [PATCH 04/16] Various sonar cleanups --- examples/python/comm-ready/comm-ready.py | 2 +- examples/sthread/pthread-mutex-recursive.c | 3 +- include/simgrid/plugins/battery.hpp | 4 +-- include/simgrid/plugins/chiller.hpp | 2 +- include/simgrid/s4u/Engine.hpp | 8 ++--- include/simgrid/s4u/NetZone.hpp | 2 +- include/simgrid/s4u/Task.hpp | 2 +- src/bindings/python/simgrid_python.cpp | 2 +- src/kernel/activity/MutexImpl.hpp | 8 ++--- src/kernel/actor/CommObserver.cpp | 8 ++--- src/kernel/actor/SimcallObserver.hpp | 2 +- src/mc/api/State.cpp | 2 +- src/mc/api/strategy/BasicStrategy.hpp | 2 +- src/mc/explo/DFSExplorer.cpp | 2 +- src/mc/transition/TransitionActor.cpp | 25 +++++-------- src/mc/transition/TransitionAny.cpp | 20 ++++------- src/mc/transition/TransitionComm.cpp | 37 +++++++------------- src/mc/transition/TransitionObjectAccess.cpp | 9 ++--- src/mc/transition/TransitionRandom.cpp | 9 ++--- src/plugins/battery.cpp | 2 -- src/plugins/chiller.cpp | 2 +- src/s4u/s4u_ActivitySet.cpp | 6 ++-- src/smpi/bindings/smpi_pmpi_request.cpp | 4 +-- src/sthread/sthread.c | 10 +++--- 24 files changed, 70 insertions(+), 103 deletions(-) diff --git a/examples/python/comm-ready/comm-ready.py b/examples/python/comm-ready/comm-ready.py index f874bd9748..20065327c5 100644 --- a/examples/python/comm-ready/comm-ready.py +++ b/examples/python/comm-ready/comm-ready.py @@ -58,7 +58,7 @@ def peer(my_id: int, message_count: int, payload_size: int, peers_count: int): start = Engine.clock received: str = my_mailbox.get() waiting_time = Engine.clock - start - if waiting_time != 0.0: + if waiting_time > 0.0: raise AssertionError(f"Expecting the waiting time to be 0.0 because the communication was supposedly " f"ready, but got {waiting_time} instead") this_actor.info(f"I got a '{received}'.") diff --git a/examples/sthread/pthread-mutex-recursive.c b/examples/sthread/pthread-mutex-recursive.c index 482cf3ee7f..63c9cccb23 100644 --- a/examples/sthread/pthread-mutex-recursive.c +++ b/examples/sthread/pthread-mutex-recursive.c @@ -40,7 +40,8 @@ static void* thread_function(void* arg) int main() { - pthread_t thread1, thread2; + pthread_t thread1; + pthread_t thread2; pthread_mutex_t mutex_dflt = PTHREAD_MUTEX_INITIALIZER; // Non-recursive mutex pthread_mutexattr_t attr; diff --git a/include/simgrid/plugins/battery.hpp b/include/simgrid/plugins/battery.hpp index 61937a91a6..fc395053df 100644 --- a/include/simgrid/plugins/battery.hpp +++ b/include/simgrid/plugins/battery.hpp @@ -105,7 +105,7 @@ private: double energy_consumed_j_ = 0; double last_updated_ = 0; - explicit Battery(); + explicit Battery() = default; explicit Battery(const std::string& name, double state_of_charge, double nominal_charge_power_w, double nominal_discharge_power_w, double charge_efficiency, double discharge_efficiency, double initial_capacity_wh, int cycles); @@ -133,7 +133,7 @@ public: void set_load(const std::string& name, double power_w); void set_load(const std::string& name, bool active); void connect_host(s4u::Host* host, bool active = true); - std::string get_name() {return name_;} + std::string get_name() const { return name_; } double get_state_of_charge(); double get_state_of_health(); double get_capacity(); diff --git a/include/simgrid/plugins/chiller.hpp b/include/simgrid/plugins/chiller.hpp index 11fa173477..78d1db0343 100644 --- a/include/simgrid/plugins/chiller.hpp +++ b/include/simgrid/plugins/chiller.hpp @@ -100,7 +100,7 @@ public: double get_temp_in() { return temp_in_c_; } double get_power() { return power_w_; } double get_energy_consumed() { return energy_consumed_j_; } - double get_time_to_goal_temp(); + double get_time_to_goal_temp() const; }; } // namespace simgrid::plugins diff --git a/include/simgrid/s4u/Engine.hpp b/include/simgrid/s4u/Engine.hpp index fbef8cccc9..2bdb4a9cce 100644 --- a/include/simgrid/s4u/Engine.hpp +++ b/include/simgrid/s4u/Engine.hpp @@ -93,8 +93,8 @@ public: /** @verbatim embed:rst:inline Bind an actor name that could be found in :ref:`pf_tag_actor` tag to a class name passed as a template parameter. See the :ref:`example `. @endverbatim */ template void register_actor(const std::string& name) { - kernel::actor::ActorCodeFactory code_factory = [](std::vector args) { - return kernel::actor::ActorCode([args = std::move(args)]() mutable { + kernel::actor::ActorCodeFactory code_factory = [](std::vector args_factory) { + return kernel::actor::ActorCode([args = std::move(args_factory)]() mutable { F code(std::move(args)); code(); }); @@ -104,8 +104,8 @@ public: /** @verbatim embed:rst:inline Bind an actor name that could be found in :ref:`pf_tag_actor` tag to a function name passed as a parameter. See the :ref:`example `. @endverbatim */ template void register_actor(const std::string& name, F code) { - kernel::actor::ActorCodeFactory code_factory = [code](std::vector args) { - return kernel::actor::ActorCode([code, args = std::move(args)]() mutable { code(std::move(args)); }); + kernel::actor::ActorCodeFactory code_factory = [code](std::vector args_factory) { + return kernel::actor::ActorCode([code, args = std::move(args_factory)]() mutable { code(std::move(args)); }); }; register_function(name, code_factory); } diff --git a/include/simgrid/s4u/NetZone.hpp b/include/simgrid/s4u/NetZone.hpp index 76125f3c49..ab535fa289 100644 --- a/include/simgrid/s4u/NetZone.hpp +++ b/include/simgrid/s4u/NetZone.hpp @@ -62,7 +62,7 @@ public: /** @brief Get the gateway associated to this netzone */ kernel::routing::NetPoint* get_gateway() const; kernel::routing::NetPoint* get_gateway(const std::string& name) const; - void set_gateway(s4u::Host* router) { set_gateway(router->get_netpoint()); } + void set_gateway(const s4u::Host* router) { set_gateway(router->get_netpoint()); } void set_gateway(kernel::routing::NetPoint* router); void set_gateway(const std::string& name, kernel::routing::NetPoint* router); diff --git a/include/simgrid/s4u/Task.hpp b/include/simgrid/s4u/Task.hpp index 03ee2653ba..f10729b324 100644 --- a/include/simgrid/s4u/Task.hpp +++ b/include/simgrid/s4u/Task.hpp @@ -64,7 +64,7 @@ protected: virtual void fire(std::string instance); void complete(std::string instance); - void store_activity(ActivityPtr a, std::string instance) { current_activities_[instance].push_back(a); } + void store_activity(ActivityPtr a, const std::string& instance) { current_activities_[instance].push_back(a); } virtual void add_instances(int n); virtual void remove_instances(int n); diff --git a/src/bindings/python/simgrid_python.cpp b/src/bindings/python/simgrid_python.cpp index 41e86465b6..7f5f6b9ed0 100644 --- a/src/bindings/python/simgrid_python.cpp +++ b/src/bindings/python/simgrid_python.cpp @@ -294,7 +294,7 @@ PYBIND11_MODULE(simgrid, m) .def("create_router", &simgrid::s4u::NetZone::create_router, "Create a router") .def("set_parent", &simgrid::s4u::NetZone::set_parent, "Set the parent of this zone") .def("set_property", &simgrid::s4u::NetZone::set_property, "Add a property to this zone") - .def("set_gateway", py::overload_cast(&simgrid::s4u::NetZone::set_gateway), + .def("set_gateway", py::overload_cast(&simgrid::s4u::NetZone::set_gateway), "Specify the gateway of this zone, to be used for inter-zone routes") .def("set_gateway", py::overload_cast(&simgrid::s4u::NetZone::set_gateway), "Specify the gateway of this zone, to be used for inter-zone routes") diff --git a/src/kernel/activity/MutexImpl.hpp b/src/kernel/activity/MutexImpl.hpp index 75cb5d6874..8bf71be533 100644 --- a/src/kernel/activity/MutexImpl.hpp +++ b/src/kernel/activity/MutexImpl.hpp @@ -52,10 +52,10 @@ class XBT_PUBLIC MutexAcquisitionImpl : public ActivityImpl_Tget_id() : 0)) + " mbox:" + - std::to_string(mbox_->get_id()) + " tag: " + std::to_string(tag_) + ")"; + return "CommAsyncSend(comm_id: " + std::to_string(comm_ ? comm_->get_id() : 0) + + " mbox:" + std::to_string(mbox_->get_id()) + " tag: " + std::to_string(tag_) + ")"; } void CommIrecvSimcall::serialize(std::stringstream& stream) const @@ -237,8 +237,8 @@ void CommIrecvSimcall::serialize(std::stringstream& stream) const std::string CommIrecvSimcall::to_string() const { - return "CommAsyncRecv(comm_id: " + std::to_string((comm_ ? comm_->get_id() : 0)) + " mbox:" + - std::to_string(mbox_->get_id()) + " tag: " + std::to_string(tag_) + ")"; + return "CommAsyncRecv(comm_id: " + std::to_string(comm_ ? comm_->get_id() : 0) + + " mbox:" + std::to_string(mbox_->get_id()) + " tag: " + std::to_string(tag_) + ")"; } void MessIputSimcall::serialize(std::stringstream& stream) const diff --git a/src/kernel/actor/SimcallObserver.hpp b/src/kernel/actor/SimcallObserver.hpp index c7d1353620..de3f4fc27c 100644 --- a/src/kernel/actor/SimcallObserver.hpp +++ b/src/kernel/actor/SimcallObserver.hpp @@ -111,7 +111,7 @@ public: class ActorSleepSimcall final : public SimcallObserver { public: - ActorSleepSimcall(ActorImpl* actor) : SimcallObserver(actor) {} + explicit ActorSleepSimcall(ActorImpl* actor) : SimcallObserver(actor) {} void serialize(std::stringstream& stream) const override; std::string to_string() const override; }; diff --git a/src/mc/api/State.cpp b/src/mc/api/State.cpp index 52ffde6044..f537a484b5 100644 --- a/src/mc/api/State.cpp +++ b/src/mc/api/State.cpp @@ -245,7 +245,7 @@ void State::sprout_tree_from_parent_state() "to schedule from the wakeup tree? Trace so far:", get_transition_in()->to_string(false).c_str(), get_transition_in()->aid_, min_process_node.value()->get_action()->to_string(false).c_str(), min_process_node.value()->get_actor()); - for (auto elm : Exploration::get_instance()->get_textual_trace()) + for (auto const& elm : Exploration::get_instance()->get_textual_trace()) XBT_ERROR("%s", elm.c_str()); xbt_abort(); } diff --git a/src/mc/api/strategy/BasicStrategy.hpp b/src/mc/api/strategy/BasicStrategy.hpp index 3d7d01bbd6..ca44509880 100644 --- a/src/mc/api/strategy/BasicStrategy.hpp +++ b/src/mc/api/strategy/BasicStrategy.hpp @@ -31,7 +31,7 @@ public: "--cfg=model-check/max-depth. Here are the 100 first trace elements", _sg_mc_max_depth.get()); auto trace = Exploration::get_instance()->get_textual_trace(100); - for (auto elm : trace) + for (auto const& elm : trace) XBT_CERROR(mc_dfs, " %s", elm.c_str()); xbt_die("Aborting now."); } diff --git a/src/mc/explo/DFSExplorer.cpp b/src/mc/explo/DFSExplorer.cpp index 0466d6654f..b328d15773 100644 --- a/src/mc/explo/DFSExplorer.cpp +++ b/src/mc/explo/DFSExplorer.cpp @@ -433,7 +433,7 @@ void DFSExplorer::backtrack() // Search how to restore the backtracking point std::deque replay_recipe; - for (auto* s = backtracking_point.get(); s != nullptr; s = s->get_parent_state().get()) { + for (const auto* s = backtracking_point.get(); s != nullptr; s = s->get_parent_state().get()) { if (s->get_transition_in() != nullptr) // The root has no transition_in replay_recipe.push_front(s->get_transition_in().get()); } diff --git a/src/mc/transition/TransitionActor.cpp b/src/mc/transition/TransitionActor.cpp index 16a17a3d09..3e1027b576 100644 --- a/src/mc/transition/TransitionActor.cpp +++ b/src/mc/transition/TransitionActor.cpp @@ -49,18 +49,14 @@ bool ActorJoinTransition::depends(const Transition* other) const bool ActorJoinTransition::reversible_race(const Transition* other) const { - switch (type_) { - case Type::ACTOR_JOIN: - // ActorJoin races with another event iff its target `T` is the same as - // the actor executing the other transition. Clearly, then, we could not join - // on that actor `T` and then run a transition by `T`, so no race is reversible - return false; - default: - xbt_die("Unexpected transition type %s", to_c_str(type_)); - } + xbt_assert(type_ == Type::ACTOR_JOIN, "Unexpected transition type %s", to_c_str(type_)); + + // ActorJoin races with another event iff its target `T` is the same as the actor executing the other transition. + // Clearly, then, we could not join on that actor `T` and then run a transition by `T`, so no race is reversible + return false; } -ActorSleepTransition::ActorSleepTransition(aid_t issuer, int times_considered, std::stringstream& stream) +ActorSleepTransition::ActorSleepTransition(aid_t issuer, int times_considered, std::stringstream&) : Transition(Type::ACTOR_SLEEP, issuer, times_considered) { XBT_DEBUG("ActorSleepTransition()"); @@ -81,12 +77,9 @@ bool ActorSleepTransition::depends(const Transition* other) const bool ActorSleepTransition::reversible_race(const Transition* other) const { - switch (type_) { - case Type::ACTOR_SLEEP: - return true; // Always enabled - default: - xbt_die("Unexpected transition type %s", to_c_str(type_)); - } + xbt_assert(type_ == Type::ACTOR_SLEEP, "Unexpected transition type %s", to_c_str(type_)); + + return true; // Always enabled } } // namespace simgrid::mc diff --git a/src/mc/transition/TransitionAny.cpp b/src/mc/transition/TransitionAny.cpp index 580fb44389..b3c7b63cb3 100644 --- a/src/mc/transition/TransitionAny.cpp +++ b/src/mc/transition/TransitionAny.cpp @@ -45,12 +45,9 @@ bool TestAnyTransition::depends(const Transition* other) const } bool TestAnyTransition::reversible_race(const Transition* other) const { - switch (type_) { - case Type::TESTANY: - return true; // TestAny is always enabled - default: - xbt_die("Unexpected transition type %s", to_c_str(type_)); - } + xbt_assert(type_ == Type::TESTANY, "Unexpected transition type %s", to_c_str(type_)); + + return true; // TestAny is always enabled } WaitAnyTransition::WaitAnyTransition(aid_t issuer, int times_considered, std::stringstream& stream) @@ -81,13 +78,10 @@ bool WaitAnyTransition::depends(const Transition* other) const } bool WaitAnyTransition::reversible_race(const Transition* other) const { - switch (type_) { - case Type::WAITANY: - // TODO: We need to check if any of the transitions waited on occurred before `e1` - return true; // Let's overapproximate to not miss branches - default: - xbt_die("Unexpected transition type %s", to_c_str(type_)); - } + xbt_assert(type_ == Type::WAITANY, "Unexpected transition type %s", to_c_str(type_)); + + // TODO: We need to check if any of the transitions waited on occurred before `e1` + return true; // Let's overapproximate to not miss branches } } // namespace simgrid::mc diff --git a/src/mc/transition/TransitionComm.cpp b/src/mc/transition/TransitionComm.cpp index 19d8ebfde9..d23cd86fb8 100644 --- a/src/mc/transition/TransitionComm.cpp +++ b/src/mc/transition/TransitionComm.cpp @@ -59,13 +59,10 @@ bool CommWaitTransition::depends(const Transition* other) const bool CommWaitTransition::reversible_race(const Transition* other) const { - switch (type_) { - case Type::COMM_WAIT: - // If the other event is a communication event, then we are not reversible; otherwise we are reversible. - return other->type_ != Transition::Type::COMM_ASYNC_SEND && other->type_ != Transition::Type::COMM_ASYNC_RECV; - default: - xbt_die("Unexpected transition type %s", to_c_str(type_)); - } + xbt_assert(type_ == Type::COMM_WAIT, "Unexpected transition type %s", to_c_str(type_)); + + // If the other event is a communication event, then we are not reversible; otherwise we are reversible. + return other->type_ != Transition::Type::COMM_ASYNC_SEND && other->type_ != Transition::Type::COMM_ASYNC_RECV; } CommTestTransition::CommTestTransition(aid_t issuer, int times_considered, unsigned comm_, aid_t sender_, @@ -114,12 +111,8 @@ bool CommTestTransition::depends(const Transition* other) const bool CommTestTransition::reversible_race(const Transition* other) const { - switch (type_) { - case Type::COMM_TEST: - return true; // CommTest is always enabled - default: - xbt_die("Unexpected transition type %s", to_c_str(type_)); - } + xbt_assert(type_ == Type::COMM_TEST, "Unexpected transition type %s", to_c_str(type_)); + return true; // CommTest is always enabled } CommRecvTransition::CommRecvTransition(aid_t issuer, int times_considered, unsigned comm_, unsigned mbox_, int tag_) @@ -189,12 +182,9 @@ bool CommRecvTransition::depends(const Transition* other) const bool CommRecvTransition::reversible_race(const Transition* other) const { - switch (type_) { - case Type::COMM_ASYNC_RECV: - return true; // CommRecv is always enabled - default: - xbt_die("Unexpected transition type %s", to_c_str(type_)); - } + xbt_assert(type_ == Type::COMM_ASYNC_RECV, "Unexpected transition type %s", to_c_str(type_)); + + return true; // CommRecv is always enabled } CommSendTransition::CommSendTransition(aid_t issuer, int times_considered, unsigned comm_, unsigned mbox_, int tag_) @@ -265,12 +255,9 @@ bool CommSendTransition::depends(const Transition* other) const bool CommSendTransition::reversible_race(const Transition* other) const { - switch (type_) { - case Type::COMM_ASYNC_SEND: - return true; // CommSend is always enabled - default: - xbt_die("Unexpected transition type %s", to_c_str(type_)); - } + xbt_assert(type_ == Type::COMM_ASYNC_SEND, "Unexpected transition type %s", to_c_str(type_)); + + return true; // CommSend is always enabled } } // namespace simgrid::mc diff --git a/src/mc/transition/TransitionObjectAccess.cpp b/src/mc/transition/TransitionObjectAccess.cpp index 33b4163012..f32e459008 100644 --- a/src/mc/transition/TransitionObjectAccess.cpp +++ b/src/mc/transition/TransitionObjectAccess.cpp @@ -48,12 +48,9 @@ bool ObjectAccessTransition::depends(const Transition* o) const bool ObjectAccessTransition::reversible_race(const Transition* other) const { - switch (type_) { - case Type::OBJECT_ACCESS: - return true; // Object access is always enabled - default: - xbt_die("Unexpected transition type %s", to_c_str(type_)); - } + xbt_assert(type_ == Type::OBJECT_ACCESS, "Unexpected transition type %s", to_c_str(type_)); + + return true; // Object access is always enabled } } // namespace simgrid::mc diff --git a/src/mc/transition/TransitionRandom.cpp b/src/mc/transition/TransitionRandom.cpp index 81eab72a0d..7470be286d 100644 --- a/src/mc/transition/TransitionRandom.cpp +++ b/src/mc/transition/TransitionRandom.cpp @@ -25,12 +25,9 @@ RandomTransition::RandomTransition(aid_t issuer, int times_considered, std::stri bool RandomTransition::reversible_race(const Transition* other) const { - switch (type_) { - case Type::RANDOM: - return true; // Random is always enabled - default: - xbt_die("Unexpected transition type %s", to_c_str(type_)); - } + xbt_assert(type_ == Type::RANDOM, "Unexpected transition type %s", to_c_str(type_)); + + return true; // Random is always enabled } } // namespace simgrid::mc diff --git a/src/plugins/battery.cpp b/src/plugins/battery.cpp index c682e178ac..0cbfdbc8c5 100644 --- a/src/plugins/battery.cpp +++ b/src/plugins/battery.cpp @@ -270,8 +270,6 @@ double Battery::next_occurring_handler() return time_delta; } -Battery::Battery() {} - Battery::Battery(const std::string& name, double state_of_charge, double nominal_charge_power_w, double nominal_discharge_power_w, double charge_efficiency, double discharge_efficiency, double initial_capacity_wh, int cycles) diff --git a/src/plugins/chiller.cpp b/src/plugins/chiller.cpp index 7d2b9de4c7..0a4d3afe4d 100644 --- a/src/plugins/chiller.cpp +++ b/src/plugins/chiller.cpp @@ -283,7 +283,7 @@ ChillerPtr Chiller::remove_host(s4u::Host* host) /** @ingroup plugin_chiller * @return The time to reach to goal temp, assuming that the system remain in the same state. */ -double Chiller::get_time_to_goal_temp() +double Chiller::get_time_to_goal_temp() const { if (goal_temp_c_ == temp_in_c_) return 0; diff --git a/src/s4u/s4u_ActivitySet.cpp b/src/s4u/s4u_ActivitySet.cpp index 92a65cedf0..61957a3f9e 100644 --- a/src/s4u/s4u_ActivitySet.cpp +++ b/src/s4u/s4u_ActivitySet.cpp @@ -103,13 +103,13 @@ ActivityPtr ActivitySet::wait_any_for(double timeout) return ret; } catch (const HostFailureException& e) { handle_failed_activities(); - throw e; + throw; } catch (const NetworkFailureException& e) { handle_failed_activities(); - throw e; + throw; } catch (const StorageFailureException& e) { handle_failed_activities(); - throw e; + throw; } } diff --git a/src/smpi/bindings/smpi_pmpi_request.cpp b/src/smpi/bindings/smpi_pmpi_request.cpp index 73ea9b9b7c..0dc9e32f21 100644 --- a/src/smpi/bindings/smpi_pmpi_request.cpp +++ b/src/smpi/bindings/smpi_pmpi_request.cpp @@ -382,7 +382,7 @@ int PMPI_Sendrecv(const void* sendbuf, int sendcount, MPI_Datatype sendtype, int CHECK_BUFFER(1, sendbuf, sendcount, sendtype) CHECK_BUFFER(6, recvbuf, recvcount, recvtype) CHECK_ARGS(sendbuf == recvbuf && sendcount > 0 && recvcount > 0, MPI_ERR_BUFFER, - "%s: Invalid parameters 1 and 6: sendbuf and recvbuf must be disjoint", __func__); + "%s: Invalid parameters 1 and 6: sendbuf and recvbuf must be disjoint", __func__) CHECK_TAG(10, recvtag) CHECK_COMM(11) const SmpiBenchGuard suspend_bench; @@ -443,7 +443,7 @@ int PMPI_Isendrecv(const void* sendbuf, int sendcount, MPI_Datatype sendtype, in CHECK_BUFFER(1, sendbuf, sendcount, sendtype) CHECK_BUFFER(6, recvbuf, recvcount, recvtype) CHECK_ARGS(sendbuf == recvbuf && sendcount > 0 && recvcount > 0, MPI_ERR_BUFFER, - "%s: Invalid parameters 1 and 6: sendbuf and recvbuf must be disjoint", __func__); + "%s: Invalid parameters 1 and 6: sendbuf and recvbuf must be disjoint", __func__) CHECK_TAG(10, recvtag) CHECK_COMM(11) CHECK_REQUEST(12) diff --git a/src/sthread/sthread.c b/src/sthread/sthread.c index af260220f2..ad27e3fa1d 100644 --- a/src/sthread/sthread.c +++ b/src/sthread/sthread.c @@ -30,7 +30,7 @@ static int (*raw_pthread_mutex_destroy)(pthread_mutex_t*); static int (*raw_pthread_mutexattr_init)(pthread_mutexattr_t*); static int (*raw_pthread_mutexattr_settype)(pthread_mutexattr_t*, int); -static int (*raw_pthread_mutexattr_gettype)(const pthread_mutexattr_t* restrict, int* restrict); +static int (*raw_pthread_mutexattr_gettype)(const pthread_mutexattr_t*, int*); static int (*raw_pthread_mutexattr_getrobust)(const pthread_mutexattr_t*, int*); static int (*raw_pthread_mutexattr_setrobust)(pthread_mutexattr_t*, int); @@ -125,12 +125,12 @@ void sthread_disable(void) intercepted_pthcall(mutexattr_init, (pthread_mutexattr_t * attr), (attr), ((sthread_mutexattr_t*)attr)); intercepted_pthcall(mutexattr_settype, (pthread_mutexattr_t * attr, int type), (attr, type), ((sthread_mutexattr_t*)attr, type)); -intercepted_pthcall(mutexattr_gettype, (const pthread_mutexattr_t* restrict attr, int* type), (attr, type), +intercepted_pthcall(mutexattr_gettype, (const pthread_mutexattr_t* attr, int* type), (attr, type), ((sthread_mutexattr_t*)attr, type)); -intercepted_pthcall(mutexattr_setrobust, (pthread_mutexattr_t* restrict attr, int robustness), (attr, robustness), +intercepted_pthcall(mutexattr_setrobust, (pthread_mutexattr_t * attr, int robustness), (attr, robustness), + ((sthread_mutexattr_t*)attr, robustness)); +intercepted_pthcall(mutexattr_getrobust, (const pthread_mutexattr_t* attr, int* robustness), (attr, robustness), ((sthread_mutexattr_t*)attr, robustness)); -intercepted_pthcall(mutexattr_getrobust, (const pthread_mutexattr_t* restrict attr, int* restrict robustness), - (attr, robustness), ((sthread_mutexattr_t*)attr, robustness)); intercepted_pthcall(create, (pthread_t * thread, const pthread_attr_t* attr, void* (*start_routine)(void*), void* arg), (thread, attr, start_routine, arg), ((sthread_t*)thread, attr, start_routine, arg)); -- 2.20.1 From 09392faf42646e631a4e42553e901410eb3e488e Mon Sep 17 00:00:00 2001 From: Arnaud Giersch Date: Tue, 21 Nov 2023 11:40:41 +0100 Subject: [PATCH 05/16] Update XBT_ATTRIB_DEPRECATED_v??? in comments. [ci-skip] --- include/simgrid/s4u/Comm.hpp | 3 ++- include/simgrid/s4u/Io.hpp | 2 +- src/bindings/python/simgrid_python.cpp | 2 +- src/s4u/s4u_Activity.cpp | 2 +- src/s4u/s4u_Comm.cpp | 6 +++--- src/s4u/s4u_Io.cpp | 2 +- src/s4u/s4u_Netzone.cpp | 4 ++-- src/s4u/s4u_VirtualMachine.cpp | 3 ++- 8 files changed, 13 insertions(+), 11 deletions(-) diff --git a/include/simgrid/s4u/Comm.hpp b/include/simgrid/s4u/Comm.hpp index cf4cf5a8b3..57f6443c29 100644 --- a/include/simgrid/s4u/Comm.hpp +++ b/include/simgrid/s4u/Comm.hpp @@ -188,7 +188,8 @@ public: XBT_ATTRIB_DEPRECATED_v339("Please use ActivitySet instead") static ssize_t wait_any(const std::vector& comms) { return deprecated_wait_any_for(comms, -1); } XBT_ATTRIB_DEPRECATED_v339("Please use ActivitySet instead") static ssize_t wait_any_for(const std::vector& comms, double timeout) { return deprecated_wait_any_for(comms, timeout); } - static ssize_t deprecated_wait_any_for(const std::vector& comms, double timeout); + static ssize_t deprecated_wait_any_for(const std::vector& comms, + double timeout); // XBT_ATTRIB_DEPRECATED_v339 XBT_ATTRIB_DEPRECATED_v339("Please use ActivitySet instead") static ssize_t test_any(const std::vector& comms); XBT_ATTRIB_DEPRECATED_v339("Please use ActivitySet instead") static void wait_all(const std::vector& comms); diff --git a/include/simgrid/s4u/Io.hpp b/include/simgrid/s4u/Io.hpp index 6dc9a3f051..0709a3b50c 100644 --- a/include/simgrid/s4u/Io.hpp +++ b/include/simgrid/s4u/Io.hpp @@ -28,7 +28,7 @@ protected: explicit Io(kernel::activity::IoImplPtr pimpl); Io* do_start() override; - static ssize_t deprecated_wait_any_for(const std::vector& ios, double timeout); + static ssize_t deprecated_wait_any_for(const std::vector& ios, double timeout); // XBT_ATTRIB_DEPRECATED_v339 public: enum class OpType { READ, WRITE }; diff --git a/src/bindings/python/simgrid_python.cpp b/src/bindings/python/simgrid_python.cpp index 7f5f6b9ed0..6d6f5c15ba 100644 --- a/src/bindings/python/simgrid_python.cpp +++ b/src/bindings/python/simgrid_python.cpp @@ -240,7 +240,7 @@ PYBIND11_MODULE(simgrid, m) simgrid::kernel::routing::NetPoint* dst, simgrid::kernel::routing::NetPoint* gw_src, simgrid::kernel::routing::NetPoint* gw_dst, const std::vector& links, bool symmetrical) { - PyErr_WarnEx(PyExc_DeprecationWarning, // XBT_ATTRIB_DEPRECATED_v335. Once removed, uncomment the + PyErr_WarnEx(PyExc_DeprecationWarning, // XBT_ATTRIB_DEPRECATED_v336. Once removed, uncomment the // deprecation of the AddRoute function in C++ "Please call add_route either from Host to Host or NetZone to NetZone. This call will be " "removed after SimGrid v3.35.", diff --git a/src/s4u/s4u_Activity.cpp b/src/s4u/s4u_Activity.cpp index 091b2a12cb..a1711b5fb5 100644 --- a/src/s4u/s4u_Activity.cpp +++ b/src/s4u/s4u_Activity.cpp @@ -92,7 +92,7 @@ bool Activity::test() return false; } -ssize_t Activity::test_any(const std::vector& activities) +ssize_t Activity::test_any(const std::vector& activities) // XBT_ATTRIB_DEPRECATED_v339 { std::vector ractivities(activities.size()); std::transform(begin(activities), end(activities), begin(ractivities), diff --git a/src/s4u/s4u_Comm.cpp b/src/s4u/s4u_Comm.cpp index 5d27168a0f..aec421bfa9 100644 --- a/src/s4u/s4u_Comm.cpp +++ b/src/s4u/s4u_Comm.cpp @@ -563,7 +563,7 @@ sg_error_t sg_comm_wait_for(sg_comm_t comm, double timeout) return status; } -void sg_comm_wait_all(sg_comm_t* comms, size_t count) +void sg_comm_wait_all(sg_comm_t* comms, size_t count) // XBT_ATTRIB_DEPRECATED_v339 { simgrid::s4u::ActivitySet as; for (size_t i = 0; i < count; i++) @@ -572,7 +572,7 @@ void sg_comm_wait_all(sg_comm_t* comms, size_t count) as.wait_all(); } -ssize_t sg_comm_wait_any(sg_comm_t* comms, size_t count) +ssize_t sg_comm_wait_any(sg_comm_t* comms, size_t count) // XBT_ATTRIB_DEPRECATED_v339 { std::vector s4u_comms; for (size_t i = 0; i < count; i++) @@ -586,7 +586,7 @@ ssize_t sg_comm_wait_any(sg_comm_t* comms, size_t count) return pos; } -ssize_t sg_comm_wait_any_for(sg_comm_t* comms, size_t count, double timeout) +ssize_t sg_comm_wait_any_for(sg_comm_t* comms, size_t count, double timeout) // XBT_ATTRIB_DEPRECATED_v339 { std::vector s4u_comms; for (size_t i = 0; i < count; i++) diff --git a/src/s4u/s4u_Io.cpp b/src/s4u/s4u_Io.cpp index e8aa898590..c20e891862 100644 --- a/src/s4u/s4u_Io.cpp +++ b/src/s4u/s4u_Io.cpp @@ -95,7 +95,7 @@ Io* Io::do_start() return this; } -ssize_t Io::deprecated_wait_any_for(const std::vector& ios, double timeout) +ssize_t Io::deprecated_wait_any_for(const std::vector& ios, double timeout) // XBT_ATTRIB_DEPRECATED_v339 { ActivitySet set; for (const auto& io : ios) diff --git a/src/s4u/s4u_Netzone.cpp b/src/s4u/s4u_Netzone.cpp index 1917f0f658..b62e620f10 100644 --- a/src/s4u/s4u_Netzone.cpp +++ b/src/s4u/s4u_Netzone.cpp @@ -110,14 +110,14 @@ void NetZone::add_route(const NetZone* src, const NetZone* dst, const std::vecto void NetZone::add_route(kernel::routing::NetPoint* src, kernel::routing::NetPoint* dst, kernel::routing::NetPoint* gw_src, kernel::routing::NetPoint* gw_dst, - const std::vector& link_list, bool symmetrical) //XBT_ATTRIB_DEPRECATED_v339 + const std::vector& link_list, bool symmetrical) // XBT_ATTRIB_DEPRECATED_v339 { pimpl_->add_route(src, dst, gw_src, gw_dst, link_list, symmetrical); } void NetZone::add_route(kernel::routing::NetPoint* src, kernel::routing::NetPoint* dst, kernel::routing::NetPoint* gw_src, kernel::routing::NetPoint* gw_dst, - const std::vector& links) //XBT_ATTRIB_DEPRECATED_v339 + const std::vector& links) // XBT_ATTRIB_DEPRECATED_v339 { std::vector links_direct; std::vector links_reverse; diff --git a/src/s4u/s4u_VirtualMachine.cpp b/src/s4u/s4u_VirtualMachine.cpp index 9f6f7716ee..71a8f7a026 100644 --- a/src/s4u/s4u_VirtualMachine.cpp +++ b/src/s4u/s4u_VirtualMachine.cpp @@ -32,7 +32,8 @@ void VmHostExt::ensureVmExtInstalled() EXTENSION_ID = Host::extension_create(); } -VirtualMachine::VirtualMachine(const std::string& name, s4u::Host* physical_host, int core_amount, size_t ramsize) +VirtualMachine::VirtualMachine(const std::string& name, s4u::Host* physical_host, int core_amount, + size_t ramsize) // XBT_ATTRIB_DEPRECATED_v336 : Host(new kernel::resource::VirtualMachineImpl(name, this, physical_host, core_amount, ramsize)) , pimpl_vm_(dynamic_cast(Host::get_impl())) { -- 2.20.1 From 40ee10e13b61bfb28374d96ade010a262b5abd44 Mon Sep 17 00:00:00 2001 From: Arnaud Giersch Date: Tue, 21 Nov 2023 14:17:27 +0100 Subject: [PATCH 06/16] Update python/clusters-multicpu to the new API. --- examples/python/clusters-multicpu/clusters-multicpu.py | 8 +++----- src/bindings/python/simgrid_python.cpp | 2 +- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/examples/python/clusters-multicpu/clusters-multicpu.py b/examples/python/clusters-multicpu/clusters-multicpu.py index 0d6ff446ae..6a4d783a12 100644 --- a/examples/python/clusters-multicpu/clusters-multicpu.py +++ b/examples/python/clusters-multicpu/clusters-multicpu.py @@ -58,8 +58,7 @@ class Receiver: ##################################################################################################### -def create_hostzone(zone: simgrid.NetZone, coord: typing.List[int], ident: int) -> typing.Tuple[simgrid.NetPoint, - simgrid.NetPoint]: +def create_hostzone(zone: simgrid.NetZone, coord: typing.List[int], ident: int) -> simgrid.NetZone: r""" Callback to set a cluster leaf/element @@ -94,14 +93,13 @@ def create_hostzone(zone: simgrid.NetZone, coord: typing.List[int], ident: int) # setting my Torus parent zone host_zone.set_parent(zone) - gateway = None # create CPUs for i in range(num_cpus): cpu_name = hostname + "-cpu" + str(i) host = host_zone.create_host(cpu_name, speed).seal() # the first CPU is the gateway if i == 0: - gateway = host.netpoint + host_zone.set_gateway(host.netpoint) # create split-duplex link link = host_zone.create_split_duplex_link("link-" + cpu_name, link_bw) link.set_latency(link_lat).seal() @@ -110,7 +108,7 @@ def create_hostzone(zone: simgrid.NetZone, coord: typing.List[int], ident: int) # seal newly created netzone host_zone.seal() - return host_zone.netpoint, gateway + return host_zone ##################################################################################################### diff --git a/src/bindings/python/simgrid_python.cpp b/src/bindings/python/simgrid_python.cpp index 6d6f5c15ba..c06da841d5 100644 --- a/src/bindings/python/simgrid_python.cpp +++ b/src/bindings/python/simgrid_python.cpp @@ -309,7 +309,7 @@ PYBIND11_MODULE(simgrid, m) /* Class ClusterCallbacks */ py::class_(m, "ClusterCallbacks", "Callbacks used to create cluster zones") - .def(py::init&, + .def(py::init&, const std::function&, const std::function&>()); -- 2.20.1 From cb453ed529dc1fe67adcfe4f08b9111d8d2f436b Mon Sep 17 00:00:00 2001 From: Arnaud Giersch Date: Tue, 21 Nov 2023 14:27:03 +0100 Subject: [PATCH 07/16] Update MANIFEST.in. --- MANIFEST.in | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/MANIFEST.in b/MANIFEST.in index ec75cbf48f..a4b2546cc0 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -965,6 +965,7 @@ include teshsuite/smpi/macro-shared/macro-shared.c include teshsuite/smpi/macro-shared/macro-shared.tesh include teshsuite/smpi/mpich3-test/README include teshsuite/smpi/mpich3-test/attr/attr2type.c +include teshsuite/smpi/mpich3-test/attr/attrdelete.c include teshsuite/smpi/mpich3-test/attr/attrdeleteget.c include teshsuite/smpi/mpich3-test/attr/attrend.c include teshsuite/smpi/mpich3-test/attr/attrend2.c @@ -999,6 +1000,8 @@ include teshsuite/smpi/mpich3-test/coll/allred3.c include teshsuite/smpi/mpich3-test/coll/allred4.c include teshsuite/smpi/mpich3-test/coll/allred5.c include teshsuite/smpi/mpich3-test/coll/allred6.c +include teshsuite/smpi/mpich3-test/coll/allred_derived.c +include teshsuite/smpi/mpich3-test/coll/allred_float.c include teshsuite/smpi/mpich3-test/coll/allredmany.c include teshsuite/smpi/mpich3-test/coll/alltoall1.c include teshsuite/smpi/mpich3-test/coll/alltoallv.c @@ -1026,6 +1029,7 @@ include teshsuite/smpi/mpich3-test/coll/exscan2.c include teshsuite/smpi/mpich3-test/coll/gather.c include teshsuite/smpi/mpich3-test/coll/gather2.c include teshsuite/smpi/mpich3-test/coll/gather_big.c +include teshsuite/smpi/mpich3-test/coll/gatherv.c include teshsuite/smpi/mpich3-test/coll/iallred.c include teshsuite/smpi/mpich3-test/coll/ibarrier.c include teshsuite/smpi/mpich3-test/coll/icallgather.c @@ -1078,6 +1082,7 @@ include teshsuite/smpi/mpich3-test/coll/scatterv.c include teshsuite/smpi/mpich3-test/coll/testlist include teshsuite/smpi/mpich3-test/coll/uoplong.c include teshsuite/smpi/mpich3-test/comm/cmfree.c +include teshsuite/smpi/mpich3-test/comm/cmfree2.c include teshsuite/smpi/mpich3-test/comm/cmsplit.c include teshsuite/smpi/mpich3-test/comm/cmsplit2.c include teshsuite/smpi/mpich3-test/comm/cmsplit_type.c @@ -1094,6 +1099,7 @@ include teshsuite/smpi/mpich3-test/comm/comm_idup_mul.c include teshsuite/smpi/mpich3-test/comm/comm_idup_nb.c include teshsuite/smpi/mpich3-test/comm/comm_idup_overlap.c include teshsuite/smpi/mpich3-test/comm/comm_info.c +include teshsuite/smpi/mpich3-test/comm/comm_info2.c include teshsuite/smpi/mpich3-test/comm/commcreate1.c include teshsuite/smpi/mpich3-test/comm/commname.c include teshsuite/smpi/mpich3-test/comm/ctxalloc.c @@ -1425,21 +1431,28 @@ include teshsuite/smpi/mpich3-test/pt2pt/dtype_send.c include teshsuite/smpi/mpich3-test/pt2pt/eagerdt.c include teshsuite/smpi/mpich3-test/pt2pt/greq1.c include teshsuite/smpi/mpich3-test/pt2pt/huge_anysrc.c +include teshsuite/smpi/mpich3-test/pt2pt/huge_dupcomm.c +include teshsuite/smpi/mpich3-test/pt2pt/huge_ssend.c include teshsuite/smpi/mpich3-test/pt2pt/huge_underflow.c include teshsuite/smpi/mpich3-test/pt2pt/icsend.c include teshsuite/smpi/mpich3-test/pt2pt/inactivereq.c include teshsuite/smpi/mpich3-test/pt2pt/isendirecv.c +include teshsuite/smpi/mpich3-test/pt2pt/isendrecv.c +include teshsuite/smpi/mpich3-test/pt2pt/isendrecv_replace.c include teshsuite/smpi/mpich3-test/pt2pt/isendself.c include teshsuite/smpi/mpich3-test/pt2pt/isendselfprobe.c include teshsuite/smpi/mpich3-test/pt2pt/issendselfcancel.c include teshsuite/smpi/mpich3-test/pt2pt/large_message.c +include teshsuite/smpi/mpich3-test/pt2pt/large_tag.c include teshsuite/smpi/mpich3-test/pt2pt/many_isend.c include teshsuite/smpi/mpich3-test/pt2pt/manylmt.c include teshsuite/smpi/mpich3-test/pt2pt/mprobe.c +include teshsuite/smpi/mpich3-test/pt2pt/multi_psend_derived.c include teshsuite/smpi/mpich3-test/pt2pt/pingping.c include teshsuite/smpi/mpich3-test/pt2pt/probe-unexp.c include teshsuite/smpi/mpich3-test/pt2pt/probenull.c include teshsuite/smpi/mpich3-test/pt2pt/pscancel.c +include teshsuite/smpi/mpich3-test/pt2pt/pssend.c include teshsuite/smpi/mpich3-test/pt2pt/rcancel.c include teshsuite/smpi/mpich3-test/pt2pt/recv_any.c include teshsuite/smpi/mpich3-test/pt2pt/rqfreeb.c -- 2.20.1 From ab5814bd4ea6117ecf9ac2df328333e89eb45f5f Mon Sep 17 00:00:00 2001 From: Augustin Degomme Date: Wed, 22 Nov 2023 20:39:04 +0100 Subject: [PATCH 08/16] changelog update --- ChangeLog | 1 + 1 file changed, 1 insertion(+) diff --git a/ChangeLog b/ChangeLog index 1ef61d16df..b84988e6ff 100644 --- a/ChangeLog +++ b/ChangeLog @@ -39,6 +39,7 @@ SMPI: - New SMPI_app_instance_join(): wait for the completion of a started MPI instance - MPI_UNIVERSE_SIZE now initialized to the total amount of hosts in the platform - Memory usage due to SMPI for non-MPI actors greatly reduced. + - New implemented calls: MPI_Isendrecv, MPI_Isendrecv_replace sthread: - Allow to use on valgrind-observed or gdb-observed processes. -- 2.20.1 From 8be89720f55b4ceeb2877531ae1602cc7ed947d6 Mon Sep 17 00:00:00 2001 From: Martin Quinson Date: Thu, 23 Nov 2023 13:08:47 +0100 Subject: [PATCH 09/16] Properly register the waiter in wait_any_for(), so that it gets handled on suspend, failure or anything We all love fixing obscure bugs on release days. That's how we fail our release processes. --- src/kernel/activity/ActivityImpl.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/kernel/activity/ActivityImpl.cpp b/src/kernel/activity/ActivityImpl.cpp index 015ca2064b..f1a9859319 100644 --- a/src/kernel/activity/ActivityImpl.cpp +++ b/src/kernel/activity/ActivityImpl.cpp @@ -146,7 +146,7 @@ void ActivityImpl::wait_any_for(actor::ActorImpl* issuer, const std::vectorget_value(); idx != -1) { auto* act = activities.at(idx); - act->simcalls_.push_back(&issuer->simcall_); + act->register_simcall(&issuer->simcall_); observer->set_result(idx); act->set_state(State::DONE); act->finish(); @@ -168,7 +168,7 @@ void ActivityImpl::wait_any_for(actor::ActorImpl* issuer, const std::vectorsimcalls_.push_back(&issuer->simcall_); + act->register_simcall(&issuer->simcall_); /* see if the synchro is already finished */ if (act->get_state() != State::WAITING && act->get_state() != State::RUNNING) { act->finish(); -- 2.20.1 From 414839787a24ee470f3124f95659a5f6569a2cd5 Mon Sep 17 00:00:00 2001 From: Martin Quinson Date: Thu, 23 Nov 2023 23:51:02 +0100 Subject: [PATCH 10/16] More doc for SMPI --- docs/source/app_smpi.rst | 4 +++- src/smpi/colls/smpi_coll.cpp | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/docs/source/app_smpi.rst b/docs/source/app_smpi.rst index a168562f74..84bb4fc09d 100644 --- a/docs/source/app_smpi.rst +++ b/docs/source/app_smpi.rst @@ -618,7 +618,9 @@ Mixing S4U and MPI simulation Mixing both interfaces is very easy. This can be useful to easily implement a service in S4U that is provided by your infrastructure in some way, and test how your MPI application interacts with this service. Or you can use it to start more than -one MPI application in your simulation, and study their interactions. +one MPI application in your simulation, and study their interactions. For that, you just need to use +:cpp:ref:`SMPI_app_instance_register` in a regular S4U program, as shown in the example below. Compile it as usual (with gcc or +g++, **not** smpicc) and execute it directly (**not** with smpirun). .. doxygenfunction:: SMPI_app_instance_start diff --git a/src/smpi/colls/smpi_coll.cpp b/src/smpi/colls/smpi_coll.cpp index c2c0000c81..cf22e98031 100644 --- a/src/smpi/colls/smpi_coll.cpp +++ b/src/smpi/colls/smpi_coll.cpp @@ -284,7 +284,8 @@ static s_mpi_coll_description_t* find_coll_description(const std::string& collec std::string name_list = table->at(0).name; for (unsigned long i = 1; i < table->size(); i++) name_list = name_list + ", " + table->at(i).name; - xbt_die("Collective '%s' has no algorithm '%s'! Valid algorithms: %s.", collective.c_str(), algo.c_str(), name_list.c_str()); + xbt_die("Collective '%s' has no algorithm '%s'! Valid algorithms: %s. Please use --help-coll for details.", + collective.c_str(), algo.c_str(), name_list.c_str()); } int (*colls::gather)(const void* send_buff, int send_count, MPI_Datatype send_type, void* recv_buff, int recv_count, -- 2.20.1 From d68e1c39ec0832cb2391aedd17a868c597dd399e Mon Sep 17 00:00:00 2001 From: Martin Quinson Date: Fri, 24 Nov 2023 00:00:35 +0100 Subject: [PATCH 11/16] Release v3.35 --- CMakeLists.txt | 4 ++-- ChangeLog | 4 +++- NEWS | 4 +++- doc/doxygen/inside_release.doc | 2 +- docs/source/Release_Notes.rst | 4 ++-- docs/source/conf.py | 2 +- setup.py | 2 +- sonar-project.properties | 2 +- 8 files changed, 14 insertions(+), 10 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 80e106cfbe..aa272ace4a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,8 +1,8 @@ # Build the version number set(SIMGRID_VERSION_MAJOR "3") -set(SIMGRID_VERSION_MINOR "34") -set(SIMGRID_VERSION_PATCH "1") # odd => git branch; even => stable release or released snapshot +set(SIMGRID_VERSION_MINOR "35") +set(SIMGRID_VERSION_PATCH "0") # odd => git branch; even => stable release or released snapshot if(${SIMGRID_VERSION_PATCH} EQUAL "0") set(release_version "${SIMGRID_VERSION_MAJOR}.${SIMGRID_VERSION_MINOR}") diff --git a/ChangeLog b/ChangeLog index b84988e6ff..26a1e077c4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,6 @@ -SimGrid (3.34.1) not released (Target: fall 2023) +SimGrid (3.35) November 23. 2023 + +The "Thanks Giving up stateful model-checking" release. Stateless model checking remains. S4U: - New class ActivitySet to ease wait_any()/test_any()/wait_all() diff --git a/NEWS b/NEWS index 1ac203f9d6..92b6e770fc 100644 --- a/NEWS +++ b/NEWS @@ -3,7 +3,9 @@ __ _____ _ __ ___(_) ___ _ __ |___ / |___ / ___| \ \ / / _ \ '__/ __| |/ _ \| '_ \ |_ \ |_ \___ \ \ V / __/ | \__ \ | (_) | | | | ___) | ___) |__) | \_/ \___|_| |___/_|\___/|_| |_| |____(_)____/____/ - (not released yet) + November 23. 2023 + +The "Thanks Giving up stateful model-checking" release. Stateless model checking remains. * Maint: liveness checking is gone. It was fragile and buggy. * API: ActivitySet make it easier to manage sets of activities. diff --git a/doc/doxygen/inside_release.doc b/doc/doxygen/inside_release.doc index 65f20c0e98..43dbbdb2c9 100644 --- a/doc/doxygen/inside_release.doc +++ b/doc/doxygen/inside_release.doc @@ -14,7 +14,6 @@ Please apply the following checklist before releasing. - ChangeLog file - All changes are documented - The release date is indicated below the changes - - The release is marked as stable above the changes (remove the UNRELEASED marker) - The release dub name matches the one given in NEWS file - NEWS - The most notable changes of the version are documented @@ -35,6 +34,7 @@ Please apply the following checklist before releasing. @subsection inside_release_c_releasing Actually releasing SimGrid - Update the version number in: + - ChangeLog header - CMakeLists.txt (in macros SIMGRID_VERSION_*) - sonar-project.properties - docs/source/conf.py diff --git a/docs/source/Release_Notes.rst b/docs/source/Release_Notes.rst index 973cf6bc8d..553a2e5264 100644 --- a/docs/source/Release_Notes.rst +++ b/docs/source/Release_Notes.rst @@ -666,8 +666,8 @@ sthread can now also check concurrent accesses to a given collection, loosely in `_. This feature is not very usable yet, as you have to manually annotate your code, but we hope to improve it in the future. -Version 3.35 (TBD) ------------------- +Version 3.35 (November 23. 2023) +-------------------------------- **On the performance front**, we did some profiling and optimisation for this release. We saved some memory in simulation mixing MPI applications and S4U actors, and we greatly improved the performance of simulation exchanging many messages. We even diff --git a/docs/source/conf.py b/docs/source/conf.py index 7c553dec6c..c3d76300de 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -34,7 +34,7 @@ copyright = u'2002-2023, The SimGrid Team' author = u'The SimGrid Team' # The short X.Y version -version = u'3.34.1' +version = u'3.35' # -- General configuration --------------------------------------------------- diff --git a/setup.py b/setup.py index 37aa580d9a..122b1c8d22 100755 --- a/setup.py +++ b/setup.py @@ -74,7 +74,7 @@ class CMakeBuild(build_ext): setup( name='simgrid', - version='3.34.1', + version='3.35', author='Da SimGrid Team', author_email='simgrid-community@inria.fr', description='Toolkit for scalable simulation of distributed applications', diff --git a/sonar-project.properties b/sonar-project.properties index a6d28f5ce8..69ebaa1b69 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -4,7 +4,7 @@ sonar.organization=simgrid sonar.projectKey=simgrid_simgrid sonar.projectName=SimGrid -sonar.projectVersion=3.34.1 +sonar.projectVersion=3.35 sonar.links.homepage=https://simgrid.org sonar.links.issue=https://framagit.org/simgrid/simgrid/issues -- 2.20.1 From b1245e5ecc0f1eb4e2b76edac0004005e8c9a514 Mon Sep 17 00:00:00 2001 From: Martin Quinson Date: Sun, 26 Nov 2023 23:59:09 +0100 Subject: [PATCH 12/16] Post-release cleanups --- CMakeLists.txt | 2 +- COPYING | 9 +-------- ChangeLog | 5 +++++ NEWS | 9 +++++++++ doc/doxygen/inside_release.doc | 15 +++++++-------- docs/source/conf.py | 2 +- setup.py | 2 +- sonar-project.properties | 2 +- 8 files changed, 26 insertions(+), 20 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index aa272ace4a..6889a1299a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,7 +2,7 @@ set(SIMGRID_VERSION_MAJOR "3") set(SIMGRID_VERSION_MINOR "35") -set(SIMGRID_VERSION_PATCH "0") # odd => git branch; even => stable release or released snapshot +set(SIMGRID_VERSION_PATCH "1") # odd => git branch; even => stable release or released snapshot if(${SIMGRID_VERSION_PATCH} EQUAL "0") set(release_version "${SIMGRID_VERSION_MAJOR}.${SIMGRID_VERSION_MINOR}") diff --git a/COPYING b/COPYING index c178bb31af..e57fce0e62 100644 --- a/COPYING +++ b/COPYING @@ -11,13 +11,6 @@ Copyright: 1999, Mark Martinec Date: Mon, 27 Nov 2023 00:01:16 +0100 Subject: [PATCH 13/16] Kill an external dependency that was for stateful MC --- COPYING | 6 - MANIFEST.in | 1 - src/3rd-party/xxhash.hpp | 757 ------------------------------- tools/cmake/DefinePackages.cmake | 1 - tools/jenkins/Coverage.sh | 2 +- 5 files changed, 1 insertion(+), 766 deletions(-) delete mode 100644 src/3rd-party/xxhash.hpp diff --git a/COPYING b/COPYING index e57fce0e62..7a8526690a 100644 --- a/COPYING +++ b/COPYING @@ -177,12 +177,6 @@ Copyright: Comment: The MBI.py script was written for SimGrid while the other files are kept in sync with the MBI source tree. License: GPL-3 -Files: src/3rd-party/xxhash.hpp -Copyright: - Copyright (C) 2012-2018, Yann Collet. - Copyright (C) 2017-2018, Piotr Pliszka. -License: BSD 2-Clause - License: BSL-1.0 Permission is hereby granted, free of charge, to any person or organization obtaining a copy of the software and accompanying documentation covered by diff --git a/MANIFEST.in b/MANIFEST.in index a4b2546cc0..a7c5668748 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -2064,7 +2064,6 @@ include include/xbt/virtu.h include include/xbt/xbt_os_time.h include setup.py include src/3rd-party/catch.hpp -include src/3rd-party/xxhash.hpp include src/bindings/python/simgrid_python.cpp include src/dag/dax.dtd include src/dag/dax_dtd.c diff --git a/src/3rd-party/xxhash.hpp b/src/3rd-party/xxhash.hpp deleted file mode 100644 index a3dbe98912..0000000000 --- a/src/3rd-party/xxhash.hpp +++ /dev/null @@ -1,757 +0,0 @@ -#pragma once -#include -#include -#include -#include -#include -#include - -#include - -/* -xxHash - Extremely Fast Hash algorithm -Header File -Copyright (C) 2012-2018, Yann Collet. -Copyright (C) 2017-2018, Piotr Pliszka. -All rights reserved. - -BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: -* Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. -* Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -You can contact the author at : -- xxHash source repository : https://github.com/Cyan4973/xxHash -- xxHash C++ port repository : https://github.com/RedSpah/xxhash_cpp -*/ - -/* ************************************* - * Tuning parameters - ***************************************/ -/*!XXH_FORCE_MEMORY_ACCESS : - * By default, access to unaligned memory is controlled by `memcpy()`, which is safe and portable. - * Unfortunately, on some target/compiler combinations, the generated assembly is sub-optimal. - * The below switch allow to select different access method for improved performance. - * Method 0 (default) : use `memcpy()`. Safe and portable. - * Method 1 : `__packed` statement. It depends on compiler extension (ie, not portable). - * This method is safe if your compiler supports it, and *generally* as fast or faster than `memcpy`. - * Method 2 : direct access. This method doesn't depend on compiler but violate C standard. - * It can generate buggy code on targets which do not support unaligned memory accesses. - * But in some circumstances, it's the only known way to get the most performance (ie GCC + ARMv6) - * See http://stackoverflow.com/a/32095106/646947 for details. - * Prefer these methods in priority order (0 > 1 > 2) - */ -#ifndef XXH_FORCE_MEMORY_ACCESS /* can be defined externally, on command line for example */ -#if defined(__GNUC__) && (defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) || defined(__ARM_ARCH_6K__) || \ - defined(__ARM_ARCH_6Z__) || defined(__ARM_ARCH_6ZK__) || defined(__ARM_ARCH_6T2__)) -#define XXH_FORCE_MEMORY_ACCESS 2 -#elif defined(__INTEL_COMPILER) || \ - (defined(__GNUC__) && (defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) || defined(__ARM_ARCH_7R__) || \ - defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7S__))) -#define XXH_FORCE_MEMORY_ACCESS 1 -#endif -#endif - -/*!XXH_FORCE_NATIVE_FORMAT : - * By default, xxHash library provides endian-independent Hash values, based on little-endian convention. - * Results are therefore identical for little-endian and big-endian CPU. - * This comes at a performance cost for big-endian CPU, since some swapping is required to emulate little-endian format. - * Should endian-independence be of no importance for your application, you may set the #define below to 1, - * to improve speed for Big-endian CPU. - * This option has no impact on Little_Endian CPU. - */ -#if !defined(XXH_FORCE_NATIVE_FORMAT) || (XXH_FORCE_NATIVE_FORMAT == 0) /* can be defined externally */ -#define XXH_FORCE_NATIVE_FORMAT 0 -#define XXH_CPU_LITTLE_ENDIAN 1 -#endif - -/*!XXH_FORCE_ALIGN_CHECK : - * This is a minor performance trick, only useful with lots of very small keys. - * It means : check for aligned/unaligned input. - * The check costs one initial branch per hash; - * set it to 0 when the input is guaranteed to be aligned, - * or when alignment doesn't matter for performance. - */ -#ifndef XXH_FORCE_ALIGN_CHECK /* can be defined externally */ -#if defined(__i386) || defined(_M_IX86) || defined(__x86_64__) || defined(_M_X64) -#define XXH_FORCE_ALIGN_CHECK 0 -#else -#define XXH_FORCE_ALIGN_CHECK 1 -#endif -#endif - -/*!XXH_CPU_LITTLE_ENDIAN : - * This is a CPU endian detection macro, will be - * automatically set to 1 (little endian) if XXH_FORCE_NATIVE_FORMAT - * is left undefined, XXH_FORCE_NATIVE_FORMAT is defined to 0, or if an x86/x86_64 compiler macro is defined. - * If left undefined, endianness will be determined at runtime, at the cost of a slight one-time overhead - * and a larger overhead due to get_endian() not being constexpr. - */ -#ifndef XXH_CPU_LITTLE_ENDIAN -#if defined(__i386) || defined(_M_IX86) || defined(__x86_64__) || defined(_M_X64) -#define XXH_CPU_LITTLE_ENDIAN 1 -#endif -#endif - -/* ************************************* - * Compiler Specific Options - ***************************************/ -#define XXH_GCC_VERSION (__GNUC__ * 100 + __GNUC_MINOR__) - -namespace xxh { -/* ************************************* - * Version - ***************************************/ -constexpr int cpp_version_major = 0; -constexpr int cpp_version_minor = 6; -constexpr int cpp_version_release = 5; -constexpr uint32_t version_number() -{ - return cpp_version_major * 10000 + cpp_version_minor * 100 + cpp_version_release; -} - -namespace hash_t_impl { -/* ************************************* - * Basic Types - Detail - ***************************************/ - -using _hash32_underlying = uint32_t; -using _hash64_underlying = uint64_t; - -template struct hash_type { - using type = void; -}; -template <> struct hash_type<32> { - using type = _hash32_underlying; -}; -template <> struct hash_type<64> { - using type = _hash64_underlying; -}; -} // namespace hash_t_impl - -/* ************************************* - * Basic Types - Public - ***************************************/ - -template using hash_t = typename hash_t_impl::hash_type::type; -using hash32_t = hash_t<32>; -using hash64_t = hash_t<64>; - -/* ************************************* - * Bit Functions - Public - ***************************************/ - -namespace bit_ops { -/* **************************************** - * Intrinsics and Bit Operations - ******************************************/ - -#if defined(_MSC_VER) -inline uint32_t rotl32(uint32_t x, int32_t r) -{ - return _rotl(x, r); -} -inline uint64_t rotl64(uint64_t x, int32_t r) -{ - return _rotl64(x, r); -} -#else -inline uint32_t rotl32(uint32_t x, int32_t r) -{ - return ((x << r) | (x >> (32 - r))); -} -inline uint64_t rotl64(uint64_t x, int32_t r) -{ - return ((x << r) | (x >> (64 - r))); -} -#endif - -#if defined(_MSC_VER) /* Visual Studio */ -inline uint32_t swap32(uint32_t x) -{ - return _byteswap_ulong(x); -} -inline uint64_t swap64(uint64_t x) -{ - return _byteswap_uint64(x); -} -#elif XXH_GCC_VERSION >= 403 -inline uint32_t swap32(uint32_t x) -{ - return __builtin_bswap32(x); -} -inline uint64_t swap64(uint64_t x) -{ - return __builtin_bswap64(x); -} -#else -inline uint32_t swap32(uint32_t x) -{ - return ((x << 24) & 0xff000000) | ((x << 8) & 0x00ff0000) | ((x >> 8) & 0x0000ff00) | ((x >> 24) & 0x000000ff); -} -inline uint64_t swap64(uint64_t x) -{ - return ((x << 56) & 0xff00000000000000ULL) | ((x << 40) & 0x00ff000000000000ULL) | - ((x << 24) & 0x0000ff0000000000ULL) | ((x << 8) & 0x000000ff00000000ULL) | ((x >> 8) & 0x00000000ff000000ULL) | - ((x >> 24) & 0x0000000000ff0000ULL) | ((x >> 40) & 0x000000000000ff00ULL) | - ((x >> 56) & 0x00000000000000ffULL); -} -#endif -template inline hash_t rotl(hash_t n, int32_t r){}; - -template <> inline hash_t<32> rotl<32>(hash_t<32> n, int32_t r) -{ - return rotl32(n, r); -}; - -template <> inline hash_t<64> rotl<64>(hash_t<64> n, int32_t r) -{ - return rotl64(n, r); -}; - -template inline hash_t swap(hash_t n){}; - -template <> inline hash_t<32> swap<32>(hash_t<32> n) -{ - return swap32(n); -}; - -template <> inline hash_t<64> swap<64>(hash_t<64> n) -{ - return swap64(n); -}; -} // namespace bit_ops - -/* ************************************* - * Memory Functions - Public - ***************************************/ - -enum class alignment : uint8_t { aligned, unaligned }; -enum class endianness : uint8_t { big_endian = 0, little_endian = 1, unspecified = 2 }; - -namespace mem_ops { -/* ************************************* - * Memory Access - ***************************************/ -#if (defined(XXH_FORCE_MEMORY_ACCESS) && (XXH_FORCE_MEMORY_ACCESS == 2)) - -/* Force direct memory access. Only works on CPU which support unaligned memory access in hardware */ -template inline hash_t read_unaligned(const void* memPtr) -{ - return *(const hash_t*)memPtr; -} - -#elif (defined(XXH_FORCE_MEMORY_ACCESS) && (XXH_FORCE_MEMORY_ACCESS == 1)) - -/* __pack instructions are safer, but compiler specific, hence potentially problematic for some compilers */ -/* currently only defined for gcc and icc */ -template using unalign = union { - hash_t uval; -} __attribute((packed)); - -template inline hash_t read_unaligned(const void* memPtr) -{ - return ((const unalign*)memPtr)->uval; -} -#else - -/* portable and safe solution. Generally efficient. - * see : http://stackoverflow.com/a/32095106/646947 - */ -template inline hash_t read_unaligned(const void* memPtr) -{ - hash_t val; - memcpy(&val, memPtr, sizeof(val)); - return val; -} - -#endif /* XXH_FORCE_DIRECT_MEMORY_ACCESS */ - -inline hash_t<32> read32(const void* memPtr) -{ - return read_unaligned<32>(memPtr); -} -inline hash_t<64> read64(const void* memPtr) -{ - return read_unaligned<64>(memPtr); -} - -/* ************************************* - * Architecture Macros - ***************************************/ - -/* XXH_CPU_LITTLE_ENDIAN can be defined externally, for example on the compiler command line */ - -#ifndef XXH_CPU_LITTLE_ENDIAN - -inline endianness get_endian(endianness endian) -{ - static struct _dummy_t { - std::array endian_lookup = {endianness::big_endian, endianness::little_endian, - endianness::unspecified}; - const int g_one = 1; - _dummy_t() { endian_lookup[2] = static_cast(*(const char*)(&g_one)); } - } _dummy; - - return _dummy.endian_lookup[(uint8_t)endian]; -} - -inline bool is_little_endian() -{ - return get_endian(endianness::unspecified) == endianness::little_endian; -} - -#else -constexpr endianness get_endian(endianness endian) -{ - constexpr std::array endian_lookup = { - {endianness::big_endian, endianness::little_endian, - (XXH_CPU_LITTLE_ENDIAN) ? endianness::little_endian : endianness::big_endian}}; - return endian_lookup[static_cast(endian)]; -} - -constexpr bool is_little_endian() -{ - return get_endian(endianness::unspecified) == endianness::little_endian; -} - -#endif - -/* *************************** - * Memory reads - *****************************/ - -template inline hash_t readLE_align(const void* ptr, endianness endian, alignment align) -{ - if (align == alignment::unaligned) { - return endian == endianness::little_endian ? read_unaligned(ptr) : bit_ops::swap(read_unaligned(ptr)); - } else { - return endian == endianness::little_endian ? *reinterpret_cast*>(ptr) - : bit_ops::swap(*reinterpret_cast*>(ptr)); - } -} - -template inline hash_t readLE(const void* ptr, endianness endian) -{ - return readLE_align(ptr, endian, alignment::unaligned); -} - -template inline hash_t readBE(const void* ptr) -{ - return is_little_endian() ? bit_ops::swap(read_unaligned(ptr)) : read_unaligned(ptr); -} - -template inline alignment get_alignment(const void* input) -{ - return ((XXH_FORCE_ALIGN_CHECK) && ((reinterpret_cast(input) & ((N / 8) - 1)) == 0)) - ? xxh::alignment::aligned - : xxh::alignment::unaligned; -} -} // namespace mem_ops - -/* ******************************************************************* - * Hash functions - *********************************************************************/ - -namespace detail { -/* ******************************************************************* - * Hash functions - Implementation - *********************************************************************/ - -constexpr static std::array primes32 = {{2654435761U, 2246822519U, 3266489917U, 668265263U, 374761393U}}; -constexpr static std::array primes64 = {{11400714785074694791ULL, 14029467366897019727ULL, - 1609587929392839161ULL, 9650029242287828579ULL, - 2870177450012600261ULL}}; - -template constexpr hash_t PRIME(int32_t n){}; - -template <> constexpr hash32_t PRIME<32>(int32_t n) -{ - return primes32[n - 1]; -} - -template <> constexpr hash64_t PRIME<64>(int32_t n) -{ - return primes64[n - 1]; -} - -template inline hash_t round(hash_t seed, hash_t input) -{ - seed += input * PRIME(2); - seed = bit_ops::rotl(seed, ((N == 32) ? 13 : 31)); - seed *= PRIME(1); - return seed; -} - -inline hash64_t mergeRound64(hash64_t acc, hash64_t val) -{ - val = round<64>(0, val); - acc ^= val; - acc = acc * PRIME<64>(1) + PRIME<64>(4); - return acc; -} - -template -inline void endian_align_sub_mergeround( -#if __cplusplus < 201703L - __attribute__((unused)) -#else - [[maybe_unused]] -#endif - hash_t& hash_ret, - hash_t v1, hash_t v2, hash_t v3, hash_t v4){}; - -template <> -inline void endian_align_sub_mergeround<64>(hash_t<64>& hash_ret, hash_t<64> v1, hash_t<64> v2, hash_t<64> v3, - hash_t<64> v4) -{ - hash_ret = mergeRound64(hash_ret, v1); - hash_ret = mergeRound64(hash_ret, v2); - hash_ret = mergeRound64(hash_ret, v3); - hash_ret = mergeRound64(hash_ret, v4); -} - -template -inline hash_t endian_align_sub_ending(hash_t hash_ret, const uint8_t* p, const uint8_t* bEnd, - xxh::endianness endian, xxh::alignment align){}; - -template <> -inline hash_t<32> endian_align_sub_ending<32>(hash_t<32> hash_ret, const uint8_t* p, const uint8_t* bEnd, - xxh::endianness endian, xxh::alignment align) -{ - while ((p + 4) <= bEnd) { - hash_ret += mem_ops::readLE_align<32>(p, endian, align) * PRIME<32>(3); - hash_ret = bit_ops::rotl<32>(hash_ret, 17) * PRIME<32>(4); - p += 4; - } - - while (p < bEnd) { - hash_ret += (*p) * PRIME<32>(5); - hash_ret = bit_ops::rotl<32>(hash_ret, 11) * PRIME<32>(1); - p++; - } - - hash_ret ^= hash_ret >> 15; - hash_ret *= PRIME<32>(2); - hash_ret ^= hash_ret >> 13; - hash_ret *= PRIME<32>(3); - hash_ret ^= hash_ret >> 16; - - return hash_ret; -} - -template <> -inline hash_t<64> endian_align_sub_ending<64>(hash_t<64> hash_ret, const uint8_t* p, const uint8_t* bEnd, - xxh::endianness endian, xxh::alignment align) -{ - while (p + 8 <= bEnd) { - const hash64_t k1 = round<64>(0, mem_ops::readLE_align<64>(p, endian, align)); - hash_ret ^= k1; - hash_ret = bit_ops::rotl<64>(hash_ret, 27) * PRIME<64>(1) + PRIME<64>(4); - p += 8; - } - - if (p + 4 <= bEnd) { - hash_ret ^= static_cast(mem_ops::readLE_align<32>(p, endian, align)) * PRIME<64>(1); - hash_ret = bit_ops::rotl<64>(hash_ret, 23) * PRIME<64>(2) + PRIME<64>(3); - p += 4; - } - - while (p < bEnd) { - hash_ret ^= (*p) * PRIME<64>(5); - hash_ret = bit_ops::rotl<64>(hash_ret, 11) * PRIME<64>(1); - p++; - } - - hash_ret ^= hash_ret >> 33; - hash_ret *= PRIME<64>(2); - hash_ret ^= hash_ret >> 29; - hash_ret *= PRIME<64>(3); - hash_ret ^= hash_ret >> 32; - - return hash_ret; -} - -template -inline hash_t endian_align(const void* input, size_t len, hash_t seed, xxh::endianness endian, - xxh::alignment align) -{ - static_assert(!(N != 32 && N != 64), "You can only call endian_align in 32 or 64 bit mode."); - - const uint8_t* p = static_cast(input); - const uint8_t* bEnd = p + len; - hash_t hash_ret; - - if (len >= (N / 2)) { - const uint8_t* const limit = bEnd - (N / 2); - hash_t v1 = seed + PRIME(1) + PRIME(2); - hash_t v2 = seed + PRIME(2); - hash_t v3 = seed + 0; - hash_t v4 = seed - PRIME(1); - - do { - v1 = round(v1, mem_ops::readLE_align(p, endian, align)); - p += (N / 8); - v2 = round(v2, mem_ops::readLE_align(p, endian, align)); - p += (N / 8); - v3 = round(v3, mem_ops::readLE_align(p, endian, align)); - p += (N / 8); - v4 = round(v4, mem_ops::readLE_align(p, endian, align)); - p += (N / 8); - } while (p <= limit); - - hash_ret = bit_ops::rotl(v1, 1) + bit_ops::rotl(v2, 7) + bit_ops::rotl(v3, 12) + bit_ops::rotl(v4, 18); - - endian_align_sub_mergeround(hash_ret, v1, v2, v3, v4); - } else { - hash_ret = seed + PRIME(5); - } - - hash_ret += static_cast>(len); - - return endian_align_sub_ending(hash_ret, p, bEnd, endian, align); -} -} // namespace detail - -template -hash_t xxhash(const void* input, size_t len, hash_t seed = 0, endianness endian = endianness::unspecified) -{ - static_assert(!(N != 32 && N != 64), "You can only call xxhash in 32 or 64 bit mode."); - return detail::endian_align(input, len, seed, mem_ops::get_endian(endian), mem_ops::get_alignment(input)); -} - -template -hash_t xxhash(const std::basic_string& input, hash_t seed = 0, endianness endian = endianness::unspecified) -{ - static_assert(!(N != 32 && N != 64), "You can only call xxhash in 32 or 64 bit mode."); - return detail::endian_align(static_cast(input.data()), input.length() * sizeof(T), seed, - mem_ops::get_endian(endian), - mem_ops::get_alignment(static_cast(input.data()))); -} - -template -hash_t xxhash(ContiguousIterator begin, ContiguousIterator end, hash_t seed = 0, - endianness endian = endianness::unspecified) -{ - static_assert(!(N != 32 && N != 64), "You can only call xxhash in 32 or 64 bit mode."); - using T = typename std::decay_t; - return detail::endian_align(static_cast(&*begin), (end - begin) * sizeof(T), seed, - mem_ops::get_endian(endian), - mem_ops::get_alignment(static_cast(&*begin))); -} - -template -hash_t xxhash(const std::vector& input, hash_t seed = 0, endianness endian = endianness::unspecified) -{ - static_assert(!(N != 32 && N != 64), "You can only call xxhash in 32 or 64 bit mode."); - return detail::endian_align(static_cast(input.data()), input.size() * sizeof(T), seed, - mem_ops::get_endian(endian), - mem_ops::get_alignment(static_cast(input.data()))); -} - -template -hash_t xxhash(const std::array& input, hash_t seed = 0, endianness endian = endianness::unspecified) -{ - static_assert(!(N != 32 && N != 64), "You can only call xxhash in 32 or 64 bit mode."); - return detail::endian_align(static_cast(input.data()), AN * sizeof(T), seed, - mem_ops::get_endian(endian), - mem_ops::get_alignment(static_cast(input.data()))); -} - -template -hash_t xxhash(const std::initializer_list& input, hash_t seed = 0, endianness endian = endianness::unspecified) -{ - static_assert(!(N != 32 && N != 64), "You can only call xxhash in 32 or 64 bit mode."); - return detail::endian_align(static_cast(input.begin()), input.size() * sizeof(T), seed, - mem_ops::get_endian(endian), - mem_ops::get_alignment(static_cast(input.begin()))); -} - -/* ******************************************************************* - * Hash streaming - *********************************************************************/ -enum class error_code : uint8_t { ok = 0, error }; - -template class hash_state_t { - uint64_t total_len = 0; - hash_t v1 = 0, v2 = 0, v3 = 0, v4 = 0; - std::array, 4> mem = {{0, 0, 0, 0}}; - uint32_t memsize = 0; - - inline error_code _update_impl(const void* input, size_t length, endianness endian) - { - const uint8_t* p = reinterpret_cast(input); - const uint8_t* const bEnd = p + length; - - if (!input) { - return xxh::error_code::error; - } - - total_len += length; - - if (memsize + length < (N / 2)) { /* fill in tmp buffer */ - memcpy(reinterpret_cast(mem.data()) + memsize, input, length); - memsize += static_cast(length); - return error_code::ok; - } - - if (memsize) { /* some data left from previous update */ - memcpy(reinterpret_cast(mem.data()) + memsize, input, (N / 2) - memsize); - - const hash_t* ptr = mem.data(); - v1 = detail::round(v1, mem_ops::readLE(ptr, endian)); - ptr++; - v2 = detail::round(v2, mem_ops::readLE(ptr, endian)); - ptr++; - v3 = detail::round(v3, mem_ops::readLE(ptr, endian)); - ptr++; - v4 = detail::round(v4, mem_ops::readLE(ptr, endian)); - - p += (N / 2) - memsize; - memsize = 0; - } - - if (p <= bEnd - (N / 2)) { - const uint8_t* const limit = bEnd - (N / 2); - - do { - v1 = detail::round(v1, mem_ops::readLE(p, endian)); - p += (N / 8); - v2 = detail::round(v2, mem_ops::readLE(p, endian)); - p += (N / 8); - v3 = detail::round(v3, mem_ops::readLE(p, endian)); - p += (N / 8); - v4 = detail::round(v4, mem_ops::readLE(p, endian)); - p += (N / 8); - } while (p <= limit); - } - - if (p < bEnd) { - memcpy(mem.data(), p, static_cast(bEnd - p)); - memsize = static_cast(bEnd - p); - } - - return error_code::ok; - } - - inline hash_t _digest_impl(endianness endian) const - { - const uint8_t* p = reinterpret_cast(mem.data()); - const uint8_t* const bEnd = reinterpret_cast(mem.data()) + memsize; - hash_t hash_ret; - - if (total_len > (N / 2)) { - hash_ret = - bit_ops::rotl(v1, 1) + bit_ops::rotl(v2, 7) + bit_ops::rotl(v3, 12) + bit_ops::rotl(v4, 18); - - detail::endian_align_sub_mergeround(hash_ret, v1, v2, v3, v4); - } else { - hash_ret = v3 + detail::PRIME(5); - } - - hash_ret += static_cast>(total_len); - - return detail::endian_align_sub_ending(hash_ret, p, bEnd, endian, alignment::unaligned); - } - -public: - hash_state_t(hash_t seed = 0) - { - static_assert(!(N != 32 && N != 64), "You can only stream hashing in 32 or 64 bit mode."); - v1 = seed + detail::PRIME(1) + detail::PRIME(2); - v2 = seed + detail::PRIME(2); - v3 = seed + 0; - v4 = seed - detail::PRIME(1); - }; - - hash_state_t operator=(hash_state_t& other) { memcpy(this, other, sizeof(hash_state_t)); } - - error_code reset(hash_t seed = 0) - { - memset(this, 0, sizeof(hash_state_t)); - v1 = seed + detail::PRIME(1) + detail::PRIME(2); - v2 = seed + detail::PRIME(2); - v3 = seed + 0; - v4 = seed - detail::PRIME(1); - return error_code::ok; - } - - error_code update(const void* input, size_t length, endianness endian = endianness::unspecified) - { - return _update_impl(input, length, mem_ops::get_endian(endian)); - } - - template - error_code update(const std::basic_string& input, endianness endian = endianness::unspecified) - { - return _update_impl(static_cast(input.data()), input.length() * sizeof(T), - mem_ops::get_endian(endian)); - } - - template - error_code update(ContiguousIterator begin, ContiguousIterator end, endianness endian = endianness::unspecified) - { - using T = typename std::decay_t; - return _update_impl(static_cast(&*begin), (end - begin) * sizeof(T), mem_ops::get_endian(endian)); - } - - template error_code update(const std::vector& input, endianness endian = endianness::unspecified) - { - return _update_impl(static_cast(input.data()), input.size() * sizeof(T), mem_ops::get_endian(endian)); - } - - template - error_code update(const std::array& input, endianness endian = endianness::unspecified) - { - return _update_impl(static_cast(input.data()), AN * sizeof(T), mem_ops::get_endian(endian)); - } - - template - error_code update(const std::initializer_list& input, endianness endian = endianness::unspecified) - { - return _update_impl(static_cast(input.begin()), input.size() * sizeof(T), mem_ops::get_endian(endian)); - } - - hash_t digest(endianness endian = endianness::unspecified) { return _digest_impl(mem_ops::get_endian(endian)); } -}; - -using hash_state32_t = hash_state_t<32>; -using hash_state64_t = hash_state_t<64>; - -/* ******************************************************************* - * Canonical - *********************************************************************/ - -template struct canonical_t { - std::array digest; - - canonical_t(hash_t hash) - { - if (mem_ops::is_little_endian()) { - hash = bit_ops::swap(hash); - } - memcpy(digest.data(), &hash, sizeof(canonical_t)); - } - - hash_t get_hash() const { return mem_ops::readBE(&digest); } -}; - -using canonical32_t = canonical_t<32>; -using canonical64_t = canonical_t<64>; -} // namespace xxh diff --git a/tools/cmake/DefinePackages.cmake b/tools/cmake/DefinePackages.cmake index c28b7aa134..06c190e41a 100644 --- a/tools/cmake/DefinePackages.cmake +++ b/tools/cmake/DefinePackages.cmake @@ -2,7 +2,6 @@ set(EXTRA_DIST src/3rd-party/catch.hpp - src/3rd-party/xxhash.hpp src/bindings/python/simgrid_python.cpp src/dag/dax.dtd src/dag/dax_dtd.c diff --git a/tools/jenkins/Coverage.sh b/tools/jenkins/Coverage.sh index 0e374b0976..39fde22018 100755 --- a/tools/jenkins/Coverage.sh +++ b/tools/jenkins/Coverage.sh @@ -96,7 +96,7 @@ if [ -f Testing/TAG ] ; then sloccount --duplicates --wide --details "$WORKSPACE" | grep -v -e '.git' -e 'mpich3-test' -e 'sloccount.sc' -e 'build/' -e 'xml_coverage.xml' -e 'CTestResults_memcheck.xml' -e 'DynamicAnalysis.xml' > "$WORKSPACE"/sloccount.sc #generate PVS-studio report - EXCLUDEDPATH="-e $WORKSPACE/src/3rd-party/catch.hpp -e $WORKSPACE/src/3rd-party/xxhash.hpp -e $WORKSPACE/teshsuite/smpi/mpich3-test/ -e *_dtd.c -e *_dtd.h -e *.yy.c -e *.tab.cacc -e *.tab.hacc -e $WORKSPACE/src/smpi/colls/ -e $WORKSPACE/examples/smpi/NAS/ -e $WORKSPACE/examples/smpi/gemm/gemm.cq" + EXCLUDEDPATH="-e $WORKSPACE/src/3rd-party/catch.hpp -e $WORKSPACE/teshsuite/smpi/mpich3-test/ -e *_dtd.c -e *_dtd.h -e *.yy.c -e *.tab.cacc -e *.tab.hacc -e $WORKSPACE/src/smpi/colls/ -e $WORKSPACE/examples/smpi/NAS/ -e $WORKSPACE/examples/smpi/gemm/gemm.cq" pvs-studio-analyzer analyze -f "$BUILDFOLDER"/compile_commands.json -o "$WORKSPACE"/pvs.log $EXCLUDEDPATH -j$NUMPROC # Disable: # V521 Such expressions using the ',' operator are dangerous. (-> commas in catch.hpp), -- 2.20.1 From 978c69bf0a49adab13df9ba6dabcd0998485030b Mon Sep 17 00:00:00 2001 From: Arnaud Giersch Date: Mon, 27 Nov 2023 09:41:25 +0100 Subject: [PATCH 14/16] Remove deprecated features for next release (3.36). --- docs/source/Doxyfile | 1 - include/simgrid/s4u/NetZone.hpp | 7 +++---- include/simgrid/s4u/VirtualMachine.hpp | 5 ----- include/xbt/base.h | 2 -- src/bindings/python/simgrid_python.cpp | 12 ------------ src/s4u/s4u_VirtualMachine.cpp | 8 -------- 6 files changed, 3 insertions(+), 32 deletions(-) diff --git a/docs/source/Doxyfile b/docs/source/Doxyfile index 30041d4a6b..80b57e9e9d 100644 --- a/docs/source/Doxyfile +++ b/docs/source/Doxyfile @@ -68,6 +68,5 @@ PREDEFINED += \ XBT_ATTRIB_NORETURN= \ XBT_ATTRIB_UNUSED= \ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(cname,parent,desc)= \ - XBT_ATTRIB_DEPRECATED_v336(mesg)= \ XBT_ATTRIB_DEPRECATED_v338(mesg)= \ XBT_ATTRIB_DEPRECATED_v339(mesg)= diff --git a/include/simgrid/s4u/NetZone.hpp b/include/simgrid/s4u/NetZone.hpp index ab535fa289..68052708a5 100644 --- a/include/simgrid/s4u/NetZone.hpp +++ b/include/simgrid/s4u/NetZone.hpp @@ -104,10 +104,9 @@ public: * @param link_list List of links and their direction used in this communication * @param symmetrical Bi-directional communication */ - //(we should first remove the Python binding in v3.35) XBT_ATTRIB_DEPRECATED_v339("Please call add_route either from - // Host to Host or NetZone to NetZone") - void add_route(kernel::routing::NetPoint* src, kernel::routing::NetPoint* dst, kernel::routing::NetPoint* gw_src, - kernel::routing::NetPoint* gw_dst, const std::vector& link_list, bool symmetrical = true); + XBT_ATTRIB_DEPRECATED_v339("Please call add_route either from Host to Host or NetZone to NetZone") void add_route( + kernel::routing::NetPoint* src, kernel::routing::NetPoint* dst, kernel::routing::NetPoint* gw_src, + kernel::routing::NetPoint* gw_dst, const std::vector& link_list, bool symmetrical = true); /** * @brief Add a route between 2 netpoints, and same in other direction * diff --git a/include/simgrid/s4u/VirtualMachine.hpp b/include/simgrid/s4u/VirtualMachine.hpp index 6733ba3784..b26902226d 100644 --- a/include/simgrid/s4u/VirtualMachine.hpp +++ b/include/simgrid/s4u/VirtualMachine.hpp @@ -59,11 +59,6 @@ class XBT_PUBLIC VirtualMachine : public s4u::Host { #endif public: - XBT_ATTRIB_DEPRECATED_v336("Please use s4u::Host::create_vm") explicit VirtualMachine(const std::string& name, - Host* physical_host, - int core_amount, - size_t ramsize = 1024); - #ifndef DOXYGEN // No copy/move VirtualMachine(VirtualMachine const&) = delete; diff --git a/include/xbt/base.h b/include/xbt/base.h index a4c062d80e..080c784e78 100644 --- a/include/xbt/base.h +++ b/include/xbt/base.h @@ -42,8 +42,6 @@ #define XBT_ATTRIB_DEPRECATED(mesg) __attribute__((deprecated(mesg))) #endif -#define XBT_ATTRIB_DEPRECATED_v336(mesg) \ - XBT_ATTRIB_DEPRECATED(mesg " (this compatibility wrapper will be dropped after v3.35)") #define XBT_ATTRIB_DEPRECATED_v338(mesg) \ XBT_ATTRIB_DEPRECATED(mesg " (this compatibility wrapper will be dropped after v3.37)") #define XBT_ATTRIB_DEPRECATED_v339(mesg) \ diff --git a/src/bindings/python/simgrid_python.cpp b/src/bindings/python/simgrid_python.cpp index c06da841d5..d00494965a 100644 --- a/src/bindings/python/simgrid_python.cpp +++ b/src/bindings/python/simgrid_python.cpp @@ -235,18 +235,6 @@ PYBIND11_MODULE(simgrid, m) .def_static("create_vivaldi_zone", &simgrid::s4u::create_vivaldi_zone, "Creates a zone of type Vivaldi") .def_static("create_empty_zone", &simgrid::s4u::create_empty_zone, "Creates a zone of type Empty") .def_static("create_wifi_zone", &simgrid::s4u::create_wifi_zone, "Creates a zone of type Wi-Fi") - .def("add_route", - [](simgrid::s4u::NetZone* self, simgrid::kernel::routing::NetPoint* src, - simgrid::kernel::routing::NetPoint* dst, simgrid::kernel::routing::NetPoint* gw_src, - simgrid::kernel::routing::NetPoint* gw_dst, const std::vector& links, - bool symmetrical) { - PyErr_WarnEx(PyExc_DeprecationWarning, // XBT_ATTRIB_DEPRECATED_v336. Once removed, uncomment the - // deprecation of the AddRoute function in C++ - "Please call add_route either from Host to Host or NetZone to NetZone. This call will be " - "removed after SimGrid v3.35.", - 1); - self->add_route(src, dst, gw_src, gw_dst, links, symmetrical); - }) .def("add_route", py::overload_cast&, bool>(&simgrid::s4u::NetZone::add_route), diff --git a/src/s4u/s4u_VirtualMachine.cpp b/src/s4u/s4u_VirtualMachine.cpp index 71a8f7a026..415b1f7d99 100644 --- a/src/s4u/s4u_VirtualMachine.cpp +++ b/src/s4u/s4u_VirtualMachine.cpp @@ -32,14 +32,6 @@ void VmHostExt::ensureVmExtInstalled() EXTENSION_ID = Host::extension_create(); } -VirtualMachine::VirtualMachine(const std::string& name, s4u::Host* physical_host, int core_amount, - size_t ramsize) // XBT_ATTRIB_DEPRECATED_v336 - : Host(new kernel::resource::VirtualMachineImpl(name, this, physical_host, core_amount, ramsize)) - , pimpl_vm_(dynamic_cast(Host::get_impl())) -{ - physical_host->get_impl()->create_vm(name, this); -} - VirtualMachine::VirtualMachine(kernel::resource::VirtualMachineImpl* impl) : Host(impl), pimpl_vm_(dynamic_cast(Host::get_impl())) { -- 2.20.1 From 372f92e67e3eb3ca800b6d9bcf214594cf3b6798 Mon Sep 17 00:00:00 2001 From: Arnaud Giersch Date: Mon, 27 Nov 2023 09:41:25 +0100 Subject: [PATCH 15/16] Define macro XBT_ATTRIB_DEPRECATED_v340. (to use during the dev of v3.36) --- docs/source/Doxyfile | 3 ++- include/xbt/base.h | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/docs/source/Doxyfile b/docs/source/Doxyfile index 80b57e9e9d..0e1decc2b3 100644 --- a/docs/source/Doxyfile +++ b/docs/source/Doxyfile @@ -69,4 +69,5 @@ PREDEFINED += \ XBT_ATTRIB_UNUSED= \ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(cname,parent,desc)= \ XBT_ATTRIB_DEPRECATED_v338(mesg)= \ - XBT_ATTRIB_DEPRECATED_v339(mesg)= + XBT_ATTRIB_DEPRECATED_v339(mesg)= \ + XBT_ATTRIB_DEPRECATED_v340(mesg)= diff --git a/include/xbt/base.h b/include/xbt/base.h index 080c784e78..ceb0fb2be1 100644 --- a/include/xbt/base.h +++ b/include/xbt/base.h @@ -46,6 +46,8 @@ XBT_ATTRIB_DEPRECATED(mesg " (this compatibility wrapper will be dropped after v3.37)") #define XBT_ATTRIB_DEPRECATED_v339(mesg) \ XBT_ATTRIB_DEPRECATED(mesg " (this compatibility wrapper will be dropped after v3.38)") +#define XBT_ATTRIB_DEPRECATED_v340(mesg) \ + XBT_ATTRIB_DEPRECATED(mesg " (this compatibility wrapper will be dropped after v3.39)") /* Work around https://github.com/microsoft/vscode-cpptools/issues/4503 */ #ifdef __INTELLISENSE__ -- 2.20.1 From 39e98567c557d81dd5011b8e2ae883d4674b0c9d Mon Sep 17 00:00:00 2001 From: Arnaud Giersch Date: Mon, 27 Nov 2023 09:42:04 +0100 Subject: [PATCH 16/16] Add new entry in Release_Notes. --- docs/source/Release_Notes.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/source/Release_Notes.rst b/docs/source/Release_Notes.rst index 553a2e5264..8e06554e97 100644 --- a/docs/source/Release_Notes.rst +++ b/docs/source/Release_Notes.rst @@ -747,6 +747,10 @@ to verify pthread_cond in sthread is that I didn't manage to write an asynchrono almost working code lying around, but it fails for timed waits on condition variables. This will probably be part of the next release. +Version 3.36 (TBD) +------------------ + + .. |br| raw:: html
-- 2.20.1