12#ifndef SST_CORE_BASECOMPONENT_H
13#define SST_CORE_BASECOMPONENT_H
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/factory.h"
20#include "sst/core/portModule.h"
21#include "sst/core/profile/componentProfileTool.h"
22#include "sst/core/serialization/serializable_base.h"
23#include "sst/core/serialization/serialize.h"
24#include "sst/core/sst_types.h"
25#include "sst/core/statapi/statbase.h"
26#include "sst/core/statapi/statengine.h"
27#include "sst/core/timeConverter.h"
28#include "sst/core/warnmacros.h"
40using namespace SST::Statistics;
59namespace Core::Serialization::pvt {
74template <
typename classT,
typename returnT,
typename... Args>
88template <auto funcT,
typename objT>
89using enable_if_handler_obj_t = std::enable_if_t<std::is_base_of_v<member_function_class_t<funcT>, objT>,
int>;
100 friend class Component;
101 friend class ComponentExtension;
102 friend class ComponentInfo;
103 friend class SubComponent;
104 friend class SubComponentSlotInfo;
105 friend class PortModule;
111 BaseComponent() =
default;
114 explicit BaseComponent(ComponentId_t
id);
115 virtual ~BaseComponent();
117 BaseComponent(
const BaseComponent&) =
delete;
118 BaseComponent& operator=(
const BaseComponent&) =
delete;
125 const std::string&
getType()
const {
return my_info_->getType(); }
132 inline ComponentId_t
getId()
const {
return my_info_->id_; }
151 inline const std::string&
getName()
const {
return my_info_->getName(); }
167 virtual void init(
unsigned int UNUSED(phase)) {}
175 virtual void complete(
unsigned int UNUSED(phase)) {}
371 void removeWatchPointRecursive(
WatchPoint* pt);
448 return configureLink_impl(name, timebase.
getFactor(), handler);
478 template <auto funcT,
typename objT, pvt::enable_if_handler_obj_t<funcT, objT> = 0>
483 if (
nullptr == link )
delete handler;
507 template <auto funcT,
typename dataT,
typename objT, pvt::enable_if_handler_obj_t<funcT, objT> = 0>
512 if (
nullptr == link )
delete handler;
529 template <auto funcT,
typename objT, pvt::enable_if_handler_obj_t<funcT, objT> = 0>
534 if (
nullptr == link )
delete handler;
555 template <auto funcT,
typename dataT,
typename objT, pvt::enable_if_handler_obj_t<funcT, objT> = 0>
560 if (
nullptr == link )
delete handler;
608 template <auto funcT,
typename objT, pvt::enable_if_handler_obj_t<funcT, objT> = 0>
634 template <auto funcT,
typename dataT,
typename objT, pvt::enable_if_handler_obj_t<funcT, objT> = 0>
654 template <auto funcT,
typename objT, pvt::enable_if_handler_obj_t<funcT, objT> = 0>
678 template <auto funcT,
typename dataT,
typename objT, pvt::enable_if_handler_obj_t<funcT, objT> = 0>
743 template <auto funcT,
typename objT, pvt::enable_if_handler_obj_t<funcT, objT> = 0>
747 registerClock_impl(tc, handler, reg_all,
false);
771 template <auto funcT,
typename dataT,
typename objT, pvt::enable_if_handler_obj_t<funcT, objT> = 0>
775 registerClock_impl(tc, handler, reg_all,
false);
800 template <auto funcT,
typename objT, pvt::enable_if_handler_obj_t<funcT, objT> = 0>
804 registerClock_impl(tc, handler, reg_all,
true, order);
832 template <auto funcT,
typename dataT,
typename objT, pvt::enable_if_handler_obj_t<funcT, objT> = 0>
834 TimeConverter tc, uint16_t order, objT* obj, dataT metadata,
bool reg_all =
true)
837 registerClock_impl(tc, handler, reg_all,
true, order);
867 TimeConverter getTimeConverter(
const std::string& base)
const;
870 bool isStatisticShared(
const std::string& stat_name,
bool include_me =
false)
873 if ( getStatisticValidityAndLevel(stat_name) != 255 ) {
877 if ( my_info_->sharesStatistics() ) {
878 return my_info_->parent_info->component->isStatisticShared(stat_name,
true);
893 ImplementSerializable(SST::BaseComponent)
894 void serialize_order(SST::Core::Serialization::serializer& ser)
override;
909 void registerClock_impl(
910 TimeConverter tc, Clock::HandlerBase* handler,
bool reg_all,
bool group =
false, uint16_t order = 0);
921 Link* configureLink_impl(
const std::string& name, SimTime_t timebase,
Event::HandlerBase* handler =
nullptr);
935 template <
typename T>
936 Statistics::Statistic<T>* createStatistic(
937 SST::Params& params, StatisticId_t
id,
const std::string& name,
const std::string& stat_sub_id)
947 StatCreateFunction create = [=](BaseComponent* comp, Statistics::StatisticProcessingEngine* engine,
948 const std::string& name,
const std::string& sub_id,
949 SST::Params& params) -> Statistics::StatisticBase* {
950 return engine->createStatistic<T>(comp, name, sub_id, params);
957 Statistics::StatisticBase* base_stat =
958 id == STATALL_ID ? createEnabledAllStatistic(params, name, stat_sub_id, std::move(create))
959 : getParentComponent()->createExplicitlyEnabledStatistic(
960 params, id, name, stat_sub_id, std::move(create));
963 auto* statistic =
dynamic_cast<Statistics::Statistic<T>*
>(base_stat);
968 fatal(__LINE__, __FILE__,
"createStatistic", 1,
"failed to cast created statistic '%s' to expected type",
979 template <
typename T>
980 Statistics::Statistic<T>* registerStatistic_impl(
981 SST::Params& params,
const std::string& stat_name,
const std::string& stat_sub_id, uint8_t level = 255)
983 if ( level == 255 ) {
984 level = getStatisticValidityAndLevel(stat_name);
987 if ( level == 255 ) {
989 if ( my_info_->parent_info && my_info_->sharesStatistics() ) {
990 return my_info_->parent_info->component->registerStatistic_impl<T>(params, stat_name, stat_sub_id);
994 fatal(__LINE__, __FILE__,
"registerStatistic", 1,
995 "attempting to register a statistic '%s' that is not found in ELI", stat_name.c_str());
1000 if ( my_info_->enabled_stat_names_ ) {
1001 auto iter = my_info_->enabled_stat_names_->find(stat_name);
1002 if ( iter != my_info_->enabled_stat_names_->end() ) {
1006 StatisticId_t
id = iter->second;
1007 return getParentComponent()->createStatistic<T>(params, id, stat_name, stat_sub_id);
1012 if ( my_info_->enabled_all_stats_ ) {
1014 return getStatEngine()->createDisabledStatistic<T>();
1016 return createStatistic<T>(params, STATALL_ID, stat_name, stat_sub_id);
1018 else if ( my_info_->parent_info && my_info_->canInsertStatistics() ) {
1020 return my_info_->parent_info->component->registerStatistic_impl<T>(params, stat_name, stat_sub_id, level);
1024 return getStatEngine()->createDisabledStatistic<T>();
1047 template <
typename T>
1049 SST::Params& params,
const std::string& stat_name,
const std::string& stat_sub_id =
"")
1051 return registerStatistic_impl<T>(params, stat_name, stat_sub_id);
1054 template <
typename T>
1058 return registerStatistic_impl<T>(empty, stat_name, stat_sub_id);
1061 template <
typename... Args>
1062 Statistics::Statistic<std::tuple<Args...>>* registerMultiStatistic(
1063 const std::string& stat_name,
const std::string& stat_sub_id =
"")
1065 SST::Params empty {};
1066 return registerStatistic_impl<std::tuple<Args...>>(empty, stat_name, stat_sub_id);
1069 template <
typename... Args>
1070 Statistics::Statistic<std::tuple<Args...>>* registerMultiStatistic(
1071 SST::Params& params,
const std::string& stat_name,
const std::string& stat_sub_id =
"")
1073 return registerStatistic_impl<std::tuple<Args...>>(params, stat_name, stat_sub_id);
1076 template <
typename T>
1077 Statistics::Statistic<T>*
registerStatistic(
const char* stat_name,
const char* stat_sub_id =
"")
1108 template <
typename T>
1111 std::string full_point_name =
getType() +
"." + point_name;
1112 auto tools = getComponentProfileTools(full_point_name);
1113 if ( tools.size() == 0 )
return nullptr;
1115 typename T::ProfilePoint* ret =
new typename T::ProfilePoint();
1116 for (
auto* x : tools ) {
1117 T* tool =
dynamic_cast<T*
>(x);
1118 if (
nullptr == tool ) {
1120 fatal(CALL_INFO_LONG, 1,
"ERROR: wrong type of profiling tool for profiling point %s)\n",
1121 point_name.c_str());
1137 template <
class T,
class... ARGS>
1141 return Factory::getFactory()->CreateWithParams<T>(type, params, params, args...);
1150 template <
class T,
class... ARGS>
1151 T* loadComponentExtension(ARGS... args)
1154 return static_cast<T*
>(ret);
1167 return Factory::getFactory()->isSubComponentLoadableUsingAPI<T>(type);
1186 const std::map<ComponentId_t, ComponentInfo>& subcomps = my_info_->getSubComponents();
1189 for (
auto& ci : subcomps ) {
1190 if ( ci.second.getSlotName() == slot_name ) {
1191 index = ci.second.getSlotNum();
1196 if ( sub_count > 1 ) {
1198 outXX.
fatal(CALL_INFO, 1,
1199 "Error: ComponentSlot \"%s\" in component \"%s\" only allows for one SubComponent, %d provided.\n",
1200 slot_name.c_str(), my_info_->getType().c_str(), sub_count);
1203 return isUserSubComponentLoadableUsingAPIByIndex<T>(slot_name, index);
1224 template <
class T,
class... ARGS>
1226 uint64_t share_flags,
Params& params, ARGS... args)
1229 share_flags = share_flags & ComponentInfo::USER_FLAGS;
1230 ComponentId_t cid = my_info_->addAnonymousSubComponent(my_info_, type, slot_name, slot_num, share_flags);
1231 ComponentInfo* sub_info = my_info_->findSubComponent(cid);
1234 if ( sub_info ==
nullptr )
return nullptr;
1238 auto ret = Factory::getFactory()->CreateWithParams<T>(type, params, sub_info->id_, params, args...);
1272 template <
class T,
class... ARGS>
1279 const std::map<ComponentId_t, ComponentInfo>& subcomps = my_info_->getSubComponents();
1282 for (
auto& ci : subcomps ) {
1283 if ( ci.second.getSlotName() == slot_name ) {
1284 index = ci.second.getSlotNum();
1289 if ( sub_count > 1 ) {
1291 outXX.
fatal(CALL_INFO, 1,
1292 "Error: ComponentSlot \"%s\" in component \"%s\" only allows for one SubComponent, %d provided.\n",
1293 slot_name.c_str(), my_info_->getType().c_str(), sub_count);
1296 return loadUserSubComponentByIndex<T, ARGS...>(slot_name, index, share_flags, args...);
1322 void fatal(uint32_t line,
const char* file,
const char* func,
int exit_code,
const char* format, ...) const
1323 __attribute__((format(printf, 6, 7)));
1349 void sst_assert(
bool condition, uint32_t line, const
char* file, const
char* func,
int exit_code,
1350 const
char* format, ...) const __attribute__((format(printf, 7, 8)));
1353 SimTime_t processCurrentTimeWithUnderflowedBase(const std::
string& base) const;
1368 Statistics::
StatisticBase* createExplicitlyEnabledStatistic(SST::
Params& params, StatisticId_t
id,
1369 const std::
string& name, const std::
string& stat_sub_id, StatCreateFunction create);
1372 SST::
Params& params, const std::
string& name, const std::
string& stat_sub_id, StatCreateFunction create);
1376 void pushValidParams(
Params& params, const std::
string& type);
1378 template <class T, class... ARGS>
1379 T* loadUserSubComponentByIndex(const std::
string& slot_name,
int slot_num,
int share_flags, ARGS... args)
1382 share_flags = share_flags & ComponentInfo::USER_FLAGS;
1385 ComponentInfo* sub_info = my_info_->findSubComponent(slot_name, slot_num);
1386 if ( sub_info ==
nullptr )
return nullptr;
1387 sub_info->share_flags = share_flags;
1388 sub_info->parent_info = my_info_;
1391 auto ret = Factory::getFactory()->CreateWithParams<T>(
1392 sub_info->type, *sub_info->params, sub_info->id_, *sub_info->params, args...);
1399 bool isUserSubComponentLoadableUsingAPIByIndex(
const std::string& slot_name,
int slot_num)
1402 ComponentInfo* sub_info = my_info_->findSubComponent(slot_name, slot_num);
1403 if ( sub_info ==
nullptr )
return false;
1410 void vfatal(uint32_t line,
const char* file,
const char* func,
int exit_code,
const char* format, va_list arg)
const
1411 __attribute__((format(printf, 6, 0)));
1414 StatisticProcessingEngine* getStatEngine();
1417 SubComponentSlotInfo* getSubComponentSlotInfo(
const std::string& name,
bool fatalOnEmptyIndex =
false);
1428 bool isAnonymous() {
return my_info_->isAnonymous(); }
1430 bool isUser() {
return my_info_->isUser(); }
1437 TimeConverter getDefaultTimeBase() {
return my_info_->defaultTimeBase; }
1438 const TimeConverter getDefaultTimeBase()
const {
return my_info_->defaultTimeBase; }
1440 bool doesSubComponentExist(
const std::string& type);
1443 uint8_t getStatisticValidityAndLevel(
const std::string& statisticName)
const;
1445 std::vector<Profile::ComponentProfileTool*> getComponentProfileTools(
const std::string& point);
1502 enum class ComponentState : uint8_t {
1506 DoNotEndSim = 1 << 1,
1507 OKToEndSim = 1 << 2,
1518 bool isStatePrimary()
1520 return static_cast<uint8_t
>(component_state_) &
static_cast<uint8_t
>(ComponentState::Primary);
1528 bool isStateDoNotEndSim()
1530 return static_cast<uint8_t
>(component_state_) &
static_cast<uint8_t
>(ComponentState::DoNotEndSim);
1538 bool isStateOKToEndSim()
1540 return static_cast<uint8_t
>(component_state_) &
static_cast<uint8_t
>(ComponentState::OKToEndSim);
1550 return static_cast<uint8_t
>(component_state_) &
static_cast<uint8_t
>(ComponentState::Extension);
1560 void setStateAsPrimary()
1562 component_state_ =
static_cast<ComponentState
>(
1563 static_cast<uint8_t
>(component_state_) |
static_cast<uint8_t
>(ComponentState::Primary));
1572 void setStateDoNotEndSim()
1574 component_state_ =
static_cast<ComponentState
>(
1575 static_cast<uint8_t
>(component_state_) |
static_cast<uint8_t
>(ComponentState::DoNotEndSim));
1576 component_state_ =
static_cast<ComponentState
>(
1577 static_cast<uint8_t
>(component_state_) & ~static_cast<uint8_t>(ComponentState::OKToEndSim));
1586 void setStateOKToEndSim()
1588 component_state_ =
static_cast<ComponentState
>(
1589 static_cast<uint8_t
>(component_state_) |
static_cast<uint8_t
>(ComponentState::OKToEndSim));
1590 component_state_ =
static_cast<ComponentState
>(
1591 static_cast<uint8_t
>(component_state_) & ~static_cast<uint8_t>(ComponentState::DoNotEndSim));
1597 void setAsExtension()
1599 component_state_ =
static_cast<ComponentState
>(
1600 static_cast<uint8_t
>(component_state_) |
static_cast<uint8_t
>(ComponentState::Extension));
1604 friend class Core::Serialization::pvt::SerializeBaseComponentHelper;
1607 ComponentInfo* my_info_ =
nullptr;
1608 Simulation* sim_ =
nullptr;
1611 ComponentState component_state_ = ComponentState::None;
1616 std::vector<Clock::HandlerBase*> clock_handlers_;
1618 void addSelfLink(
const std::string& name);
1619 Link* getLinkFromParentSharedPort(
const std::string& port, std::vector<ConfigPortModule>& port_modules);
1621 using StatNameMap = std::map<std::string, std::map<std::string, Statistics::StatisticBase*>>;
1623 ConfigPortModule& getPortModuleConfig(PortModuleId_t);
1625 static thread_local std::pair<ComponentId_t, PortModuleId_t> port_module_id_;
1627 std::vector<PortModule*> port_modules_;
1629 std::map<StatisticId_t, Statistics::StatisticBase*>
1630 explicitly_enabled_shared_stats_;
1633 std::map<StatisticId_t, StatNameMap>
1634 explicitly_enabled_unique_stats_;
1636 StatNameMap enabled_all_stats_;
1641 BaseComponent* getParentComponent()
1643 ComponentInfo* base_info = my_info_;
1644 while ( base_info->parent_info ) {
1645 base_info = base_info->parent_info;
1647 return base_info->component;
1650 virtual Clock::Group* getClockGroup(TimeConverter tc) {
return getParentComponent()->getClockGroup(tc); }
1657class SubComponentSlotInfo
1661 std::string slot_name;
1665 ~SubComponentSlotInfo() {}
1667 SubComponentSlotInfo(
BaseComponent* comp,
const std::string& slot_name) :
1669 slot_name(slot_name)
1671 const std::map<ComponentId_t, ComponentInfo>& subcomps = comp->my_info_->getSubComponents();
1674 max_slot_index = -1;
1675 for (
auto& ci : subcomps ) {
1676 if ( ci.second.getSlotName() == slot_name ) {
1677 if ( ci.second.getSlotNum() >
static_cast<int>(max_slot_index) ) {
1678 max_slot_index = ci.second.getSlotNum();
1684 const std::string& getSlotName()
const {
return slot_name; };
1686 bool isPopulated(
int slot_num)
const
1688 if ( slot_num > max_slot_index )
return false;
1689 if ( comp->my_info_->findSubComponent(slot_name, slot_num) ==
nullptr )
return false;
1693 bool isAllPopulated()
const
1695 for (
int i = 0; i < max_slot_index; ++i ) {
1696 if ( comp->my_info_->findSubComponent(slot_name, i) ==
nullptr )
return false;
1701 int getMaxPopulatedSlotNumber()
const {
return max_slot_index; }
1714 return comp->isUserSubComponentLoadableUsingAPIByIndex<T>(slot_name, slot_num);
1729 template <
typename T>
1733 return comp->loadUserSubComponentByIndex<T>(slot_name, slot_num, ComponentInfo::SHARE_NONE);
1748 template <
class T,
class... ARGS>
1749 T*
create(
int slot_num, uint64_t share_flags, ARGS... args)
const
1751 return comp->loadUserSubComponentByIndex<T, ARGS...>(slot_name, slot_num, share_flags, args...);
1768 template <
typename T,
class... ARGS>
1769 void createAll(std::vector<T*>& vec, uint64_t share_flags, ARGS... args)
const
1771 for (
int i = 0; i <= getMaxPopulatedSlotNumber(); ++i ) {
1772 T* sub =
create<T>(i, share_flags, args...);
1792 template <
typename T,
class... ARGS>
1793 void createAllSparse(std::vector<std::pair<int, T*>>& vec, uint64_t share_flags, ARGS... args)
const
1795 for (
int i = 0; i <= getMaxPopulatedSlotNumber(); ++i ) {
1796 T* sub =
create<T>(i, share_flags, args...);
1797 if ( sub !=
nullptr ) vec.push_back(i, sub);
1814 template <
typename T,
class... ARGS>
1817 for (
int i = 0; i <= getMaxPopulatedSlotNumber(); ++i ) {
1818 T* sub =
create<T>(i, share_flags, args...);
1819 if ( sub !=
nullptr ) vec.push_back(sub);
1824namespace Core::Serialization {
1845 void operator()(T*& s,
serializer& ser, ser_opt_t UNUSED(options))
1848 switch ( ser.mode() ) {
1849 case serializer::SIZER:
1850 pvt::SerializeBaseComponentHelper::size_basecomponent(sp, ser);
1852 case serializer::PACK:
1853 pvt::SerializeBaseComponentHelper::pack_basecomponent(sp, ser);
1855 case serializer::UNPACK:
1856 pvt::SerializeBaseComponentHelper::unpack_basecomponent(sp, ser);
1858 case serializer::MAP:
1859 pvt::SerializeBaseComponentHelper::map_basecomponent(sp, ser, ser.getMapName());
1862 s =
static_cast<T*
>(sp);
1865 SST_FRIEND_SERIALIZE();
Main component object for the simulation.
Definition baseComponent.h:98
bool isSimulationRunModeInit() const
Check to see if the run mode was set to INIT.
Definition baseComponent.cc:330
SimTime_t getCurrentSimTimeMilli() const
Utility function to return the time since the simulation began in milliseconds.
Definition baseComponent.cc:211
Link * configureSelfLink(const std::string &name, objT *obj)
Configure a SelfLink (Loopback link) that uses the (Sub)Component's defaultTimeBase.
Definition baseComponent.h:655
Link * configureLink(const std::string &name, objT *obj, dataT data)
Configure a Link with metadata, using the component's default timebase.
Definition baseComponent.h:556
virtual void complete(unsigned int UNUSED(phase))
Used during the complete phase after the end of simulation.
Definition baseComponent.h:175
void requireLibrary(const std::string &name)
Signifies that a library is required for this simulation.
Definition baseComponent.cc:354
bool isSimulationRunModeRun() const
Check to see if the run mode was set to RUN.
Definition baseComponent.cc:336
void setDefaultTimeBase(TimeConverter tc)
Manually set the default defaultTimeBase.
Definition baseComponent.h:1435
bool isPortConnected(const std::string &name) const
Determine if a port name is connected to any links.
Definition baseComponent.cc:361
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:660
double getRunPhaseElapsedRealTime() const
Get the amount of real-time spent executing the run phase of the simulation.
Definition baseComponent.cc:220
void removeWatchPoint(WatchPoint *pt)
Remove a watch point from all handlers in the Component Tree.
Definition baseComponent.cc:252
T * loadUserSubComponent(const std::string &slot_name)
Loads a user defined subcomponent (defined in input file to SST run).
Definition baseComponent.h:1254
Clock::HandlerBase * registerClock(TimeConverter tc, objT *obj, bool reg_all=true)
Registers a clock handler for this component.
Definition baseComponent.h:744
const std::string & getName() const
Get the name of the BaseComponent.
Definition baseComponent.h:151
TimeConverter registerTimeBase(const std::string &base, bool reg_all=true)
Registers a default timebase for the component and optionally sets the the component's links to that ...
Definition baseComponent.cc:409
void registerAsPrimaryComponent()
Register as a primary component, which allows the component to specify when it is and is not OK to en...
Definition baseComponent.cc:870
TimeConverter registerClock(TimeConverter tc, Clock::HandlerBase *handler, bool reg_all=true)
Registers a clock for this component.
Definition baseComponent.cc:382
virtual void setup()
Called after all components have been constructed and initialization has completed,...
Definition baseComponent.h:181
Link * configureLink(const std::string &name, objT *obj)
Configure a Link using the component's default timebase.
Definition baseComponent.h:530
uint8_t getStatisticLoadLevel() const
Get the BaseComponent Statistic load level.
Definition baseComponent.h:139
UnitAlgebra getCoreTimeBase() const
Get the core timebase.
Definition baseComponent.cc:118
Cycle_t reregisterClock(TimeConverter freq, Clock::HandlerBase *handler)
Reactivates an existing Clock and Handler.
Definition baseComponent.cc:395
void initiateInteractive(const std::string &msg)
Tell the simulation object to initiate interactive mode (if currently turned on).
Definition baseComponent.cc:436
Link * configureSelfLink(const std::string &name, objT *obj, dataT data)
Configure a SelfLink (Loopback link) with metadata, that uses the (Sub)Component's defaultTimeBase.
Definition baseComponent.h:679
Link * configureLink(const std::string &name, TimeConverter timebase, objT *obj)
Configure a Link.
Definition baseComponent.h:479
std::string & getOutputDirectory() const
Returns the output directory of the simulation.
Definition baseComponent.cc:348
double getCompletePhaseElapsedRealTime() const
Get the amount of real-time spent executing the complete phase of the simulation.
Definition baseComponent.cc:232
void performStatisticOutput(Statistics::StatisticBase *stat)
Called by the Components and Subcomponent to perform a statistic Output.
Definition baseComponent.cc:647
int getCurrentPriority() const
Get the current priority.
Definition baseComponent.cc:130
double getInitPhaseElapsedRealTime() const
Get the amount of real-time spent executing the init phase of the simulation.
Definition baseComponent.cc:226
Link * configureSelfLink(const std::string &name, TimeConverter timebase, Event::HandlerBase *handler=nullptr)
Configure a SelfLink (Loopback link).
Definition baseComponent.h:575
void performGlobalStatisticOutput()
Performs a global statistic Output.
Definition baseComponent.cc:653
bool isSubComponentLoadableUsingAPI(const std::string &type)
Check to see if a given element type is loadable with a particular API.
Definition baseComponent.h:1165
const std::vector< double > & getCoordinates() const
Retrieve the X,Y,Z coordinates of this component.
Definition baseComponent.h:1422
const std::string & getParentComponentName() const
Get the name of the parent Component for the Component tree.
Definition baseComponent.h:159
virtual void init(unsigned int UNUSED(phase))
Used during the init phase.
Definition baseComponent.h:167
SimTime_t getCurrentSimTime() const
Return the simulated time since the simulation began in the default timebase.
Definition baseComponent.h:267
UnitAlgebra getElapsedSimTime() const
get the elapsed simulation time as a UnitAlgebra
Definition baseComponent.cc:136
SimTime_t getCurrentSimTimeMicro() const
Utility function to return the time since the simulation began in microseconds.
Definition baseComponent.cc:203
void addWatchPoint(WatchPoint *pt)
Add a watch point to all handlers in the Component Tree.
Definition baseComponent.cc:239
static Output & getSimulationOutput()
Get the default simulation Output class instance.
Definition baseComponent.cc:166
RankInfo getNumRanks() const
Get the number of parallel ranks in the simulation.
Definition baseComponent.cc:160
UnitAlgebra getEndSimTime() const
Get the end simulation time as a UnitAlgebra.
Definition baseComponent.cc:148
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:669
Link * configureSelfLink(const std::string &name, TimeConverter timebase, objT *obj)
Configure a SelfLink (Loopback link).
Definition baseComponent.h:609
T::ProfilePoint * registerProfilePoint(const std::string &point_name)
Registers a profiling point.
Definition baseComponent.h:1109
bool isSimulationRunModeBoth() const
Check to see if the run mode was set to BOTH.
Definition baseComponent.cc:342
RankInfo getRank() const
Get this instance's parallel rank.
Definition baseComponent.cc:154
Link * configureLink(const std::string &name, TimeConverter timebase, objT *obj, dataT data)
Configure a Link with metadata.
Definition baseComponent.h:508
virtual void emergencyShutdown()
Called when SIGINT or SIGTERM has been seen.
Definition baseComponent.h:144
SimTime_t getCurrentSimTime(const char *base) const
Return the simulated time since the simulation began in the specified timebase.
Definition baseComponent.h:306
Clock::HandlerBase * registerClock(TimeConverter tc, objT *obj, dataT metadata, bool reg_all=true)
Registers a clock handler with metadata for this component.
Definition baseComponent.h:772
void primaryComponentOKToEndSim()
Tells the simulation that it is now OK to end simulation.
Definition baseComponent.cc:909
Statistics::Statistic< T > * registerStatistic(SST::Params ¶ms, const std::string &stat_name, const std::string &stat_sub_id="")
Registers a statistic.
Definition baseComponent.h:1048
Clock::HandlerBase * registerOrderedClock(TimeConverter tc, uint16_t order, objT *obj, dataT metadata, bool reg_all=true)
Registers an ordered clock handler with metadata for this component.
Definition baseComponent.h:833
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:1273
const std::string & getType() const
Gets the ELI type for this BaseComponent.
Definition baseComponent.h:125
SimTime_t getCurrentSimTimeNano() const
Utility function to return the time since the simulation began in nanoseconds.
Definition baseComponent.cc:195
T * loadAnonymousSubComponent(const std::string &type, const std::string &slot_name, int slot_num, uint64_t share_flags, Params ¶ms, ARGS... args)
Loads an anonymous subcomponent (not defined in input file to SST run).
Definition baseComponent.h:1225
Cycle_t getNextClockCycle(TimeConverter freq)
Returns the next Cycle that the TimeConverter would fire.
Definition baseComponent.cc:402
void primaryComponentDoNotEndSim()
Tells the simulation that it should not exit.
Definition baseComponent.cc:889
ComponentId_t getId() const
Get the unique component ID.
Definition baseComponent.h:132
void unregisterClock(TimeConverter tc, Clock::HandlerBase *handler)
Removes a clock handler from the component.
Definition baseComponent.cc:389
bool isUserSubComponentLoadableUsingAPI(const std::string &slot_name)
Check to see if the element type loaded by the user into the.
Definition baseComponent.h:1181
Link * configureLink(const std::string &name, TimeConverter timebase, Event::HandlerBase *handler=nullptr)
Configure a Link.
Definition baseComponent.h:446
virtual void finish()
Called after complete phase, but before objects are destroyed.
Definition baseComponent.h:186
SimTime_t getEndSimCycle() const
Get the end simulation time as a cycle count.
Definition baseComponent.cc:142
virtual bool Status()
Currently unused function.
Definition baseComponent.h:189
Clock::HandlerBase * registerOrderedClock(TimeConverter tc, uint16_t order, objT *obj, bool reg_all=true)
Registers an ordered clock handler for this component.
Definition baseComponent.h:801
Link * configureSelfLink(const std::string &name, TimeConverter timebase, objT *obj, dataT data)
Configure a SelfLink (Loopback link) with metadata.
Definition baseComponent.h:635
SimTime_t getCurrentSimCycle() const
Get the current simulation time as a cycle count.
Definition baseComponent.cc:124
virtual void printStatus(Output &UNUSED(out))
Called by the Simulation to request that the component print its current status.
Definition baseComponent.h:196
T * loadModule(const std::string &type, Params ¶ms, ARGS... args)
Loads a module from an element Library.
Definition baseComponent.h:1138
Base classes for clock handlers.
Definition clock.h:146
A Clock class.
Definition clock.h:40
SSTHandler< bool, Cycle_t, classT, dataT, funcT, HandlerBase > Handler
Used to create handlers for clock.
Definition clock.h:295
ComponentExtension is a class that can be loaded using loadComponentExtension<T>(....
Definition componentExtension.h:29
Definition componentInfo.h:45
Main component object for the simulation.
Definition component.h:32
Definition baseComponent.h:1828
Definition serializable_base.h:121
Base serialize class.
Definition serialize.h:133
This class is basically a wrapper for objects to declare the order in which their members should be s...
Definition serializer.h:43
SSTHandler< void, Event *, classT, dataT, funcT > Handler
Used to create handlers for event delivery.
Definition event.h:69
SSTHandlerBase< void, Event * > HandlerBase
Base handler for event delivery.
Definition event.h:48
Maps port names to the Links that are connected to it.
Definition linkMap.h:30
Link between two components.
Definition link.h:57
Module is a tag class used with the loadModule function.
Definition module.h:26
Output object provides consistent method for outputting data to stdout, stderr and/or sst debug file.
Definition output.h:58
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:156
@ STDERR
Definition output.h:65
Parameter store.
Definition params.h:65
Main control class for a SST Simulation.
Definition simulation.h:121
Forms the base class for statistics gathering within SST.
Definition statbase.h:51
An SST core component that handles timing and event processing informing all registered Statistics to...
Definition statengine.h:55
Forms the template defined base class for statistics gathering within SST.
Definition statbase.h:376
Used to load SubComponents when multiple SubComponents are loaded into a single slot (will also also ...
Definition baseComponent.h:1658
T * create(int slot_num) const
Create a user defined subcomponent (defined in input file to SST run).
Definition baseComponent.h:1730
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:1793
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:1712
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:1769
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:1749
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:1815
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:31
SimTime_t getFactor() const
Definition timeConverter.h:91
Performs Unit math in full precision.
Definition unitAlgebra.h:107
Class that can attach to Clock and Event Handlers to monitor the state of variables.
Definition watchPoint.h:29
Extracts the owning class from a pointer-to-member-function type.
Definition baseComponent.h:72