From 4419698033214ab22d75f6cc97e53805bdf7d414 Mon Sep 17 00:00:00 2001 From: Jonathan Lifflander Date: Mon, 12 Sep 2022 15:40:28 -0700 Subject: [PATCH] #1899: registry: completely remove old manual registry --- docs/md/registry.md | 4 - src/vt/collective/collective_ops.cc | 5 - src/vt/collective/collective_ops.h | 3 - src/vt/collective/reduce/reduce.impl.h | 1 - src/vt/messaging/active.cc | 153 ++-------------- src/vt/messaging/active.h | 95 +--------- src/vt/registry/auto/auto_registry.cc | 1 - src/vt/registry/auto/auto_registry.h | 1 - src/vt/registry/auto/auto_registry_common.h | 5 +- .../registry/auto/auto_registry_interface.h | 1 - .../collection/auto_registry_collection.h | 1 - .../auto/functor/auto_registry_functor.h | 1 - .../registry/auto/index/auto_registry_index.h | 1 - .../auto/index/auto_registry_index.impl.h | 1 - .../auto/index/auto_registry_index_reg.h | 1 - src/vt/registry/auto/map/auto_registry_map.h | 1 - .../registry/auto/rdma/auto_registry_rdma.h | 1 - src/vt/registry/auto/vc/auto_registry_vc.h | 1 - src/vt/registry/registry.cc | 132 -------------- src/vt/registry/registry.h | 169 ------------------ src/vt/runnable/runnable.cc | 6 +- src/vt/runtime/runtime.cc | 14 +- src/vt/runtime/runtime.h | 1 - src/vt/runtime/runtime_component_fwd.h | 3 - src/vt/runtime/runtime_get.cc | 2 - src/vt/transport.h | 1 - 26 files changed, 23 insertions(+), 582 deletions(-) delete mode 100644 src/vt/registry/registry.cc delete mode 100644 src/vt/registry/registry.h diff --git a/docs/md/registry.md b/docs/md/registry.md index 8ab467020d..6d257faa4d 100644 --- a/docs/md/registry.md +++ b/docs/md/registry.md @@ -1,10 +1,6 @@ \page registry Registry \brief Registered handlers -The registry component `vt::registry::Registry`, accessed via -`vt::theRegistry()` holds type-safe active handlers for execution across a -distributed machine. - - The \ref active-messenger uses the registry to store/dispatch active function and active functor handlers. - The \ref objgroup uses the registry to store/dispatch active member diff --git a/src/vt/collective/collective_ops.cc b/src/vt/collective/collective_ops.cc index 0d38a2a8cd..9f392b93a1 100644 --- a/src/vt/collective/collective_ops.cc +++ b/src/vt/collective/collective_ops.cc @@ -334,11 +334,6 @@ void CollectiveAnyOps::output( } } -template -HandlerType CollectiveAnyOps::registerHandler(ActiveClosureFnType fn) { - return theRegistry()->registerActiveHandler(fn); -} - template struct CollectiveAnyOps; } /* end namespace vt */ diff --git a/src/vt/collective/collective_ops.h b/src/vt/collective/collective_ops.h index 849ac3a6a7..2a9d17dc5f 100644 --- a/src/vt/collective/collective_ops.h +++ b/src/vt/collective/collective_ops.h @@ -47,7 +47,6 @@ #include "vt/config.h" #include "vt/context/context.h" #include "vt/runtime/runtime_headers.h" -#include "vt/registry/registry.h" #include @@ -77,8 +76,6 @@ struct CollectiveAnyOps { bool error = false, bool decorate = true, bool formatted = false, bool abort_out = false ); - - static HandlerType registerHandler(ActiveClosureFnType fn); }; using CollectiveOps = CollectiveAnyOps; diff --git a/src/vt/collective/reduce/reduce.impl.h b/src/vt/collective/reduce/reduce.impl.h index ae957bc12c..0a2724d38d 100644 --- a/src/vt/collective/reduce/reduce.impl.h +++ b/src/vt/collective/reduce/reduce.impl.h @@ -46,7 +46,6 @@ #include "vt/config.h" #include "vt/collective/collective_alg.h" -#include "vt/registry/registry.h" #include "vt/registry/auto/auto_registry_interface.h" #include "vt/messaging/active.h" #include "vt/messaging/message.h" diff --git a/src/vt/messaging/active.cc b/src/vt/messaging/active.cc index b5c7de42dc..dc2186ecbc 100644 --- a/src/vt/messaging/active.cc +++ b/src/vt/messaging/active.cc @@ -890,7 +890,7 @@ bool ActiveMessenger::recvDataMsg( ); } -bool ActiveMessenger::processActiveMsg( +void ActiveMessenger::processActiveMsg( MsgSharedPtr const& base, NodeType const& from, bool insert, ActionType cont ) { @@ -913,18 +913,17 @@ bool ActiveMessenger::processActiveMsg( } if (deliver) { - return prepareActiveMsgToRun(base,from,insert,cont); + prepareActiveMsgToRun(base,from,insert,cont); } else { amForwardCounterGauge.incrementUpdate(base.size(), 1); if (cont != nullptr) { cont(); } - return false; } } -bool ActiveMessenger::prepareActiveMsgToRun( +void ActiveMessenger::prepareActiveMsgToRun( MsgSharedPtr const& base, NodeType const& in_from_node, bool insert, ActionType cont ) { @@ -950,11 +949,6 @@ bool ActiveMessenger::prepareActiveMsgToRun( ); } - bool const is_auto = HandlerManagerType::isHandlerAuto(handler); - bool const is_obj = HandlerManagerType::isHandlerObjGroup(handler); - bool has_handler = - (is_obj or is_auto) or theRegistry()->getHandler(handler, tag) != nullptr; - if (!is_term || vt_check_enabled(print_term_msgs)) { vt_debug_print( normal, active, @@ -965,41 +959,22 @@ bool ActiveMessenger::prepareActiveMsgToRun( ); } - if (has_handler) { - runnable::makeRunnable(base, not is_term, handler, from_node) - .withContinuation(cont) - .withTag(tag) - .withTDEpochFromMsg(is_term) - .withLBData(&bare_handler_lb_data_, bare_handler_dummy_elm_id_for_lb_data_) - .enqueue(); - - if (is_term) { - tdRecvCount.increment(1); - } - amHandlerCount.increment(1); + runnable::makeRunnable(base, not is_term, handler, from_node) + .withContinuation(cont) + .withTag(tag) + .withTDEpochFromMsg(is_term) + .withLBData(&bare_handler_lb_data_, bare_handler_dummy_elm_id_for_lb_data_) + .enqueue(); - if (not is_term) { - theTerm()->consume(epoch,1,in_from_node); - theTerm()->hangDetectRecv(); - } - } else { - if (insert) { - auto iter = pending_handler_msgs_.find(handler); - if (iter == pending_handler_msgs_.end()) { - pending_handler_msgs_.emplace( - std::piecewise_construct, - std::forward_as_tuple(handler), - std::forward_as_tuple( - MsgContType{BufferedMsgType{base,from_node,cont}} - ) - ); - } else { - iter->second.push_back(BufferedMsgType{base,from_node,cont}); - } - } + if (is_term) { + tdRecvCount.increment(1); } + amHandlerCount.increment(1); - return has_handler; + if (not is_term) { + theTerm()->consume(epoch,1,in_from_node); + theTerm()->hangDetectRecv(); + } } bool ActiveMessenger::tryProcessIncomingActiveMsg() { @@ -1176,7 +1151,6 @@ bool ActiveMessenger::testPendingAsyncOps() { int ActiveMessenger::progress(TimeType current_time) { bool const started_irecv_active_msg = tryProcessIncomingActiveMsg(); bool const started_irecv_data_msg = tryProcessDataMsgRecv(); - processMaybeReadyHanTag(); bool const received_active_msg = testPendingActiveMsgAsyncRecv(); bool const received_data_msg = testPendingDataMsgAsyncRecv(); bool const general_async = testPendingAsyncOps(); @@ -1185,101 +1159,6 @@ int ActiveMessenger::progress(TimeType current_time) { received_active_msg or received_data_msg or general_async; } -void ActiveMessenger::processMaybeReadyHanTag() { - decltype(maybe_ready_tag_han_) maybe_ready = maybe_ready_tag_han_; - // Clear first so clearing doesn't happen after new entries may be added by an - // active message arriving - maybe_ready_tag_han_.clear(); - for (auto&& x : maybe_ready) { - deliverPendingMsgsHandler(std::get<0>(x), std::get<1>(x)); - } -} - -HandlerType ActiveMessenger::registerNewHandler( - ActiveClosureFnType fn, TagType const& tag -) { - return theRegistry()->registerNewHandler(fn, tag); -} - -HandlerType ActiveMessenger::collectiveRegisterHandler( - ActiveClosureFnType fn, TagType const& tag -) { - return theRegistry()->registerActiveHandler(fn, tag); -} - -void ActiveMessenger::swapHandlerFn( - HandlerType const han, ActiveClosureFnType fn, TagType const& tag -) { - vt_debug_print( - verbose, active, - "swapHandlerFn: han={}, tag={}\n", han, tag - ); - - theRegistry()->swapHandler(han, fn, tag); - - if (fn != nullptr) { - maybe_ready_tag_han_.push_back(ReadyHanTagType{han,tag}); - } -} - -void ActiveMessenger::deliverPendingMsgsHandler( - HandlerType const han, TagType const& tag -) { - vt_debug_print( - normal, active, - "deliverPendingMsgsHandler: han={}, tag={}\n", han, tag - ); - auto iter = pending_handler_msgs_.find(han); - if (iter != pending_handler_msgs_.end()) { - if (iter->second.size() > 0) { - for (auto cur = iter->second.begin(); cur != iter->second.end(); ) { - vt_debug_print( - verbose, active, - "deliverPendingMsgsHandler: msg={}, from={}\n", - print_ptr(cur->buffered_msg.get()), cur->from_node - ); - if ( - prepareActiveMsgToRun( - cur->buffered_msg, cur->from_node, false, cur->cont - ) - ) { - cur = iter->second.erase(cur); - } else { - ++cur; - } - } - } else { - pending_handler_msgs_.erase(iter); - } - } -} - -void ActiveMessenger::registerHandlerFn( - HandlerType const han, ActiveClosureFnType fn, TagType const& tag -) { - vt_debug_print( - verbose, active, - "registerHandlerFn: han={}, tag={}\n", han, tag - ); - - swapHandlerFn(han, fn, tag); - - if (fn != nullptr) { - maybe_ready_tag_han_.push_back(ReadyHanTagType{han,tag}); - } -} - -void ActiveMessenger::unregisterHandlerFn( - HandlerType const han, TagType const& tag -) { - vt_debug_print( - verbose, active, - "unregisterHandlerFn: han={}, tag={}\n", han, tag - ); - - return theRegistry()->unregisterHandlerFn(han, tag); -} - void ActiveMessenger::registerAsyncOp(std::unique_ptr in) { in_progress_ops.emplace(AsyncOpWrapper{std::move(in)}); } diff --git a/src/vt/messaging/active.h b/src/vt/messaging/active.h index 2b44025004..49aa04b43f 100644 --- a/src/vt/messaging/active.h +++ b/src/vt/messaging/active.h @@ -57,7 +57,6 @@ #include "vt/messaging/send_info.h" #include "vt/messaging/async_op_wrapper.h" #include "vt/event/event.h" -#include "vt/registry/registry.h" #include "vt/registry/auto/auto_registry_interface.h" #include "vt/trace/trace_common.h" #include "vt/utils/static_checks/functor.h" @@ -320,10 +319,7 @@ struct ActiveMessenger : runtime::component::PollableComponent using SendFnType = std::function; using UserSendFnType = std::function; using ContainerPendingType = std::unordered_map; - using MsgContType = std::list; - using ContWaitType = std::unordered_map; using ReadyHanTagType = std::tuple; - using MaybeReadyType = std::vector; using HandlerManagerType = HandlerManager; using PendingSendType = PendingSend; @@ -1354,65 +1350,6 @@ struct ActiveMessenger : runtime::component::PollableComponent */ int progress(TimeType current_time) override; - /** - * \internal - * \brief Register a bare handler - * - * \param[in] fn the function to register - * \param[in] tag the tag this handler will accept (\c vt::no_tag means any) - * - * \return the handler ID - */ - HandlerType registerNewHandler( - ActiveClosureFnType fn, TagType const& tag = no_tag - ); - - /** - * \internal - * \brief Swap the underlying handler function pointer - * - * \param[in] han the handler to swap function pointers - * \param[in] fn the new function pointer - * \param[in] tag the tag this handler will accept (\c vt::no_tag means any) - */ - void swapHandlerFn( - HandlerType const han, ActiveClosureFnType fn, TagType const& tag = no_tag - ); - - /** - * \internal - * \brief Un-register a bare handler - * - * \param[in] han the handler to de-register - * \param[in] tag the tag this handler will accept (\c vt::no_tag means any) - */ - void unregisterHandlerFn(HandlerType const han, TagType const& tag = no_tag); - - /** - * \internal - * \brief Register a handler function for existing handler - * - * \param[in] han the handler to swap function pointers - * \param[in] fn the new function pointer - * \param[in] tag the tag this handler will accept (\c vt::no_tag means any) - */ - void registerHandlerFn( - HandlerType const han, ActiveClosureFnType fn, TagType const& tag = no_tag - ); - - /** - * \internal - * \brief Register an active handler (collective) - * - * \param[in] fn the function pointer for the handler - * \param[in] tag the tag this handler will accept (\c vt::no_tag means any) - * - * \return the handler ID - */ - HandlerType collectiveRegisterHandler( - ActiveClosureFnType fn, TagType const& tag = no_tag - ); - /** * \internal * \brief Process an incoming active message @@ -1425,10 +1362,8 @@ struct ActiveMessenger : runtime::component::PollableComponent * \param[in] sender the sender of the message * \param[in] insert whether to insert the message if handler does not exist * \param[in] cont continuation after message is processed - * - * \return whether it was delivered locally */ - bool processActiveMsg( + void processActiveMsg( MsgSharedPtr const& base, NodeType const& sender, bool insert, ActionType cont = nullptr ); @@ -1441,32 +1376,12 @@ struct ActiveMessenger : runtime::component::PollableComponent * \param[in] from_node the node the message came from * \param[in] insert whether to insert the message if handler does not exist * \param[in] cont continuation after message is processed - * - * \return whether the message was delivered, false when handler does not exist */ - bool prepareActiveMsgToRun( + void prepareActiveMsgToRun( MsgSharedPtr const& base, NodeType const& from_node, bool insert, ActionType cont ); - /** - * \internal - * \brief Deliver pending messaging waiting for a handler to be registered - * - * \param[in] han the handler that will now accept - * \param[in] tag the tag for that handler - */ - void deliverPendingMsgsHandler( - HandlerType const han, TagType const& tag = no_tag - ); - - /** - * \internal - * \brief Process any messages that might be ready now (handler is now - * registered) - */ - void processMaybeReadyHanTag(); - /** * \internal * \brief Send message as low-level bytes after packing put bytes if needed @@ -1622,9 +1537,7 @@ struct ActiveMessenger : runtime::component::PollableComponent template void serialize(SerializerT& s) { - s | maybe_ready_tag_han_ - | pending_handler_msgs_ - | pending_recvs_ + s | pending_recvs_ | cur_direct_buffer_tag_ | in_progress_active_msg_irecv | in_progress_data_irecv @@ -1732,8 +1645,6 @@ struct ActiveMessenger : runtime::component::PollableComponent trace::UserEventIDType trace_asyncop = trace::no_user_event_id; # endif - MaybeReadyType maybe_ready_tag_han_ = {}; - ContWaitType pending_handler_msgs_ = {}; ContainerPendingType pending_recvs_ = {}; TagType cur_direct_buffer_tag_ = starting_direct_buffer_tag; RequestHolder in_progress_active_msg_irecv; diff --git a/src/vt/registry/auto/auto_registry.cc b/src/vt/registry/auto/auto_registry.cc index 9eceda1d16..6cdb9f0176 100644 --- a/src/vt/registry/auto/auto_registry.cc +++ b/src/vt/registry/auto/auto_registry.cc @@ -44,7 +44,6 @@ #include "vt/config.h" #include "vt/registry/auto/auto_registry_common.h" #include "vt/registry/auto/auto_registry_interface.h" -#include "vt/registry/registry.h" #include diff --git a/src/vt/registry/auto/auto_registry.h b/src/vt/registry/auto/auto_registry.h index fef2832a5a..36362d1bb3 100644 --- a/src/vt/registry/auto/auto_registry.h +++ b/src/vt/registry/auto/auto_registry.h @@ -47,7 +47,6 @@ #include "vt/config.h" #include "vt/registry/auto/auto_registry_common.h" #include "vt/registry/auto/auto_registry_general.h" -#include "vt/registry/registry.h" #include "vt/trace/trace.h" #include "vt/utils/demangle/demangle.h" diff --git a/src/vt/registry/auto/auto_registry_common.h b/src/vt/registry/auto/auto_registry_common.h index 52140ee1aa..d8eb56b66b 100644 --- a/src/vt/registry/auto/auto_registry_common.h +++ b/src/vt/registry/auto/auto_registry_common.h @@ -44,11 +44,10 @@ #if !defined INCLUDED_VT_REGISTRY_AUTO_AUTO_REGISTRY_COMMON_H #define INCLUDED_VT_REGISTRY_AUTO_AUTO_REGISTRY_COMMON_H -#include "vt/trace/trace_event.h" - #include "vt/config.h" +#include "vt/handler/handler.h" +#include "vt/trace/trace_event.h" #include "vt/activefn/activefn.h" -#include "vt/registry/registry.h" #include "vt/trace/trace.h" #include "vt/vrt/context/context_vrt_funcs.h" #include "vt/vrt/collection/active/active_funcs.h" diff --git a/src/vt/registry/auto/auto_registry_interface.h b/src/vt/registry/auto/auto_registry_interface.h index 11ef7d538c..5b1fb6dc70 100644 --- a/src/vt/registry/auto/auto_registry_interface.h +++ b/src/vt/registry/auto/auto_registry_interface.h @@ -46,7 +46,6 @@ #include "vt/registry/auto/auto_registry_common.h" #include "vt/config.h" -#include "vt/registry/registry.h" namespace vt { namespace auto_registry { diff --git a/src/vt/registry/auto/collection/auto_registry_collection.h b/src/vt/registry/auto/collection/auto_registry_collection.h index 742b46e1db..d025a07646 100644 --- a/src/vt/registry/auto/collection/auto_registry_collection.h +++ b/src/vt/registry/auto/collection/auto_registry_collection.h @@ -47,7 +47,6 @@ #include "vt/config.h" #include "vt/registry/auto/auto_registry_common.h" #include "vt/registry/auto/auto_registry_general.h" -#include "vt/registry/registry.h" #include "vt/activefn/activefn.h" #include "vt/vrt/collection/active/active_funcs.h" diff --git a/src/vt/registry/auto/functor/auto_registry_functor.h b/src/vt/registry/auto/functor/auto_registry_functor.h index a69d2ae43c..79c1221afe 100644 --- a/src/vt/registry/auto/functor/auto_registry_functor.h +++ b/src/vt/registry/auto/functor/auto_registry_functor.h @@ -46,7 +46,6 @@ #include "vt/config.h" #include "vt/registry/auto/auto_registry_common.h" -#include "vt/registry/registry.h" #include #include diff --git a/src/vt/registry/auto/index/auto_registry_index.h b/src/vt/registry/auto/index/auto_registry_index.h index d5d1029fbf..13a5415ec4 100644 --- a/src/vt/registry/auto/index/auto_registry_index.h +++ b/src/vt/registry/auto/index/auto_registry_index.h @@ -47,7 +47,6 @@ #include "vt/config.h" #include "vt/registry/auto/auto_registry_common.h" #include "vt/registry/auto/auto_registry_general.h" -#include "vt/registry/registry.h" namespace vt { namespace auto_registry { diff --git a/src/vt/registry/auto/index/auto_registry_index.impl.h b/src/vt/registry/auto/index/auto_registry_index.impl.h index 79289b124b..1ca22c5a14 100644 --- a/src/vt/registry/auto/index/auto_registry_index.impl.h +++ b/src/vt/registry/auto/index/auto_registry_index.impl.h @@ -47,7 +47,6 @@ #include "vt/config.h" #include "vt/registry/auto/auto_registry_common.h" #include "vt/registry/auto/auto_registry_general.h" -#include "vt/registry/registry.h" #include "vt/registry/auto/index/auto_registry_index.h" #include "vt/registry/auto/index/auto_registry_index_reg.h" diff --git a/src/vt/registry/auto/index/auto_registry_index_reg.h b/src/vt/registry/auto/index/auto_registry_index_reg.h index 19220b8a7a..36fbe6833d 100644 --- a/src/vt/registry/auto/index/auto_registry_index_reg.h +++ b/src/vt/registry/auto/index/auto_registry_index_reg.h @@ -47,7 +47,6 @@ #include "vt/config.h" #include "vt/registry/auto/auto_registry_common.h" #include "vt/registry/auto/auto_registry_general.h" -#include "vt/registry/registry.h" namespace vt { namespace auto_registry { diff --git a/src/vt/registry/auto/map/auto_registry_map.h b/src/vt/registry/auto/map/auto_registry_map.h index 4585f0995c..c81213f476 100644 --- a/src/vt/registry/auto/map/auto_registry_map.h +++ b/src/vt/registry/auto/map/auto_registry_map.h @@ -47,7 +47,6 @@ #include "vt/config.h" #include "vt/registry/auto/auto_registry_common.h" #include "vt/registry/auto/auto_registry_general.h" -#include "vt/registry/registry.h" #include "vt/topos/mapping/mapping_function.h" diff --git a/src/vt/registry/auto/rdma/auto_registry_rdma.h b/src/vt/registry/auto/rdma/auto_registry_rdma.h index 04ed7a0ee6..162d19a8a5 100644 --- a/src/vt/registry/auto/rdma/auto_registry_rdma.h +++ b/src/vt/registry/auto/rdma/auto_registry_rdma.h @@ -47,7 +47,6 @@ #include "vt/config.h" #include "vt/registry/auto/auto_registry_common.h" #include "vt/registry/auto/auto_registry_general.h" -#include "vt/registry/registry.h" #include "vt/activefn/activefn.h" #include "vt/vrt/collection/active/active_funcs.h" diff --git a/src/vt/registry/auto/vc/auto_registry_vc.h b/src/vt/registry/auto/vc/auto_registry_vc.h index a5850eb8dd..05c5d1d70a 100644 --- a/src/vt/registry/auto/vc/auto_registry_vc.h +++ b/src/vt/registry/auto/vc/auto_registry_vc.h @@ -47,7 +47,6 @@ #include "vt/config.h" #include "vt/registry/auto/auto_registry_common.h" #include "vt/registry/auto/auto_registry_general.h" -#include "vt/registry/registry.h" #include "vt/activefn/activefn.h" #include "vt/vrt/context/context_vrt_funcs.h" diff --git a/src/vt/registry/registry.cc b/src/vt/registry/registry.cc deleted file mode 100644 index ddf67052ed..0000000000 --- a/src/vt/registry/registry.cc +++ /dev/null @@ -1,132 +0,0 @@ -/* -//@HEADER -// ***************************************************************************** -// -// registry.cc -// DARMA/vt => Virtual Transport -// -// Copyright 2019-2021 National Technology & Engineering Solutions of Sandia, LLC -// (NTESS). Under the terms of Contract DE-NA0003525 with NTESS, the U.S. -// Government retains certain rights in this software. -// -// 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. -// -// * Neither the name of the copyright holder nor the names of its -// contributors may be used to endorse or promote products derived from this -// software without specific prior written permission. -// -// 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. -// -// Questions? Contact darma@sandia.gov -// -// ***************************************************************************** -//@HEADER -*/ - -#include "vt/config.h" -#include "vt/registry/registry.h" - -namespace vt { namespace registry { - -HandlerType Registry::registerNewHandler( - ActiveClosureFnType fn, TagType const& tag, bool const& is_collective -) { - HandlerType new_handle = 0; - HandlerIdentifierType const& new_identifier = - is_collective ? cur_ident_collective_++ : cur_ident_++; - - HandlerManagerType::setHandlerIdentifier(new_handle, new_identifier); - - if (tag == no_tag) { - registered_[new_handle] = fn; - } else { - tagged_registered_[new_handle][tag] = fn; - } - - return new_handle; -} - -void Registry::swapHandler( - HandlerType const han, ActiveClosureFnType fn, TagType const& tag -) { - if (tag == no_tag) { - auto iter = registered_.find(han); - vtAssert( - iter != registered_.end(), "Handler must be registered" - ); - iter->second = fn; - } else { - if (fn == nullptr) { - auto tag_iter = tagged_registered_[han].find(tag); - if (tag_iter != tagged_registered_[han].end()) { - tagged_registered_[han].erase(tag_iter); - if (tagged_registered_[han].size() == 0) { - tagged_registered_.erase(tagged_registered_.find(han)); - } - } - } else { - tagged_registered_[han][tag] = fn; - } - } -} - -void Registry::unregisterHandlerFn( - HandlerType const han, TagType const& tag -) { - swapHandler(han, nullptr, tag); -} - -HandlerType Registry::registerActiveHandler( - ActiveClosureFnType fn, TagType const& tag -) { - return registerNewHandler(fn, tag, true); -} - -ActiveClosureFnType Registry::getHandlerNoTag(HandlerType const han) { - auto iter = registered_.find(han); - if (iter != registered_.end()) { - return iter->second; - } else { - return nullptr; - } -} - -ActiveClosureFnType Registry::getHandler( - HandlerType const han, TagType const& tag -) { - if (tag == no_tag) { - return getHandlerNoTag(han); - } else { - auto tag_iter = tagged_registered_.find(han); - if (tag_iter == tagged_registered_.end()) { - return getHandlerNoTag(han); - } else { - auto iter = tag_iter->second.find(tag); - if (iter != tag_iter->second.end()) { - return iter->second; - } else { - return getHandlerNoTag(han); - } - } - } -} - -}} //end namespace vt::registry diff --git a/src/vt/registry/registry.h b/src/vt/registry/registry.h deleted file mode 100644 index bcd79f0670..0000000000 --- a/src/vt/registry/registry.h +++ /dev/null @@ -1,169 +0,0 @@ -/* -//@HEADER -// ***************************************************************************** -// -// registry.h -// DARMA/vt => Virtual Transport -// -// Copyright 2019-2021 National Technology & Engineering Solutions of Sandia, LLC -// (NTESS). Under the terms of Contract DE-NA0003525 with NTESS, the U.S. -// Government retains certain rights in this software. -// -// 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. -// -// * Neither the name of the copyright holder nor the names of its -// contributors may be used to endorse or promote products derived from this -// software without specific prior written permission. -// -// 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. -// -// Questions? Contact darma@sandia.gov -// -// ***************************************************************************** -//@HEADER -*/ - -#if !defined INCLUDED_VT_REGISTRY_REGISTRY_H -#define INCLUDED_VT_REGISTRY_REGISTRY_H - -#include -#include -#include - -#include "vt/config.h" -#include "vt/activefn/activefn.h" -#include "vt/handler/handler.h" -#include "vt/runtime/component/component.h" - -namespace vt { namespace registry { - -/** - * \struct Registry - * - * \brief A VT component that manages registered active handlers. - */ -struct Registry : runtime::component::Component { - using HandlerManagerType = HandlerManager; - using HandlerBitsType = eHandlerBits; - using TaggerHandlerType = std::tuple; - using ContainerType = std::unordered_map; - using TagContainerType = std::unordered_map; - using HanTagContainerType = std::unordered_map; - - /** - * \internal \brief System call to construct a registry - */ - Registry() = default; - - std::string name() override { return "Registry"; } - - /** - * \brief Register a new handler - * - * \param[in] fn the active function pointer - * \param[in] tag relevant message tag for delivery - * \param[in] is_collective whether it's a collective registration - * - * \return the handler ID - */ - HandlerType registerNewHandler( - ActiveClosureFnType fn, TagType const& tag = no_tag, - bool const& is_collective = false - ); - - /** - * \brief Unregister a handler - * - * \param[in] han the handler ID - * \param[in] tag relevant message tag for delivery - */ - void unregisterHandlerFn( - HandlerType const han, TagType const& tag = no_tag - ); - - /** - * \brief Swap underlying handler out for registered handler ID - * - * \param[in] han the handler ID - * \param[in] fn the active function to attach - * \param[in] tag tag to associate - */ - void swapHandler( - HandlerType const han, ActiveClosureFnType fn, TagType const& tag = no_tag - ); - - /** - * \brief Registry an active handler - * - * \param[in] fn the active handler - * \param[in] tag relevant message tag - * - * \return the handler ID - */ - HandlerType registerActiveHandler( - ActiveClosureFnType fn, TagType const& tag = no_tag - ); - - /** - * \brief Get active function for handler - * - * \param[in] han the handler ID - * \param[in] tag the relevant tag - * - * \return the active function - */ - ActiveClosureFnType getHandler( - HandlerType const han, TagType const& tag = no_tag - ); - - /** - * \brief Get active function for handler - * - * \param[in] han the handler ID - * - * \return the active function - */ - ActiveClosureFnType getHandlerNoTag(HandlerType const han); - - template - void serialize(SerializerT& s) { - s | registered_ - | tagged_registered_ - | cur_ident_collective_ - | cur_ident_; - } - -private: - ContainerType registered_; - HanTagContainerType tagged_registered_; - HandlerIdentifierType cur_ident_collective_ = first_handle_identifier; - HandlerIdentifierType cur_ident_ = first_handle_identifier; -}; - -}} //end namespace vt::registry - -namespace vt { - -extern registry::Registry* theRegistry(); - -} // end namespace vt - -#endif /*INCLUDED_VT_REGISTRY_REGISTRY_H*/ diff --git a/src/vt/runnable/runnable.cc b/src/vt/runnable/runnable.cc index 7066df9a8c..4f54bbd4c1 100644 --- a/src/vt/runnable/runnable.cc +++ b/src/vt/runnable/runnable.cc @@ -75,7 +75,7 @@ void RunnableNew::setupHandler(HandlerType handler, bool is_void, TagType tag) { } return; - } else if (is_auto) { + } else { bool const is_base_msg_derived = HandlerManagerType::isHandlerBaseMsgDerived(handler); if (is_base_msg_derived) { @@ -87,10 +87,6 @@ void RunnableNew::setupHandler(HandlerType handler, bool is_void, TagType tag) { auto const& func = auto_registry::getScatterAutoHandler(handler); task_ = [=, &func] { func->dispatch(msg_.get(), nullptr); }; return; - } else { - auto typed_func = theRegistry()->getHandler(handler, tag); - task_ = [=] { typed_func(msg_.get()); }; - return; } } } else { diff --git a/src/vt/runtime/runtime.cc b/src/vt/runtime/runtime.cc index fcaa3812c9..48a23db6a0 100644 --- a/src/vt/runtime/runtime.cc +++ b/src/vt/runtime/runtime.cc @@ -45,7 +45,6 @@ #include "vt/runtime/runtime.h" #include "vt/context/context.h" #include "vt/context/context_attorney.h" -#include "vt/registry/registry.h" #include "vt/messaging/active.h" #include "vt/event/event.h" #include "vt/termination/termination.h" @@ -680,10 +679,6 @@ void Runtime::initializeComponents() { phase::PhaseManager // For outputting memory at phase boundaries >{}); - p_->registerComponent(&theRegistry, Deps< - ctx::Context // Everything depends on theContext - >{}); - p_->registerComponent(&thePool, Deps< ctx::Context // Everything depends on theContext >{}); @@ -730,8 +725,7 @@ void Runtime::initializeComponents() { # endif ctx::Context, // Everything depends on theContext event::AsyncEvent, // Depends on event to send messages - pool::Pool, // Depends on pool for message allocation - registry::Registry // Depends on registry for handlers + pool::Pool // Depends on pool for message allocation >{} ); @@ -887,7 +881,6 @@ void Runtime::initializeComponents() { p_->add(); p_->add(); p_->add(); - p_->add(); p_->add(); p_->add(); # if vt_check_enabled(trace_enabled) @@ -909,7 +902,6 @@ void Runtime::initializeComponents() { p_->add(); p_->add(); p_->add(); - p_->add(); p_->add(); p_->add(); p_->add(); @@ -1112,10 +1104,6 @@ void Runtime::printMemoryFootprint() const { printComponentFootprint( static_cast(base) ); - } else if (name == "Registry") { - printComponentFootprint( - static_cast(base) - ); } else if (name == "Scheduler") { printComponentFootprint( static_cast(base) diff --git a/src/vt/runtime/runtime.h b/src/vt/runtime/runtime.h index 00f2a9162f..b2a4c8d2c5 100644 --- a/src/vt/runtime/runtime.h +++ b/src/vt/runtime/runtime.h @@ -395,7 +395,6 @@ struct Runtime { public: ComponentPtrType theArgConfig = nullptr; - ComponentPtrType theRegistry = nullptr; ComponentPtrType theMsg = nullptr; ComponentPtrType theContext = nullptr; ComponentPtrType theEvent = nullptr; diff --git a/src/vt/runtime/runtime_component_fwd.h b/src/vt/runtime/runtime_component_fwd.h index 93cf5153ed..b54bc264b0 100644 --- a/src/vt/runtime/runtime_component_fwd.h +++ b/src/vt/runtime/runtime_component_fwd.h @@ -52,9 +52,6 @@ namespace vt { namespace arguments { struct ArgConfig; } -namespace registry { -struct Registry; -} namespace messaging { struct ActiveMessenger; } diff --git a/src/vt/runtime/runtime_get.cc b/src/vt/runtime/runtime_get.cc index 670f4f3e45..8aa6dab0c2 100644 --- a/src/vt/runtime/runtime_get.cc +++ b/src/vt/runtime/runtime_get.cc @@ -49,7 +49,6 @@ #include "vt/utils/tls/tls.h" #include "vt/vrt/context/context_vrtmanager.h" #include "vt/context/context.h" -#include "vt/registry/registry.h" #include "vt/messaging/active.h" #include "vt/event/event.h" #include "vt/termination/term_headers.h" @@ -119,7 +118,6 @@ event::AsyncEvent* theEvent() { return CUR_RT->theEvent; messaging::ActiveMessenger* theMsg() { return CUR_RT->theMsg; } param::Param* theParam() { return CUR_RT->theParam; } rdma::RDMAManager* theRDMA() { return CUR_RT->theRDMA; } -registry::Registry* theRegistry() { return CUR_RT->theRegistry; } sched::Scheduler* theSched() { return CUR_RT->theSched; } term::TerminationDetector* theTerm() { return CUR_RT->theTerm; } location::LocationManager* theLocMan() { return CUR_RT->theLocMan; } diff --git a/src/vt/transport.h b/src/vt/transport.h index f69f54213b..d035867f7a 100644 --- a/src/vt/transport.h +++ b/src/vt/transport.h @@ -55,7 +55,6 @@ #include "vt/collective/collective_alg.h" #include "vt/collective/collective.h" #include "vt/event/event.h" -#include "vt/registry/registry.h" #include "vt/messaging/active.h" #include "vt/parameterization/parameterization.h" #include "vt/event/event_msgs.h"