SST 12.1.0
Structural Simulation Toolkit
baseComponent.h
1// Copyright 2009-2022 NTESS. Under the terms
2// of Contract DE-NA0003525 with NTESS, the U.S.
3// Government retains certain rights in this software.
4//
5// Copyright (c) 2009-2022, NTESS
6// All rights reserved.
7//
8// This file is part of the SST software package. For license
9// information, see the LICENSE file in the top level directory of the
10// distribution.
11
12#ifndef SST_CORE_BASECOMPONENT_H
13#define SST_CORE_BASECOMPONENT_H
14
15#include "sst/core/clock.h"
16#include "sst/core/componentInfo.h"
17#include "sst/core/eli/elementinfo.h"
18#include "sst/core/event.h"
19#include "sst/core/oneshot.h"
20#include "sst/core/profile/componentProfileTool.h"
21#include "sst/core/simulation.h"
22#include "sst/core/sst_types.h"
23#include "sst/core/statapi/statbase.h"
24#include "sst/core/statapi/statengine.h"
25#include "sst/core/warnmacros.h"
26
27#include <map>
28#include <string>
29
30using namespace SST::Statistics;
31
32namespace SST {
33
34class Component;
36class Clock;
37class Link;
38class LinkMap;
39class Module;
40class Params;
41class Simulation_impl;
42class SubComponent;
44class TimeConverter;
45class UnitAlgebra;
46
47/**
48 * Main component object for the simulation.
49 */
51{
52
53 friend class ComponentExtension;
54 friend class ComponentInfo;
55 friend class SubComponent;
56 friend class SubComponentSlotInfo;
57
58protected:
59 using StatCreateFunction = std::function<Statistics::StatisticBase*(
60 BaseComponent*, Statistics::StatisticProcessingEngine*, const std::string& /*type*/,
61 const std::string& /*name*/, const std::string& /*subId*/, Params&)>;
62
63public:
64 BaseComponent(ComponentId_t id);
65 virtual ~BaseComponent();
66
67 const std::string& getType() const { return my_info->getType(); }
68
69 /** Returns unique component ID */
70 inline ComponentId_t getId() const { return my_info->id; }
71
72 /** Returns Component Statistic load level */
73 inline uint8_t getStatisticLoadLevel() const { return my_info->statLoadLevel; }
74
75 /** Called when SIGINT or SIGTERM has been seen.
76 * Allows components opportunity to clean up external state.
77 */
78 virtual void emergencyShutdown(void) {}
79
80 /** Returns Component/SubComponent Name */
81 inline const std::string& getName() const { return my_info->getName(); }
82
83 /** Returns the name of the parent Component, or, if called on a
84 * Component, the name of that Component. */
85 inline const std::string& getParentComponentName() const { return my_info->getParentComponentName(); }
86
87 /** Used during the init phase. The method will be called each
88 phase of initialization. Initialization ends when no components
89 have sent any data. */
90 virtual void init(unsigned int UNUSED(phase)) {}
91 /** Used during the complete phase after the end of simulation.
92 The method will be called each phase of complete. Complete phase
93 ends when no components have sent any data. */
94 virtual void complete(unsigned int UNUSED(phase)) {}
95 /** Called after all components have been constructed and
96 initialization has completed, but before simulation time has
97 begun. */
98 virtual void setup() {}
99 /** Called after complete phase, but before objects are
100 destroyed. A good place to print out statistics. */
101 virtual void finish() {}
102
103 /** Currently unused function */
104 virtual bool Status() { return 0; }
105
106 /**
107 * Called by the Simulation to request that the component
108 * print it's current status. Useful for debugging.
109 * @param out The Output class which should be used to print component status.
110 */
111 virtual void printStatus(Output& UNUSED(out)) { return; }
112
113 /** Get the core timebase */
115 /** Return the current simulation time as a cycle count*/
116 SimTime_t getCurrentSimCycle() const;
117 /** Return the current priority */
118 int getCurrentPriority() const;
119 /** Return the elapsed simulation time as a time */
121 /** Return the end simulation time as a cycle count*/
122 SimTime_t getEndSimCycle() const;
123 /** Return the end simulation time as a time */
125 /** Return the end simulation time as a time */
127 __attribute__((deprecated("getFinalSimTime() has been deprecated and will be removed in SST 13. It has been "
128 "replaced by getEndSimTime().")));
129 /** Get this instance's parallel rank */
130 RankInfo getRank() const;
131 /** Get the number of parallel ranks in the simulation */
132 RankInfo getNumRanks() const;
133 /** Return the base simulation Output class instance */
135
136 /** return the time since the simulation began in units specified by
137 the parameter.
138 @param tc TimeConverter specifying the units */
139 SimTime_t getCurrentSimTime(TimeConverter* tc) const;
140 /** return the time since the simulation began in the default timebase */
141 inline SimTime_t getCurrentSimTime() const { return getCurrentSimTime(my_info->defaultTimeBase); }
142 /** return the time since the simulation began in timebase specified
143 @param base Timebase frequency in SI Units */
144 SimTime_t getCurrentSimTime(const std::string& base) const;
145
146 /** Utility function to return the time since the simulation began in nanoseconds */
147 SimTime_t getCurrentSimTimeNano() const;
148 /** Utility function to return the time since the simulation began in microseconds */
149 SimTime_t getCurrentSimTimeMicro() const;
150 /** Utility function to return the time since the simulation began in milliseconds */
151 SimTime_t getCurrentSimTimeMilli() const;
152
153 /** Get the amount of real-time spent executing the run phase of
154 * the simulation.
155 *
156 * @return real-time in seconds spent executing the run phase
157 */
158 double getRunPhaseElapsedRealTime() const;
159
160 /** Get the amount of real-time spent executing the init phase of
161 * the simulation.
162 *
163 * @return real-time in seconds spent executing the init phase
164 */
165 double getInitPhaseElapsedRealTime() const;
166
167 /** Get the amount of real-time spent executing the complete phase of
168 * the simulation.
169 *
170 * @return real-time in seconds spent executing the complete phase
171 */
172 double getCompletePhaseElapsedRealTime() const;
173
174
175protected:
176 /** Check to see if the run mode was set to INIT
177 @return true if simulation run mode is set to INIT
178 */
179 bool isSimulationRunModeInit() const;
180
181 /** Check to see if the run mode was set to RUN
182 @return true if simulation run mode is set to RUN
183 */
184 bool isSimulationRunModeRun() const;
185
186 /** Check to see if the run mode was set to BOTH
187 @return true if simulation run mode is set to BOTH
188 */
189 bool isSimulationRunModeBoth() const;
190
191 /** Returns the output directory of the simulation
192 * @return Directory in which simulation outputs should be
193 * placed. Returns empty string if output directory not set by
194 * user.
195 */
196 std::string& getOutputDirectory() const;
197
198 /** Signifies that a library is required for this simulation.
199 * Causes the Factory to verify that the required library is
200 * loaded.
201 *
202 * NOTE: This function should rarely be required, as most
203 * dependencies are automatically detected in the simulator core.
204 * However, if the component uses an event from another library
205 * that is not wholly defined in a header file, this call may be
206 * required to ensure that all the code from the event is loaded.
207 * Similarly, if you use a class from another library that does
208 * not have ELI information, this call may also be required to
209 * make sure all dependencies are loaded.
210 *
211 * @param name Name of library this BaseComponent depends on
212 */
213 void requireLibrary(const std::string& name);
214
215
216 /** Determine if a port name is connected to any links */
217 bool isPortConnected(const std::string& name) const;
218
219 /** Configure a Link
220 * @param name - Port Name on which the link to configure is attached.
221 * @param time_base - Time Base of the link. If nullptr is passed in, then it
222 * will use the Component defaultTimeBase
223 * @param handler - Optional Handler to be called when an Event is received
224 * @return A pointer to the configured link, or nullptr if an error occured.
225 */
226 Link* configureLink(const std::string& name, TimeConverter* time_base, Event::HandlerBase* handler = nullptr);
227 /** Configure a Link
228 * @param name - Port Name on which the link to configure is attached.
229 * @param time_base - Time Base of the link as a string
230 * @param handler - Optional Handler to be called when an Event is received
231 * @return A pointer to the configured link, or nullptr if an error occured.
232 */
233 Link* configureLink(const std::string& name, const std::string& time_base, Event::HandlerBase* handler = nullptr);
234 /** Configure a Link
235 * @param name - Port Name on which the link to configure is attached.
236 * @param time_base - Time Base of the link as a UnitAlgebra
237 * @param handler - Optional Handler to be called when an Event is received
238 * @return A pointer to the configured link, or nullptr if an error occured.
239 */
240 Link* configureLink(const std::string& name, const UnitAlgebra& time_base, Event::HandlerBase* handler = nullptr);
241 /** Configure a Link
242 * @param name - Port Name on which the link to configure is attached.
243 * @param handler - Optional Handler to be called when an Event is received
244 * @return A pointer to the configured link, or nullptr if an error occured.
245 */
246 Link* configureLink(const std::string& name, Event::HandlerBase* handler = nullptr);
247
248 /** Configure a SelfLink (Loopback link)
249 * @param name - Name of the self-link port
250 * @param time_base - Time Base of the link. If nullptr is passed in, then it
251 * will use the Component defaultTimeBase
252 * @param handler - Optional Handler to be called when an Event is received
253 * @return A pointer to the configured link, or nullptr if an error occured.
254 */
255 Link* configureSelfLink(const std::string& name, TimeConverter* time_base, Event::HandlerBase* handler = nullptr);
256 /** Configure a SelfLink (Loopback link)
257 * @param name - Name of the self-link port
258 * @param time_base - Time Base of the link as a string
259 * @param handler - Optional Handler to be called when an Event is received
260 * @return A pointer to the configured link, or nullptr if an error occured.
261 */
262 Link*
263 configureSelfLink(const std::string& name, const std::string& time_base, Event::HandlerBase* handler = nullptr);
264 /** Configure a SelfLink (Loopback link)
265 * @param name - Name of the self-link port
266 * @param time_base - Time Base of the link as a UnitAlgebra
267 * @param handler - Optional Handler to be called when an Event is received
268 * @return A pointer to the configured link, or nullptr if an error occured.
269 */
270 Link*
271 configureSelfLink(const std::string& name, const UnitAlgebra& time_base, Event::HandlerBase* handler = nullptr);
272 /** Configure a SelfLink (Loopback link)
273 * @param name - Name of the self-link port
274 * @param handler - Optional Handler to be called when an Event is received
275 * @return A pointer to the configured link, or nullptr if an error occured.
276 */
277 Link* configureSelfLink(const std::string& name, Event::HandlerBase* handler = nullptr);
278
279 /** Registers a clock for this component.
280 @param freq Frequency for the clock in SI units
281 @param handler Pointer to Clock::HandlerBase which is to be invoked
282 at the specified interval
283 @param regAll Should this clock period be used as the default
284 time base for all of the links connected to this component
285 @return the TimeConverter object representing the clock frequency
286 */
287 TimeConverter* registerClock(const std::string& freq, Clock::HandlerBase* handler, bool regAll = true);
288
289 /** Registers a clock for this component.
290 @param freq Frequency for the clock as a UnitAlgebra object
291 @param handler Pointer to Clock::HandlerBase which is to be invoked
292 at the specified interval
293 @param regAll Should this clock period be used as the default
294 time base for all of the links connected to this component
295 @return the TimeConverter object representing the clock frequency
296 */
297 TimeConverter* registerClock(const UnitAlgebra& freq, Clock::HandlerBase* handler, bool regAll = true);
298
299 /** Registers a clock for this component.
300 @param tc TimeConverter object specifying the clock frequency
301 @param handler Pointer to Clock::HandlerBase which is to be invoked
302 at the specified interval
303 @param regAll Should this clock period be used as the default
304 time base for all of the links connected to this component
305 @return the TimeConverter object representing the clock frequency
306 */
307 TimeConverter* registerClock(TimeConverter* tc, Clock::HandlerBase* handler, bool regAll = true);
308
309 /** Removes a clock handler from the component */
311
312 /** Reactivates an existing Clock and Handler
313 * @return time of next time clock handler will fire
314 */
315 Cycle_t reregisterClock(TimeConverter* freq, Clock::HandlerBase* handler);
316 /** Returns the next Cycle that the TimeConverter would fire */
317 Cycle_t getNextClockCycle(TimeConverter* freq);
318
319 /** Registers a default time base for the component and optionally
320 sets the the component's links to that timebase. Useful for
321 components which do not have a clock, but would like a default
322 timebase.
323 @param base Frequency for the clock in SI units
324 @param regAll Should this clock period be used as the default
325 time base for all of the links connected to this component
326 */
327 TimeConverter* registerTimeBase(const std::string& base, bool regAll = true);
328
329 TimeConverter* getTimeConverter(const std::string& base) const;
330 TimeConverter* getTimeConverter(const UnitAlgebra& base) const;
331
332 bool isStatisticShared(const std::string& statName, bool include_me = false)
333 {
334 if ( include_me ) {
335 if ( doesComponentInfoStatisticExist(statName) ) { return true; }
336 }
337 if ( my_info->sharesStatistics() ) {
338 return my_info->parent_info->component->isStatisticShared(statName, true);
339 }
340 else {
341 return false;
342 }
343 }
344
345 template <typename T>
347 createStatistic(SST::Params& params, StatisticId_t id, const std::string& name, const std::string& statSubId)
348 {
349 /* I would prefer to avoid this std::function with dynamic cast,
350 * but the code is just a lot cleaner and avoids many unnecessary template instantiations
351 * doing it this way. At some point in the future, we would need to clean up
352 * the rule around enabling all statistics to make this better
353 */
354
355 StatCreateFunction create = [=](BaseComponent* comp, Statistics::StatisticProcessingEngine* engine,
356 const std::string& type, const std::string& name, const std::string& subId,
358 return engine->createStatistic<T>(comp, type, name, subId, params);
359 };
360
361 // We follow two distinct paths depending on if it is enable all, versus explicitly enabled
362 // Enable all is "scoped" to the (sub)component
363 // Explicitly enabled stats are assigned component-unique IDs and can be shared across subcomponents
364 // so creation and management happens in the parent component
365 Statistics::StatisticBase* base_stat =
366 id == STATALL_ID ? createEnabledAllStatistic(params, name, statSubId, std::move(create))
367 : getParentComponent()->createExplicitlyEnabledStatistic(
368 params, id, name, statSubId, std::move(create));
369
370 // Ugh, dynamic casts hurt my eyes, but I must do this
371 auto* statistic = dynamic_cast<Statistics::Statistic<T>*>(base_stat);
372 if ( statistic ) { return statistic; }
373 else {
374 fatal(
375 __LINE__, __FILE__, "createStatistic", 1, "failed to cast created statistic '%s' to expected type",
376 name.c_str());
377 return nullptr; // avoid compiler warnings
378 }
379 }
380
381 template <typename T>
383 createNullStatistic(SST::Params& params, const std::string& name, const std::string& statSubId = "")
384 {
385 auto* engine = Statistics::StatisticProcessingEngine::getInstance();
386 return engine->createStatistic<T>(my_info->component, "sst.NullStatistic", name, statSubId, params);
387 }
388
389 /** Registers a statistic.
390 If Statistic is allowed to run (controlled by Python runtime parameters),
391 then a statistic will be created and returned. If not allowed to run,
392 then a NullStatistic will be returned. In either case, the returned
393 value should be used for all future Statistic calls. The type of
394 Statistic and the Collection Rate is set by Python runtime parameters.
395 If no type is defined, then an Accumulator Statistic will be provided
396 by default. If rate set to 0 or not provided, then the statistic will
397 output results only at end of sim (if output is enabled).
398 @param statName Primary name of the statistic. This name must match the
399 defined ElementInfoStatistic in the component, and must also
400 be enabled in the Python input file.
401 @param statSubId An additional sub name for the statistic
402 @return Either a created statistic of desired type or a NullStatistic
403 depending upon runtime settings.
404 */
405 template <typename T>
407 SST::Params& params, const std::string& statName, const std::string& statSubId = "", bool inserting = false)
408 {
409 if ( my_info->enabledStatNames ) {
410 auto iter = my_info->enabledStatNames->find(statName);
411 if ( iter != my_info->enabledStatNames->end() ) {
412 // valid, enabled statistic
413 // During initialization, the component should have assigned a mapping between
414 // the local name and globally unique stat ID
415 StatisticId_t id = iter->second;
416 return createStatistic<T>(params, id, statName, statSubId);
417 }
418 }
419
420 // if we got here, this is not a stat we explicitly enabled
421 if ( inserting || doesComponentInfoStatisticExist(statName) ) {
422 // this is a statistic that I registered
423 if ( my_info->enabledAllStats ) { return createStatistic<T>(params, STATALL_ID, statName, statSubId); }
424 else if ( my_info->parent_info && my_info->canInsertStatistics() ) {
425 // I did not explicitly enable nor enable all
426 // but I can insert statistics into my parent
427 // and my parent may have enabled all
428 return my_info->parent_info->component->registerStatistic<T>(params, statName, statSubId, true);
429 }
430 else {
431 // I did not enable, I cannot insert into parent - so send back null stat
432 return my_info->component->createNullStatistic<T>(params, statName, statSubId);
433 }
434 }
435 else if ( my_info->parent_info && my_info->sharesStatistics() ) {
436 // this is not a statistic that I registered
437 // but my parent can share statistics, maybe they enabled
438 return my_info->parent_info->component->registerStatistic<T>(params, statName, statSubId);
439 }
440 else {
441 // not a valid stat and I won't be able to share my parent's statistic
442 fatal(
443 __LINE__, __FILE__, "registerStatistic", 1, "attempting to register unknown statistic '%s'",
444 statName.c_str());
445 return nullptr; // get rid of warning
446 }
447 }
448
449 template <typename T>
450 Statistics::Statistic<T>* registerStatistic(const std::string& statName, const std::string& statSubId = "")
451 {
452 SST::Params empty {};
453 return registerStatistic<T>(empty, statName, statSubId);
454 }
455
456 template <typename... Args>
457 Statistics::Statistic<std::tuple<Args...>>*
458 registerMultiStatistic(const std::string& statName, const std::string& statSubId = "")
459 {
460 SST::Params empty {};
461 return registerStatistic<std::tuple<Args...>>(empty, statName, statSubId);
462 }
463
464 template <typename... Args>
465 Statistics::Statistic<std::tuple<Args...>>*
466 registerMultiStatistic(SST::Params& params, const std::string& statName, const std::string& statSubId = "")
467 {
468 return registerStatistic<std::tuple<Args...>>(params, statName, statSubId);
469 }
470
471 template <typename T>
472 Statistics::Statistic<T>* registerStatistic(const char* statName, const char* statSubId = "")
473 {
474 return registerStatistic<T>(std::string(statName), std::string(statSubId));
475 }
476
477 /** Called by the Components and Subcomponent to perform a statistic Output.
478 * @param stat - Pointer to the statistic.
479 * @param EndOfSimFlag - Indicates that the output is occurring at the end of simulation.
480 */
482
483 /** Performs a global statistic Output.
484 * This routine will force ALL Components and Subcomponents to output their statistic information.
485 * This may lead to unexpected results if the statistic counts or data is reset on output.
486 * NOTE: Currently, this function will only output statistics that are on the same rank.
487 */
489
490 /** Registers a profiling point.
491 This function will register a profiling point.
492 @param point Point to resgister
493 @return Either a pointer to a created T::ProfilePoint or nullptr if not enabled.
494 */
495 template <typename T>
496 typename T::ProfilePoint* registerProfilePoint(const std::string& pointName)
497 {
498 std::string full_point_name = getType() + "." + pointName;
499 auto tools = getComponentProfileTools(full_point_name);
500 if ( tools.size() == 0 ) return nullptr;
501
502 typename T::ProfilePoint* ret = new typename T::ProfilePoint();
503 for ( auto* x : tools ) {
504 T* tool = dynamic_cast<T*>(x);
505 if ( nullptr == tool ) {
506 // Not the right type, fatal
507 fatal(
508 CALL_INFO_LONG, 1, "ERROR: wrong type of profiling tool for profiling point %s)\n",
509 pointName.c_str());
510 }
511 ret->registerProfilePoint(tool, pointName, getId(), getName(), getType());
512 }
513 return ret;
514 }
515
516 /** Loads a module from an element Library
517 * @param type Fully Qualified library.moduleName
518 * @param params Parameters the module should use for configuration
519 * @return handle to new instance of module, or nullptr on failure.
520 */
521 Module* loadModule(const std::string& type, Params& params)
522 __attribute__((deprecated("This version of loadModule() has been deprecated. Please use the new templated "
523 "version that uses Module APIs")));
524
525 /** Loads a module from an element Library
526 * @param type Fully Qualified library.moduleName
527 * @param params Parameters the module should use for configuration
528 * @return handle to new instance of module, or nullptr on failure.
529 */
530 template <class T, class... ARGS>
531 T* loadModule(const std::string& type, Params& params, ARGS... args)
532 {
533
534 // Check to see if this can be loaded with new API or if we have to fallback to old
535 return Factory::getFactory()->CreateWithParams<T>(type, params, params, args...);
536 }
537
538protected:
539 // When you direct load, the ComponentExtension does not need any
540 // ELI information and if it has any, it will be ignored. The
541 // extension will be loaded as if it were part of the parent
542 // BaseComponent and will share all that components ELI
543 // information.
544 template <class T, class... ARGS>
545 T* loadComponentExtension(ARGS... args)
546 {
547 ComponentExtension* ret = new T(my_info->id, args...);
548 return static_cast<T*>(ret);
549 }
550
551 /**
552 Check to see if a given element type is loadable with a particular API
553
554 @param name - Name of element to check in lib.name format
555 @return True if loadable as the API specified as the template parameter
556 */
557 template <class T>
558 bool isSubComponentLoadableUsingAPI(const std::string& type)
559 {
560 return Factory::getFactory()->isSubComponentLoadableUsingAPI<T>(type);
561 }
562
563 /**
564 Check to see if the element type loaded by the user into the.
565 specified slot is loadable with a particular API. This will
566 only check slot index 0. If you need to check other slots,
567 please use the SubComponentSlotInfo.
568
569 @param slot_name - Name of slot to check
570 @return True if loadable as the API specified as the template parameter
571 */
572 template <class T>
573 bool isUserSubComponentLoadableUsingAPI(const std::string& slot_name)
574 {
575 // Get list of ComponentInfo objects and make sure that there is
576 // only one SubComponent put into this slot
577 // const std::vector<ComponentInfo>& subcomps = my_info->getSubComponents();
578 const std::map<ComponentId_t, ComponentInfo>& subcomps = my_info->getSubComponents();
579 int sub_count = 0;
580 int index = -1;
581 for ( auto& ci : subcomps ) {
582 if ( ci.second.getSlotName() == slot_name ) {
583 index = ci.second.getSlotNum();
584 sub_count++;
585 }
586 }
587
588 if ( sub_count > 1 ) {
589 SST::Output outXX("SubComponentSlotWarning: ", 0, 0, Output::STDERR);
590 outXX.fatal(
591 CALL_INFO, 1,
592 "Error: ComponentSlot \"%s\" in component \"%s\" only allows for one SubComponent, %d provided.\n",
593 slot_name.c_str(), my_info->getType().c_str(), sub_count);
594 }
595
596 return isUserSubComponentLoadableUsingAPIByIndex<T>(slot_name, index);
597 }
598
599 /**
600 Loads an anonymous subcomponent (not defined in input file to
601 SST run).
602
603 @param type tyupe of subcomponent to load in lib.name format
604 @param slot_name name of the slot to load subcomponent into
605 @param slot_num index of the slot to load subcomponent into
606 @param share_flags Share flags to be used by subcomponent
607 @param params Params object to be passed to subcomponent
608 @param args Arguments to be passed to constructor. This
609 signature is defined in the API definition
610
611 For ease in backward compatibility to old API, this call will
612 try to load using new API and will fallback to old if
613 unsuccessful.
614 */
615 template <class T, class... ARGS>
617 const std::string& type, const std::string& slot_name, int slot_num, uint64_t share_flags, Params& params,
618 ARGS... args)
619 {
620
621 share_flags = share_flags & ComponentInfo::USER_FLAGS;
622 ComponentId_t cid = my_info->addAnonymousSubComponent(my_info, type, slot_name, slot_num, share_flags);
623 ComponentInfo* sub_info = my_info->findSubComponent(cid);
624
625 // This shouldn't happen since we just put it in, but just in case
626 if ( sub_info == nullptr ) return nullptr;
627
628 // Check to see if this can be loaded with new API or if we have to fallback to old
629 if ( isSubComponentLoadableUsingAPI<T>(type) ) {
630 auto ret = Factory::getFactory()->CreateWithParams<T>(type, params, sub_info->id, params, args...);
631 return ret;
632 }
633 return nullptr;
634 }
635
636 /**
637 Loads a user defined subcomponent (defined in input file to SST
638 run). This version does not allow share flags (set to
639 SHARE_NONE) or constructor arguments.
640
641 @param slot_name name of the slot to load subcomponent into
642
643 For ease in backward compatibility to old API, this call will
644 try to load using new API and will fallback to old if
645 unsuccessful.
646 */
647 template <class T>
648 T* loadUserSubComponent(const std::string& slot_name)
649 {
650 return loadUserSubComponent<T>(slot_name, ComponentInfo::SHARE_NONE);
651 }
652
653 /**
654 Loads a user defined subcomponent (defined in input file to SST
655 run).
656
657 @param slot_name name of the slot to load subcomponent into
658 @param share_flags Share flags to be used by subcomponent
659 @param args Arguments to be passed to constructor. This
660 signature is defined in the API definition
661
662 For ease in backward compatibility to old API, this call will
663 try to load using new API and will fallback to old if
664 unsuccessful.
665 */
666 template <class T, class... ARGS>
667 T* loadUserSubComponent(const std::string& slot_name, uint64_t share_flags, ARGS... args)
668 {
669
670 // Get list of ComponentInfo objects and make sure that there is
671 // only one SubComponent put into this slot
672 // const std::vector<ComponentInfo>& subcomps = my_info->getSubComponents();
673 const std::map<ComponentId_t, ComponentInfo>& subcomps = my_info->getSubComponents();
674 int sub_count = 0;
675 int index = -1;
676 for ( auto& ci : subcomps ) {
677 if ( ci.second.getSlotName() == slot_name ) {
678 index = ci.second.getSlotNum();
679 sub_count++;
680 }
681 }
682
683 if ( sub_count > 1 ) {
684 SST::Output outXX("SubComponentSlotWarning: ", 0, 0, Output::STDERR);
685 outXX.fatal(
686 CALL_INFO, 1,
687 "Error: ComponentSlot \"%s\" in component \"%s\" only allows for one SubComponent, %d provided.\n",
688 slot_name.c_str(), my_info->getType().c_str(), sub_count);
689 }
690
691 return loadUserSubComponentByIndex<T, ARGS...>(slot_name, index, share_flags, args...);
692 }
693
694 /** Convenience function for reporting fatal conditions. The
695 function will create a new Output object and call fatal()
696 using the supplied parameters. Before calling
697 Output::fatal(), the function will also print other
698 information about the (sub)component that called fatal and
699 about the simulation state.
700
701 From Output::fatal: Message will be sent to the output
702 location and to stderr. The output will be prepended with the
703 expanded prefix set in the object.
704 NOTE: fatal() will call MPI_Abort(exit_code) to terminate simulation.
705
706 @param line Line number of calling function (use CALL_INFO macro)
707 @param file File name calling function (use CALL_INFO macro)
708 @param func Function name calling function (use CALL_INFO macro)
709 @param exit_code The exit code used for termination of simulation.
710 will be passed to MPI_Abort()
711 @param format Format string. All valid formats for printf are available.
712 @param ... Arguments for format.
713 */
714 void fatal(uint32_t line, const char* file, const char* func, int exit_code, const char* format, ...) const
715 __attribute__((format(printf, 6, 7)));
716
717 /** Convenience function for testing for and reporting fatal
718 conditions. If the condition holds, fatal() will be called,
719 otherwise, the function will return. The function will create
720 a new Output object and call fatal() using the supplied
721 parameters. Before calling Output::fatal(), the function will
722 also print other information about the (sub)component that
723 called fatal and about the simulation state.
724
725 From Output::fatal: Message will be sent to the output
726 location and to stderr. The output will be prepended with the
727 expanded prefix set in the object.
728 NOTE: fatal() will call MPI_Abort(exit_code) to terminate simulation.
729
730 @param condition on which to call fatal(); fatal() is called
731 if the bool is false.
732 @param line Line number of calling function (use CALL_INFO macro)
733 @param file File name calling function (use CALL_INFO macro)
734 @param func Function name calling function (use CALL_INFO macro)
735 @param exit_code The exit code used for termination of simulation.
736 will be passed to MPI_Abort()
737 @param format Format string. All valid formats for printf are available.
738 @param ... Arguments for format.
739 */
740 void sst_assert(
741 bool condition, uint32_t line, const char* file, const char* func, int exit_code, const char* format, ...) const
742 __attribute__((format(printf, 7, 8)));
743
744private:
745 SimTime_t processCurrentTimeWithUnderflowedBase(const std::string& base) const;
746
747 void
748 configureCollectionMode(Statistics::StatisticBase* statistic, const SST::Params& params, const std::string& name);
749
750 /**
751 * @brief findExplicitlyEnabledStatistic
752 * @param params
753 * @param id
754 * @param name
755 * @param statSubId
756 * @return that matching stat if the stat already was created for the given ID, otherwise nullptr
757 */
758 Statistics::StatisticBase* createExplicitlyEnabledStatistic(
759 SST::Params& params, StatisticId_t id, const std::string& name, const std::string& statSubId,
760 StatCreateFunction create);
761
762 /**
763 * @brief createStatistic Helper function used by both enable all and explicit enable
764 * @param cpp_params Any parameters given in C++ specific to this statistic
765 * @param python_params Any parameters given in Python for this statistic
766 * @param name The name (different from type) for this statistic
767 * @param statSubId An optional sub ID for this statistic if multiple stats might have the same name
768 * @param create A type-erased factory for creating stats of a particulary type T
769 * @return The statistic created
770 */
771 Statistics::StatisticBase* createStatistic(
772 SST::Params& cpp_params, const SST::Params& python_params, const std::string& name,
773 const std::string& statSubId, bool check_load_level, StatCreateFunction create);
774
775 Statistics::StatisticBase* createEnabledAllStatistic(
776 SST::Params& params, const std::string& name, const std::string& statSubId, StatCreateFunction create);
777
778 void configureAllowedStatParams(SST::Params& params);
779
780 void setDefaultTimeBaseForLinks(TimeConverter* tc);
781
782 void pushValidParams(Params& params, const std::string& type);
783
784 template <class T, class... ARGS>
785 T* loadUserSubComponentByIndex(const std::string& slot_name, int slot_num, int share_flags, ARGS... args)
786 {
787
788 share_flags = share_flags & ComponentInfo::USER_FLAGS;
789
790 // Check to see if the slot exists
791 ComponentInfo* sub_info = my_info->findSubComponent(slot_name, slot_num);
792 if ( sub_info == nullptr ) return nullptr;
793 sub_info->share_flags = share_flags;
794 sub_info->parent_info = my_info;
795
796 if ( isSubComponentLoadableUsingAPI<T>(sub_info->type) ) {
797 auto ret = Factory::getFactory()->CreateWithParams<T>(
798 sub_info->type, *sub_info->params, sub_info->id, *sub_info->params, args...);
799 return ret;
800 }
801 return nullptr;
802 }
803
804 template <class T>
805 bool isUserSubComponentLoadableUsingAPIByIndex(const std::string& slot_name, int slot_num)
806 {
807 // Check to see if the slot exists
808 ComponentInfo* sub_info = my_info->findSubComponent(slot_name, slot_num);
809 if ( sub_info == nullptr ) return false;
810
811 return isSubComponentLoadableUsingAPI<T>(sub_info->type);
812 }
813
814 // Utility function used by fatal and sst_assert
815 void
816 vfatal(uint32_t line, const char* file, const char* func, int exit_code, const char* format, va_list arg) const;
817
818public:
819 SubComponentSlotInfo* getSubComponentSlotInfo(const std::string& name, bool fatalOnEmptyIndex = false);
820
821 /** Retrieve the X,Y,Z coordinates of this component */
822 const std::vector<double>& getCoordinates() const { return my_info->coordinates; }
823
824protected:
826
827 bool isAnonymous() { return my_info->isAnonymous(); }
828
829 bool isUser() { return my_info->isUser(); }
830
831 /** Manually set the default detaulTimeBase */
832 void setDefaultTimeBase(TimeConverter* tc) { my_info->defaultTimeBase = tc; }
833
834 TimeConverter* getDefaultTimeBase() { return my_info->defaultTimeBase; }
835
836 const TimeConverter* getDefaultTimeBase() const { return my_info->defaultTimeBase; }
837
838 bool doesSubComponentExist(const std::string& type);
839
840 /* Get the Simulation */
841 Simulation* getSimulation() const;
842
843 // Does the statisticName exist in the ElementInfoStatistic
844 virtual bool doesComponentInfoStatisticExist(const std::string& statisticName) const;
845 // Return the EnableLevel for the statisticName from the ElementInfoStatistic
846 uint8_t getComponentInfoStatisticEnableLevel(const std::string& statisticName) const;
847 // Return the Units for the statisticName from the ElementInfoStatistic
848 // std::string getComponentInfoStatisticUnits(const std::string& statisticName) const;
849
850 std::vector<Profile::ComponentProfileTool*> getComponentProfileTools(const std::string& point);
851
852private:
853 ComponentInfo* my_info = nullptr;
854 Simulation_impl* sim_ = nullptr;
855 bool isExtension;
856
857 void addSelfLink(const std::string& name);
858 Link* getLinkFromParentSharedPort(const std::string& port);
859
860 using StatNameMap = std::map<std::string, std::map<std::string, Statistics::StatisticBase*>>;
861
862 std::map<StatisticId_t, Statistics::StatisticBase*> m_explicitlyEnabledSharedStats;
863 std::map<StatisticId_t, StatNameMap> m_explicitlyEnabledUniqueStats;
864 StatNameMap m_enabledAllStats;
865
866 BaseComponent* getParentComponent()
867 {
868 ComponentInfo* base_info = my_info;
869 while ( base_info->parent_info ) {
870 base_info = base_info->parent_info;
871 }
872 return base_info->component;
873 }
874};
875
876/**
877 Used to load SubComponents when multiple SubComponents are loaded
878 into a single slot (will also also work when a single SubComponent
879 is loaded).
880 */
882{
883
884 BaseComponent* comp;
885 std::string slot_name;
886 int max_slot_index;
887
888public:
890
891 SubComponentSlotInfo(BaseComponent* comp, const std::string& slot_name) : comp(comp), slot_name(slot_name)
892 {
893 const std::map<ComponentId_t, ComponentInfo>& subcomps = comp->my_info->getSubComponents();
894
895 // Look for all subcomponents with the right slot name
896 max_slot_index = -1;
897 for ( auto& ci : subcomps ) {
898 if ( ci.second.getSlotName() == slot_name ) {
899 if ( ci.second.getSlotNum() > static_cast<int>(max_slot_index) ) {
900 max_slot_index = ci.second.getSlotNum();
901 }
902 }
903 }
904 }
905
906 const std::string& getSlotName() const { return slot_name; };
907
908 bool isPopulated(int slot_num) const
909 {
910 if ( slot_num > max_slot_index ) return false;
911 if ( comp->my_info->findSubComponent(slot_name, slot_num) == nullptr ) return false;
912 return true;
913 }
914
915 bool isAllPopulated() const
916 {
917 for ( int i = 0; i < max_slot_index; ++i ) {
918 if ( comp->my_info->findSubComponent(slot_name, i) == nullptr ) return false;
919 }
920 return true;
921 }
922
923 int getMaxPopulatedSlotNumber() const { return max_slot_index; }
924
925 /**
926 Check to see if the element type loaded by the user into the
927 specified slot index is loadable with a particular API.
928
929 @param slot_num Slot index to check
930 @return True if loadable as the API specified as the template parameter
931 */
932 template <class T>
933 bool isLoadableUsingAPI(int slot_num)
934 {
935 return comp->isUserSubComponentLoadableUsingAPIByIndex<T>(slot_name, slot_num);
936 }
937
938 // Create functions that support the new API
939
940 /**
941 Create a user defined subcomponent (defined in input file to
942 SST run). This call will pass SHARE_NONE to the new
943 subcomponent and will not take constructor arguments. If
944 constructor arguments are needed for the API that is being
945 loaded, the full call to create will need to be used
946 create(slot_num, share_flags, args...).
947
948 @param slot_num Slot index from which to load subcomponent
949
950 This function supports the new API, but is identical to an
951 existing API call. It will try to load using new API and will
952 fallback to old if unsuccessful.
953 */
954 template <typename T>
955 T* create(int slot_num) const
956 {
957 Params empty;
958 return comp->loadUserSubComponentByIndex<T>(slot_name, slot_num, ComponentInfo::SHARE_NONE);
959 // return private_create<T>(slot_num, empty);
960 }
961
962 /**
963 Create a user defined subcomponent (defined in input file to SST
964 run).
965
966 @param slot_num Slot index from which to load subcomponent
967 @param share_flags Share flags to be used by subcomponent
968 @param args Arguments to be passed to constructor. This
969 signature is defined in the API definition
970
971 For ease in backward compatibility to old API, this call will
972 try to load using new API and will fallback to old if
973 unsuccessful.
974 */
975 template <class T, class... ARGS>
976 T* create(int slot_num, uint64_t share_flags, ARGS... args) const
977 {
978 return comp->loadUserSubComponentByIndex<T, ARGS...>(slot_name, slot_num, share_flags, args...);
979 }
980
981 /**
982 Create all user defined subcomponents (defined in input file to SST
983 run) for the slot.
984
985 @param vec Vector of T* that will hold the pointers to the new
986 subcomponents. If an index is not occupied, a nullptr will be
987 put in it's place. All components will be added to the end of
988 the vector, so index N will be at vec.length() + N, where
989 vec.length() is the length of the vector when it is passed to
990 the call.
991 @param share_flags Share flags to be used by subcomponent
992 @param args Arguments to be passed to constructor. This
993 signature is defined in the API definition
994
995 For ease in backward compatibility to old API, this call will
996 try to load using new API and will fallback to old if
997 unsuccessful.
998 */
999 template <typename T, class... ARGS>
1000 void createAll(std::vector<T*>& vec, uint64_t share_flags, ARGS... args) const
1001 {
1002 for ( int i = 0; i <= getMaxPopulatedSlotNumber(); ++i ) {
1003 T* sub = create<T>(i, share_flags, args...);
1004 vec.push_back(sub);
1005 }
1006 }
1007
1008 /**
1009 Create all user defined subcomponents (defined in input file to SST
1010 run) for the slot.
1011
1012 @param vec Vector of pair<int,T*> that will hold the pointers
1013 to the new subcomponents. The int will hold the index from
1014 which the subcomponent wass loaded. Unoccupied indexes will be
1015 skipped. All components will be added to the end of the
1016 vector.
1017 @param share_flags Share flags to be used by subcomponent
1018 @param args Arguments to be passed to constructor. This
1019 signature is defined in the API definition
1020
1021 For ease in backward compatibility to old API, this call will
1022 try to load using new API and will fallback to old if
1023 unsuccessful.
1024 */
1025 template <typename T, class... ARGS>
1026 void createAllSparse(std::vector<std::pair<int, T*>>& vec, uint64_t share_flags, ARGS... args) const
1027 {
1028 for ( int i = 0; i <= getMaxPopulatedSlotNumber(); ++i ) {
1029 T* sub = create<T>(i, share_flags, args...);
1030 if ( sub != nullptr ) vec.push_back(i, sub);
1031 }
1032 }
1033
1034 /**
1035 Create all user defined subcomponents (defined in input file to SST
1036 run) for the slot.
1037
1038 @param vec Vector of T* that will hold the pointers
1039 to the new subcomponents. Unoccupied indexes will be
1040 skipped. All components will be added to the end of the
1041 vector.
1042 @param share_flags Share flags to be used by subcomponent
1043 @param args Arguments to be passed to constructor. This
1044 signature is defined in the API definition
1045
1046 For ease in backward compatibility to old API, this call will
1047 try to load using new API and will fallback to old if
1048 unsuccessful.
1049 */
1050 template <typename T, class... ARGS>
1051 void createAllSparse(std::vector<T*>& vec, uint64_t share_flags, ARGS... args) const
1052 {
1053 for ( int i = 0; i <= getMaxPopulatedSlotNumber(); ++i ) {
1054 T* sub = create<T>(i, share_flags, args...);
1055 if ( sub != nullptr ) vec.push_back(sub);
1056 }
1057 }
1058};
1059
1060} // namespace SST
1061
1062#endif // SST_CORE_BASECOMPONENT_H
Main component object for the simulation.
Definition: baseComponent.h:51
bool isSimulationRunModeInit() const
Check to see if the run mode was set to INIT.
Definition: baseComponent.cc:534
SimTime_t getCurrentSimTimeMilli() const
Utility function to return the time since the simulation began in milliseconds.
Definition: baseComponent.cc:507
TimeConverter * registerTimeBase(const std::string &base, bool regAll=true)
Registers a default time base for the component and optionally sets the the component's links to that...
Definition: baseComponent.cc:197
virtual void complete(unsigned int UNUSED(phase))
Used during the complete phase after the end of simulation.
Definition: baseComponent.h:94
void requireLibrary(const std::string &name)
Signifies that a library is required for this simulation.
Definition: baseComponent.cc:558
bool isSimulationRunModeRun() const
Check to see if the run mode was set to RUN.
Definition: baseComponent.cc:540
Link * configureLink(const std::string &name, TimeConverter *time_base, Event::HandlerBase *handler=nullptr)
Configure a Link.
Definition: baseComponent.cc:266
Link * configureSelfLink(const std::string &name, TimeConverter *time_base, Event::HandlerBase *handler=nullptr)
Configure a SelfLink (Loopback link)
Definition: baseComponent.cc:360
bool isPortConnected(const std::string &name) const
Determine if a port name is connected to any links.
Definition: baseComponent.cc:223
void fatal(uint32_t line, const char *file, const char *func, int exit_code, const char *format,...) const
Convenience function for reporting fatal conditions.
Definition: baseComponent.cc:605
double getRunPhaseElapsedRealTime() const
Get the amount of real-time spent executing the run phase of the simulation.
Definition: baseComponent.cc:516
T * loadUserSubComponent(const std::string &slot_name)
Loads a user defined subcomponent (defined in input file to SST run).
Definition: baseComponent.h:648
const std::string & getName() const
Returns Component/SubComponent Name.
Definition: baseComponent.h:81
virtual void emergencyShutdown(void)
Called when SIGINT or SIGTERM has been seen.
Definition: baseComponent.h:78
virtual void setup()
Called after all components have been constructed and initialization has completed,...
Definition: baseComponent.h:98
Cycle_t getNextClockCycle(TimeConverter *freq)
Returns the next Cycle that the TimeConverter would fire.
Definition: baseComponent.cc:185
uint8_t getStatisticLoadLevel() const
Returns Component Statistic load level.
Definition: baseComponent.h:73
UnitAlgebra getCoreTimeBase() const
Get the core timebase.
Definition: baseComponent.cc:388
std::string & getOutputDirectory() const
Returns the output directory of the simulation.
Definition: baseComponent.cc:552
double getCompletePhaseElapsedRealTime() const
Get the amount of real-time spent executing the complete phase of the simulation.
Definition: baseComponent.cc:528
void performStatisticOutput(Statistics::StatisticBase *stat)
Called by the Components and Subcomponent to perform a statistic Output.
Definition: baseComponent.cc:828
int getCurrentPriority() const
Return the current priority.
Definition: baseComponent.cc:400
double getInitPhaseElapsedRealTime() const
Get the amount of real-time spent executing the init phase of the simulation.
Definition: baseComponent.cc:522
void performGlobalStatisticOutput()
Performs a global statistic Output.
Definition: baseComponent.cc:834
bool isSubComponentLoadableUsingAPI(const std::string &type)
Check to see if a given element type is loadable with a particular API.
Definition: baseComponent.h:558
const std::vector< double > & getCoordinates() const
Retrieve the X,Y,Z coordinates of this component.
Definition: baseComponent.h:822
T::ProfilePoint * registerProfilePoint(const std::string &pointName)
Registers a profiling point.
Definition: baseComponent.h:496
const std::string & getParentComponentName() const
Returns the name of the parent Component, or, if called on a Component, the name of that Component.
Definition: baseComponent.h:85
virtual void init(unsigned int UNUSED(phase))
Used during the init phase.
Definition: baseComponent.h:90
Output & getSimulationOutput() const
Return the base simulation Output class instance.
Definition: baseComponent.cc:442
SimTime_t getCurrentSimTime() const
return the time since the simulation began in the default timebase
Definition: baseComponent.h:141
UnitAlgebra getElapsedSimTime() const
Return the elapsed simulation time as a time.
Definition: baseComponent.cc:406
SimTime_t getCurrentSimTimeMicro() const
Utility function to return the time since the simulation began in microseconds.
Definition: baseComponent.cc:499
RankInfo getNumRanks() const
Get the number of parallel ranks in the simulation.
Definition: baseComponent.cc:436
UnitAlgebra getEndSimTime() const
Return the end simulation time as a time.
Definition: baseComponent.cc:418
Module * loadModule(const std::string &type, Params &params)
Loads a module from an element Library.
Definition: baseComponent.cc:571
void sst_assert(bool condition, uint32_t line, const char *file, const char *func, int exit_code, const char *format,...) const
Convenience function for testing for and reporting fatal conditions.
Definition: baseComponent.cc:614
bool isSimulationRunModeBoth() const
Check to see if the run mode was set to BOTH.
Definition: baseComponent.cc:546
RankInfo getRank() const
Get this instance's parallel rank.
Definition: baseComponent.cc:430
TimeConverter * registerClock(const std::string &freq, Clock::HandlerBase *handler, bool regAll=true)
Registers a clock for this component.
Definition: baseComponent.cc:110
void setDefaultTimeBase(TimeConverter *tc)
Manually set the default detaulTimeBase.
Definition: baseComponent.h:832
T * loadUserSubComponent(const std::string &slot_name, uint64_t share_flags, ARGS... args)
Loads a user defined subcomponent (defined in input file to SST run).
Definition: baseComponent.h:667
SimTime_t getCurrentSimTimeNano() const
Utility function to return the time since the simulation began in nanoseconds.
Definition: baseComponent.cc:491
T * loadAnonymousSubComponent(const std::string &type, const std::string &slot_name, int slot_num, uint64_t share_flags, Params &params, ARGS... args)
Loads an anonymous subcomponent (not defined in input file to SST run).
Definition: baseComponent.h:616
Statistics::Statistic< T > * registerStatistic(SST::Params &params, const std::string &statName, const std::string &statSubId="", bool inserting=false)
Registers a statistic.
Definition: baseComponent.h:406
void unregisterClock(TimeConverter *tc, Clock::HandlerBase *handler)
Removes a clock handler from the component.
Definition: baseComponent.cc:191
ComponentId_t getId() const
Returns unique component ID.
Definition: baseComponent.h:70
Cycle_t reregisterClock(TimeConverter *freq, Clock::HandlerBase *handler)
Reactivates an existing Clock and Handler.
Definition: baseComponent.cc:179
bool isUserSubComponentLoadableUsingAPI(const std::string &slot_name)
Check to see if the element type loaded by the user into the.
Definition: baseComponent.h:573
virtual void finish()
Called after complete phase, but before objects are destroyed.
Definition: baseComponent.h:101
SimTime_t getEndSimCycle() const
Return the end simulation time as a cycle count.
Definition: baseComponent.cc:412
virtual bool Status()
Currently unused function.
Definition: baseComponent.h:104
UnitAlgebra getFinalSimTime() const
Return the end simulation time as a time.
Definition: baseComponent.cc:424
SimTime_t getCurrentSimCycle() const
Return the current simulation time as a cycle count.
Definition: baseComponent.cc:394
virtual void printStatus(Output &UNUSED(out))
Called by the Simulation to request that the component print it's current status.
Definition: baseComponent.h:111
T * loadModule(const std::string &type, Params &params, ARGS... args)
Loads a module from an element Library.
Definition: baseComponent.h:531
A Clock class.
Definition: clock.h:33
ComponentExtension is a class that can be loaded using loadComponentExtension<T>(....
Definition: componentExtension.h:29
Definition: componentInfo.h:40
Main component object for the simulation.
Definition: component.h:31
Maps port names to the Links that are connected to it.
Definition: linkMap.h:28
Module is a tag class used with the loadModule function.
Definition: module.h:22
Output object provides consistent method for outputting data to stdout, stderr and/or sst debug file.
Definition: output.h:52
void fatal(uint32_t line, const char *file, const char *func, int exit_code, const char *format,...) const
Output the fatal message with formatting as specified by the format parameter.
Definition: output.cc:155
@ STDERR
Definition: output.h:59
Parameter store.
Definition: params.h:56
Definition: rankInfo.h:22
Handlers with 1 handler defined argument to callback from caller.
Definition: ssthandler.h:171
Main control class for a SST Simulation.
Definition: simulation_impl.h:77
Main control class for a SST Simulation.
Definition: simulation.h:35
Forms the base class for statistics gathering within SST.
Definition: statbase.h:64
An SST core component that handles timing and event processing informing all registered Statistics to...
Definition: statengine.h:52
Forms the template defined base class for statistics gathering within SST.
Definition: statbase.h:361
Used to load SubComponents when multiple SubComponents are loaded into a single slot (will also also ...
Definition: baseComponent.h:882
T * create(int slot_num) const
Create a user defined subcomponent (defined in input file to SST run).
Definition: baseComponent.h:955
void createAllSparse(std::vector< std::pair< int, T * > > &vec, uint64_t share_flags, ARGS... args) const
Create all user defined subcomponents (defined in input file to SST run) for the slot.
Definition: baseComponent.h:1026
bool isLoadableUsingAPI(int slot_num)
Check to see if the element type loaded by the user into the specified slot index is loadable with a ...
Definition: baseComponent.h:933
void createAll(std::vector< T * > &vec, uint64_t share_flags, ARGS... args) const
Create all user defined subcomponents (defined in input file to SST run) for the slot.
Definition: baseComponent.h:1000
T * create(int slot_num, uint64_t share_flags, ARGS... args) const
Create a user defined subcomponent (defined in input file to SST run).
Definition: baseComponent.h:976
void createAllSparse(std::vector< T * > &vec, uint64_t share_flags, ARGS... args) const
Create all user defined subcomponents (defined in input file to SST run) for the slot.
Definition: baseComponent.h:1051
SubComponent is a class loadable through the factory which allows dynamic functionality to be added t...
Definition: subcomponent.h:29
A class to convert between a component's view of time and the core's view of time.
Definition: timeConverter.h:27
Performs Unit math in full precision.
Definition: unitAlgebra.h:109