Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#2403: runtime: seperate out runtime dependencies from startup dependencies #2404

Draft
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

lifflander
Copy link
Collaborator

Fixes #2403

@lifflander lifflander force-pushed the 2403-distinguish-startup-dependencies-from-use-dependencies-in-vt-components branch from 89e93d4 to 8ef5025 Compare February 27, 2025 00:19
Copy link

clang-format output for this changeset:

diff --git a/src/vt/runtime/component/component_pack.h b/src/vt/runtime/component/component_pack.h
index d595e5bcc..c677d94c4 100644
--- a/src/vt/runtime/component/component_pack.h
+++ b/src/vt/runtime/component/component_pack.h
@@ -81,16 +81,11 @@ public:
    * \return \c registry::AutoHandlerType with type ID for component
    */
   template <
-    typename T,
-    typename... StartupDeps,
-    typename... RuntimeDeps,
-    typename... Cons
-  >
+    typename T, typename... StartupDeps, typename... RuntimeDeps,
+    typename... Cons>
   registry::AutoHandlerType registerComponent(
-    T** ref,
-    typename BaseComponent::StartupDepsPack<StartupDeps...>,
-    typename BaseComponent::RuntimeDepsPack<RuntimeDeps...>,
-    Cons&&... cons
+    T** ref, typename BaseComponent::StartupDepsPack<StartupDeps...>,
+    typename BaseComponent::RuntimeDepsPack<RuntimeDeps...>, Cons&&... cons
   );
 
   /**
diff --git a/src/vt/runtime/component/component_pack.impl.h b/src/vt/runtime/component/component_pack.impl.h
index f9b21ee78..9e4fd98d4 100644
--- a/src/vt/runtime/component/component_pack.impl.h
+++ b/src/vt/runtime/component/component_pack.impl.h
@@ -72,16 +72,11 @@ std::unique_ptr<MovableFn> makeCallable(Callable&& c) {
 } /* end anon namespace */
 
 template <
-  typename T,
-  typename... StartupDeps,
-  typename... RuntimeDeps,
-  typename... Cons
->
+  typename T, typename... StartupDeps, typename... RuntimeDeps,
+  typename... Cons>
 registry::AutoHandlerType ComponentPack::registerComponent(
-  T** ref,
-  typename BaseComponent::StartupDepsPack<StartupDeps...>,
-  typename BaseComponent::RuntimeDepsPack<RuntimeDeps...>,
-  Cons&&... cons
+  T** ref, typename BaseComponent::StartupDepsPack<StartupDeps...>,
+  typename BaseComponent::RuntimeDepsPack<RuntimeDeps...>, Cons&&... cons
 ) {
   ComponentRegistry::dependsOn<T, StartupDeps...>();
   auto idx = registry::makeIdx<T>();
diff --git a/src/vt/runtime/runtime.cc b/src/vt/runtime/runtime.cc
index c33bc2a4b..d9267f379 100644
--- a/src/vt/runtime/runtime.cc
+++ b/src/vt/runtime/runtime.cc
@@ -719,44 +719,39 @@ void Runtime::initializeComponents() {
 # endif
 
   p_->registerComponent<arguments::ArgConfig>(
-    &theArgConfig,
-    StartupDeps<>{},
-    RuntimeDeps<>{},
-    std::move(arg_config_)
+    &theArgConfig, StartupDeps<>{}, RuntimeDeps<>{}, std::move(arg_config_)
   );
 
   p_->registerComponent<ctx::Context>(
-    &theContext,
-    StartupDeps<arguments::ArgConfig>{},
-    RuntimeDeps<>{},
+    &theContext, StartupDeps<arguments::ArgConfig>{}, RuntimeDeps<>{},
     is_interop_, initial_communicator_
   );
 
-  p_->registerComponent<util::memory::MemoryUsage>(&theMemUsage,
+  p_->registerComponent<util::memory::MemoryUsage>(
+    &theMemUsage,
     StartupDeps<
       ctx::Context,       // Everything depends on theContext
       phase::PhaseManager // For outputting memory at phase boundaries
-    >{},
+      >{},
     RuntimeDeps<>{}
   );
 
   p_->registerComponent<pool::Pool>(
     &thePool,
-    StartupDeps<
-      ctx::Context // Everything depends on theContext
-    >{},
+    StartupDeps<ctx::Context // Everything depends on theContext
+                >{},
     RuntimeDeps<>{}
   );
 
   p_->registerComponent<event::AsyncEvent>(
     &theEvent,
     StartupDeps<
-#     if vt_check_enabled(trace_enabled)
-      trace::Trace,  // For trace user event registrations
-#     endif
-      ctx::Context,  // Everything depends on theContext
-      pool::Pool     // For memory allocations
-    >{},
+#if vt_check_enabled(trace_enabled)
+      trace::Trace, // For trace user event registrations
+#endif
+      ctx::Context, // Everything depends on theContext
+      pool::Pool    // For memory allocations
+      >{},
     RuntimeDeps<>{}
   );
 
@@ -765,11 +760,9 @@ void Runtime::initializeComponents() {
   // the lifetime of theTrace should be longer than that of theSched.
   p_->registerComponent<trace::Trace>(
     &theTrace,
-    StartupDeps<
-      ctx::Context  // Everything depends on theContext
-    >{},
-    RuntimeDeps<>{},
-    prog_name
+    StartupDeps<ctx::Context // Everything depends on theContext
+                >{},
+    RuntimeDeps<>{}, prog_name
   );
 # endif
 
@@ -777,11 +770,11 @@ void Runtime::initializeComponents() {
   p_->registerComponent<pmpi::PMPIComponent>(
     &thePMPI,
     StartupDeps<
-#     if vt_check_enabled(trace_enabled)
-      trace::Trace,  // For PMPI tracing, if tracing is enabled.
-#     endif
-      ctx::Context   // Everything depends on theContext
-    >{},
+#if vt_check_enabled(trace_enabled)
+      trace::Trace, // For PMPI tracing, if tracing is enabled.
+#endif
+      ctx::Context // Everything depends on theContext
+      >{},
     RuntimeDeps<>{}
   );
 #endif
@@ -791,7 +784,7 @@ void Runtime::initializeComponents() {
     StartupDeps<
       ctx::Context,              // Everything depends on theContext
       messaging::ActiveMessenger // Depends on active messenger to send
-    >{},
+      >{},
     RuntimeDeps<>{}
   );
 
@@ -799,12 +792,12 @@ void Runtime::initializeComponents() {
     &theMsg,
     StartupDeps<
 #     if vt_check_enabled(trace_enabled)
-      trace::Trace,      // For trace user event registrations
+      trace::Trace, // For trace user event registrations
 #     endif
       ctx::Context,      // Everything depends on theContext
       event::AsyncEvent, // Depends on event to send messages
       pool::Pool         // Depends on pool for message allocation
-    >{},
+      >{},
     RuntimeDeps<>{}
   );
 
@@ -812,30 +805,30 @@ void Runtime::initializeComponents() {
     &theSched,
     StartupDeps<
 #     if vt_check_enabled(trace_enabled)
-      trace::Trace,             // For scheduler-related trace events
+      trace::Trace, // For scheduler-related trace events
 #     endif
       ctx::Context,             // Everything depends on theContext
       util::memory::MemoryUsage // Depends on memory usage for output
-    >{},
+      >{},
     RuntimeDeps<>{}
   );
 
   p_->registerComponent<epoch::EpochManip>(
     &theEpoch,
-    StartupDeps<
-      ctx::Context                // Everything depends on theContext
-    >{},
+    StartupDeps<ctx::Context // Everything depends on theContext
+                >{},
     RuntimeDeps<>{}
   );
 
   p_->registerComponent<term::TerminationDetector>(
     &theTerm,
     StartupDeps<
-      ctx::Context,               // Everything depends on theContext
-      messaging::ActiveMessenger, // Depends on active messenger to send term msgs
-      sched::Scheduler,           // Depends on scheduler for idle checks
-      epoch::EpochManip           // Depends on for generating epochs
-    >{},
+      ctx::Context, // Everything depends on theContext
+      messaging::
+        ActiveMessenger, // Depends on active messenger to send term msgs
+      sched::Scheduler,  // Depends on scheduler for idle checks
+      epoch::EpochManip  // Depends on for generating epochs
+      >{},
     RuntimeDeps<>{}
   );
 
@@ -844,7 +837,7 @@ void Runtime::initializeComponents() {
     StartupDeps<
       ctx::Context,              // Everything depends on theContext
       messaging::ActiveMessenger // Depends on active messenger for collectives
-    >{},
+      >{},
     RuntimeDeps<>{}
   );
 
@@ -854,38 +847,38 @@ void Runtime::initializeComponents() {
       ctx::Context,               // Everything depends on theContext
       messaging::ActiveMessenger, // Depends on active messenger for setting up
       collective::CollectiveAlg   // Depends on collective for spanning trees
-    >{},
+      >{},
     RuntimeDeps<>{}
   );
 
   p_->registerComponent<pipe::PipeManager>(
     &theCB,
     StartupDeps<
-      ctx::Context,                        // Everything depends on theContext
-      messaging::ActiveMessenger,          // Depends on AM for callbacks
-      collective::CollectiveAlg,           // Depends on collective for callbacks
-      objgroup::ObjGroupManager,           // Depends on objgroup for callbacks
-      vrt::collection::CollectionManager   // Depends collection for callbacks
-    >{},
+      ctx::Context,                      // Everything depends on theContext
+      messaging::ActiveMessenger,        // Depends on AM for callbacks
+      collective::CollectiveAlg,         // Depends on collective for callbacks
+      objgroup::ObjGroupManager,         // Depends on objgroup for callbacks
+      vrt::collection::CollectionManager // Depends collection for callbacks
+      >{},
     RuntimeDeps<>{}
   );
 
   p_->registerComponent<rdma::RDMAManager>(
     &theRDMA,
     StartupDeps<
-      ctx::Context,                 // Everything depends on theContext
-      messaging::ActiveMessenger,   // Depends on active messenger for RDMA
-      collective::CollectiveAlg     // Depends on collective scope
-    >{},
+      ctx::Context,               // Everything depends on theContext
+      messaging::ActiveMessenger, // Depends on active messenger for RDMA
+      collective::CollectiveAlg   // Depends on collective scope
+      >{},
     RuntimeDeps<>{}
   );
 
   p_->registerComponent<location::LocationManager>(
     &theLocMan,
     StartupDeps<
-      ctx::Context,               // Everything depends on theContext
-      messaging::ActiveMessenger  // Depends on active messenger for sending
-    >{},
+      ctx::Context,              // Everything depends on theContext
+      messaging::ActiveMessenger // Depends on active messenger for sending
+      >{},
     RuntimeDeps<>{}
   );
 
@@ -895,42 +888,42 @@ void Runtime::initializeComponents() {
       ctx::Context,               // Everything depends on theContext
       messaging::ActiveMessenger, // Depends on active messenger for messaging
       sched::Scheduler            // For scheduling work
-    >{},
+      >{},
     RuntimeDeps<>{}
   );
 
   p_->registerComponent<vrt::collection::CollectionManager>(
     &theCollection,
     StartupDeps<
-      ctx::Context,                        // Everything depends on theContext
-      messaging::ActiveMessenger,          // Depends on for messaging
-      group::GroupManager,                 // For broadcasts
-      sched::Scheduler,                    // For scheduling work
-      location::LocationManager,           // For element location
+      ctx::Context,                         // Everything depends on theContext
+      messaging::ActiveMessenger,           // Depends on for messaging
+      group::GroupManager,                  // For broadcasts
+      sched::Scheduler,                     // For scheduling work
+      location::LocationManager,            // For element location
       vrt::collection::balance::NodeLBData, // For LB data collection
-      vrt::collection::balance::LBManager  // For load balancing
-    >{},
+      vrt::collection::balance::LBManager   // For load balancing
+      >{},
     RuntimeDeps<>{}
   );
 
   p_->registerComponent<rdma::Manager>(
     &theHandleRDMA,
     StartupDeps<
-      ctx::Context,                       // Everything depends on theContext
-      messaging::ActiveMessenger,         // Depends on active messenger for messaging
+      ctx::Context,               // Everything depends on theContext
+      messaging::ActiveMessenger, // Depends on active messenger for messaging
       vrt::collection::CollectionManager, // For RDMA on collection elements
       objgroup::ObjGroupManager,          // For RDMA on objgroups
       collective::CollectiveAlg           // Depends on collective scope
-    >{},
+      >{},
     RuntimeDeps<>{}
   );
 
   p_->registerComponent<vrt::collection::balance::NodeLBData>(
     &theNodeLBData,
     StartupDeps<
-      ctx::Context,                       // Everything depends on theContext
-      phase::PhaseManager                 // For phase structure
-    >{},
+      ctx::Context,       // Everything depends on theContext
+      phase::PhaseManager // For phase structure
+      >{},
     RuntimeDeps<>{}
   );
 
@@ -938,45 +931,43 @@ void Runtime::initializeComponents() {
     &theLBDataReader,
     StartupDeps<
       ctx::Context,                        // Everything depends on theContext
-      vrt::collection::balance::NodeLBData  // Depends on node LB data for input
-    >{},
+      vrt::collection::balance::NodeLBData // Depends on node LB data for input
+      >{},
     RuntimeDeps<>{}
   );
 
   p_->registerComponent<vrt::collection::balance::LBManager>(
     &theLBManager,
     StartupDeps<
-      ctx::Context,                        // Everything depends on theContext
-      util::memory::MemoryUsage,           // Output mem usage on phase change
+      ctx::Context,                         // Everything depends on theContext
+      util::memory::MemoryUsage,            // Output mem usage on phase change
       vrt::collection::balance::NodeLBData, // For LB data collection
-      phase::PhaseManager                  // For phase structure
-    >{},
+      phase::PhaseManager                   // For phase structure
+      >{},
     RuntimeDeps<>{}
   );
 
   p_->registerComponent<timetrigger::TimeTriggerManager>(
     &theTimeTrigger,
-    StartupDeps<
-      ctx::Context                         // Everything depends on theContext
-    >{},
+    StartupDeps<ctx::Context // Everything depends on theContext
+                >{},
     RuntimeDeps<>{}
   );
 
   p_->registerComponent<phase::PhaseManager>(
     &thePhase,
     StartupDeps<
-      ctx::Context,                        // Everything depends on theContext
-      objgroup::ObjGroupManager            // Since it's an objgroup
-    >{},
+      ctx::Context,             // Everything depends on theContext
+      objgroup::ObjGroupManager // Since it's an objgroup
+      >{},
     RuntimeDeps<>{}
   );
 
 # if vt_check_enabled(perf)
   p_->registerComponent<metrics::PerfData>(
     &thePerfData,
-    StartupDeps<
-      ctx::Context                        // Everything depends on theContext
-    >{},
+    StartupDeps<ctx::Context // Everything depends on theContext
+                >{},
     RuntimeDeps<>{}
   );
 # endif
diff --git a/tests/unit/runtime/test_component_construction.cc b/tests/unit/runtime/test_component_construction.cc
index d2696923b..0792cba0b 100644
--- a/tests/unit/runtime/test_component_construction.cc
+++ b/tests/unit/runtime/test_component_construction.cc
@@ -112,8 +112,8 @@ TEST_F(TestComponentConstruction, test_component_construct_dispatch_args_2) {
 
   auto p = std::make_unique<ComponentPack>();
   p->registerComponent<MyComponentArgs>(
-    &my_dumb_pointer, StartupDeps<>{}, RuntimeDeps<>{},
-    10, my_int, typename MyComponentArgs::MyTag{}
+    &my_dumb_pointer, StartupDeps<>{}, RuntimeDeps<>{}, 10, my_int,
+    typename MyComponentArgs::MyTag{}
   );
   p->add<MyComponentArgs>();
   p->construct();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Distinguish startup dependencies from use dependencies in VT components
1 participant