struct
#include <src/vt/runtime/runtime.h>
Runtime The VT runtime that manages startup/shutdown and pointers to all the live components for a runtime instance.
The runtime contains an instance of VT that is initialized/finalized. It performs the sequence of operations for correct initialization and finalization of all the components that make up a runtime.
The runtime can be configured to catch signals when errors occur and dump a stack trace.
Public types
-
template<typename ComponentT>using ComponentPtrType = ComponentT*
Public static variables
- static bool volatile sig_user_1_
Constructors, destructors, conversion operators
-
Runtime(int& argc,
char**& argv,
bool const interop_mode = false,
MPI_Comm in_comm = MPI_COMM_WORLD,
RuntimeInstType const in_instance = RuntimeInstType::DefaultInstance,
arguments::
AppConfig const* appConfig = nullptr) - Initialize a VT runtime.
- Runtime(Runtime const&) deleted
- Runtime(Runtime&&) deleted
- ~Runtime() virtual
Public functions
- auto operator=(Runtime const&) -> Runtime& deleted
- auto isLive() const -> bool
- Check if runtime is live.
- auto progress(TimeType current_time) -> int
- Invoke all the progress functions.
- auto needsCurrentTime() -> bool
- Check if any pollable components needs the current time.
- auto isTerminated() const -> bool
- Check if runtime has terminated.
- auto isFinalizable() const -> bool
- Check if runtime is finalizable.
- auto isInitialized() const -> bool
- Check if runtime is initialized.
- auto isFinalized() const -> bool
- Check if runtime is finalized.
- auto hasSchedRun() const -> bool
- Check if scheduler has run.
- void reset()
- Reset the runtime after termination is reached to use it again.
- auto initialize(bool const force_now = false) -> bool
- Initialize the runtime.
- auto finalize(bool const force_now = false, bool const disable_sig = true) -> bool
- Finalize the runtime.
- void computeAndPrintDiagnostics()
- Compute the diagnostics across the components and print them if requested at the end of the program.
- void abort(std::string const abort_str, ErrorCodeType const code)
- Abort–die immediately after spitting out error message.
- void output(std::string const abort_str, ErrorCodeType const code, bool error = false, bool decorate = true, bool formatted = true)
- Output a message and possibly die.
- auto getInstanceID() const -> RuntimeInstType
- Get runtime instance ID.
- void systemSync()
- Do a sync.
- void checkForArgumentErrors()
- Check for input argument errors.
- void printMemoryFootprint() const
- Print memory footprint for all live components.
-
auto getAppConfig() const -> arguments::
AppConfig const * - Get the app config before the runtime has setup all the components and VT is fully initialized.
Public variables
-
ComponentPtrType<arguments::
ArgConfig> theArgConfig -
ComponentPtrType<messaging::
ActiveMessenger> theMsg -
ComponentPtrType<ctx::
Context> theContext -
ComponentPtrType<event::
AsyncEvent> theEvent -
ComponentPtrType<term::
TerminationDetector> theTerm -
ComponentPtrType<collective::
CollectiveAlg> theCollective -
ComponentPtrType<pool::
Pool> thePool -
ComponentPtrType<rdma::
RDMAManager> theRDMA -
ComponentPtrType<sched::
Scheduler> theSched -
ComponentPtrType<location::
LocationManager> theLocMan -
ComponentPtrType<vrt::
VirtualContextManager> theVirtualManager -
ComponentPtrType<vrt::
collection:: CollectionManager> theCollection -
ComponentPtrType<group::
GroupManager> theGroup -
ComponentPtrType<pipe::
PipeManager> theCB -
ComponentPtrType<objgroup::
ObjGroupManager> theObjGroup -
ComponentPtrType<util::
memory:: MemoryUsage> theMemUsage -
ComponentPtrType<rdma::
Manager> theHandleRDMA -
ComponentPtrType<vrt::
collection:: balance:: NodeLBData> theNodeLBData -
ComponentPtrType<vrt::
collection:: balance:: LBDataRestartReader> theLBDataReader -
ComponentPtrType<vrt::
collection:: balance:: LBManager> theLBManager -
ComponentPtrType<timetrigger::
TimeTriggerManager> theTimeTrigger -
ComponentPtrType<phase::
PhaseManager> thePhase -
ComponentPtrType<epoch::
EpochManip> theEpoch - bool has_physical_node_info
- int physical_node_id
- int physical_num_nodes
- int physical_node_size
- int physical_node_rank
Protected static functions
- static void sigHandler(int sig)
- SIGSEGV signal handler.
- static void sigHandlerBus(int sig)
- SIGBUS signal handler.
- static void sigHandlerUsr1(int sig)
- SIGUSR1 signal handler.
- static void sigHandlerINT(int sig)
- SIGINT signal handler.
- static void termHandler()
- std::terminate handler
Protected functions
- auto tryInitialize() -> bool
- Try to initialize.
- auto tryFinalize(bool const disable_sig = true) -> bool
- Try to finalize.
- void initializeErrorHandlers()
- Initialize error handlers.
- void initializeComponents()
- Initialize all the VT components.
- void initializeOptionalComponents()
- Initialize optional components, like workers.
- void initializeTDCallbacks()
- Initialize TD callbacks.
- auto needLBDataRestartReader() -> bool
- Check if we should create a LB data restart reader component.
- void setup()
- Perform setup actions, such as registering a termination detector action for detecting global termination.
- void terminationHandler()
- Handler when global termination is reached.
- void printStartupBanner()
- Print a very informative startup banner.
-
void printShutdownBanner(term::
TermCounterType const& num_units, std::size_t const coll_epochs) - Print the shutdown banner.
- void pauseForDebugger()
- Pause for debugger at startup.
- void setupSignalHandler()
- Setup the handlers for SIGSEGV, SIGBUS and SIGUSR1.
- void setupSignalHandlerINT()
- Setup the SIGINT signal handler.
- void setupTerminateHandler()
- Setup the std::terminate handler.
Protected variables
- bool finalize_on_term_
- bool initialized_
- bool finalized_
- bool aborted_
- bool runtime_active_
- bool is_interop_
- bool sig_handlers_disabled_
- MPI_Comm initial_communicator_
-
std::unique_ptr<component::
ComponentPack> p_ -
std::unique_ptr<arguments::
ArgConfig> arg_config_ -
arguments::
AppConfig const * app_config_
Function documentation
vt:: runtime:: Runtime:: Runtime(int& argc,
char**& argv,
bool const interop_mode = false,
MPI_Comm in_comm = MPI_COMM_WORLD,
RuntimeInstType const in_instance = RuntimeInstType::DefaultInstance,
arguments:: AppConfig const* appConfig = nullptr)
Initialize a VT runtime.
Parameters | |
---|---|
argc in | argument count (modified after VT extracts) |
argv in | arguments (modified after VT extracts) |
interop_mode in | whether running in interoperability mode |
in_comm in | the MPI communicator (if in interoperability mode) |
in_instance in | the runtime instance to set |
appConfig |
\internalUnder interop mode, MPI is not initialized or finalized by the runtime. This can be used to embed VT into a larger context.
When not running in interop mode, MPI is initialized in the constructor and finalized in the destructor.
=========================================================================
Notes on lifecycle for the ArgConfig/AppConfig
- After
vt::Runtime
is constructed, the ArgConfig lives inarg_config_
andapp_config_
contains a pointer to the internals. - After the pack registers the ArgConfig component,
arg_config_
is no longer valid. The config is in a tuple awaiting construction—thus, we can't easily access it. app_config_ remains valid during this time - After construction, the
arg_config_
is in the componenttheConfig()
and can be accessed normally - After
Runtime::
is called but before the pack is destroyed, we extract thefinalize() ArgConfig
from the component and put it back inarg_config_
for use after. From then on, until the
vt::Runtime
is destroyed or VT is re-initializedarg_config_
will contain the configuration.For this to all work correctly, the
vt_debug_print
infrastructure callsvt::
which always grabs the correct app config, from the component singleton or theconfig:: preConfig() vt::Runtime
, or provides stubbed arguments as a fallback.
bool vt:: runtime:: Runtime:: isLive() const
Check if runtime is live.
Returns | has been initialized and not subsequently finalized |
---|
bool vt:: runtime:: Runtime:: needsCurrentTime()
Check if any pollable components needs the current time.
Returns | whether it needs the current time |
---|
bool vt:: runtime:: Runtime:: isTerminated() const
Check if runtime has terminated.
Returns | whether it has terminated |
---|
bool vt:: runtime:: Runtime:: isFinalizable() const
Check if runtime is finalizable.
Returns | whether it is finalizable |
---|
bool vt:: runtime:: Runtime:: isInitialized() const
Check if runtime is initialized.
Returns | whether it is initialized |
---|
bool vt:: runtime:: Runtime:: isFinalized() const
Check if runtime is finalized.
Returns | whether it is finalized |
---|
bool vt:: runtime:: Runtime:: hasSchedRun() const
Check if scheduler has run.
Returns | whether it has run |
---|
bool vt:: runtime:: Runtime:: initialize(bool const force_now = false)
Initialize the runtime.
Parameters | |
---|---|
force_now in | whether to force initialization regardless of state |
Returns | whether it initialized or not |
bool vt:: runtime:: Runtime:: finalize(bool const force_now = false,
bool const disable_sig = true)
Finalize the runtime.
Parameters | |
---|---|
force_now in | whether to force finalization regardless of state |
disable_sig in | whether to disable signal handlers |
Returns | whether it finalized or not |
void vt:: runtime:: Runtime:: abort(std::string const abort_str,
ErrorCodeType const code)
Abort–die immediately after spitting out error message.
Parameters | |
---|---|
abort_str in | the error message |
code in | the error code to output |
void vt:: runtime:: Runtime:: output(std::string const abort_str,
ErrorCodeType const code,
bool error = false,
bool decorate = true,
bool formatted = true)
Output a message and possibly die.
Parameters | |
---|---|
abort_str in | the message |
code in | the code to throw |
error in | whether it's a fatal error |
decorate in | whether to decorate the message |
formatted in | whether it's already formatted or not |
RuntimeInstType vt:: runtime:: Runtime:: getInstanceID() const
Get runtime instance ID.
Returns | the instance ID |
---|
void vt:: runtime:: Runtime:: systemSync()
Do a sync.
arguments:: AppConfig const * vt:: runtime:: Runtime:: getAppConfig() const
Get the app config before the runtime has setup all the components and VT is fully initialized.
Returns | the app config |
---|
bool vt:: runtime:: Runtime:: tryInitialize() protected
Try to initialize.
Returns | whether it succeeded |
---|
bool vt:: runtime:: Runtime:: tryFinalize(bool const disable_sig = true) protected
Try to finalize.
Parameters | |
---|---|
disable_sig in | whether to disable signal handlers |
Returns | whether it succeeded |
bool vt:: runtime:: Runtime:: needLBDataRestartReader() protected
Check if we should create a LB data restart reader component.
Returns | whether we should create it |
---|
void vt:: runtime:: Runtime:: printShutdownBanner(term:: TermCounterType const& num_units,
std::size_t const coll_epochs) protected
Print the shutdown banner.
Parameters | |
---|---|
num_units in | total number of units processed |
coll_epochs in | total number of collective epochs processed |
Variable documentation
arguments:: AppConfig const * vt:: runtime:: Runtime:: app_config_ protected
App config during startup