Skip to content

Commit 78f11cd

Browse files
authored
Merge branch 'devel' into typedef_using
2 parents 5ac77da + 59b5a2a commit 78f11cd

27 files changed

+805
-614
lines changed

src/sst/core/baseComponent.cc

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ BaseComponent::~BaseComponent()
8282
my_info->component = nullptr;
8383
if ( my_info->parent_info ) {
8484
std::map<ComponentId_t, ComponentInfo>& parent_subcomps = my_info->parent_info->getSubComponents();
85-
size_t deleted = parent_subcomps.erase(my_info->id);
85+
size_t deleted = parent_subcomps.erase(my_info->id_);
8686
if ( deleted != 1 ) {
8787
// Should never happen, but issue warning just in case
8888
sim_->getSimulationOutput().output(
@@ -288,6 +288,7 @@ BaseComponent::configureLink(const std::string& name, TimeConverter* time_base,
288288
tmp = my_info->parent_info->component->getLinkFromParentSharedPort(name, port_modules);
289289
// If I got a link from my parent, I need to put it in my
290290
// link map
291+
291292
if ( nullptr != tmp ) {
292293
if ( nullptr == myLinks ) {
293294
myLinks = new LinkMap();
@@ -299,8 +300,11 @@ BaseComponent::configureLink(const std::string& name, TimeConverter* time_base,
299300

300301
// Need to see if I got any port_modules, if so, need
301302
// to add them to my_info->portModules
303+
302304
if ( port_modules.size() > 0 ) {
303305
if ( nullptr == my_info->portModules ) {
306+
// This memory is currently leaked as portModules is otherwise a pointer to ConfigComponent
307+
// ConfigComponent does not exist for anonymous subcomponents
304308
my_info->portModules = new std::map<std::string, std::vector<ConfigPortModule>>();
305309
}
306310
(*my_info->portModules)[name].swap(port_modules);
@@ -331,7 +335,9 @@ BaseComponent::configureLink(const std::string& name, TimeConverter* time_base,
331335
}
332336

333337
// Check for PortModules
334-
if ( my_info->portModules != nullptr ) {
338+
// portModules pointer may be invalid after wire up
339+
// Only SelfLinks can be initialized after wire up and SelfLinks do not support PortModules
340+
if ( !sim_->isWireUpFinished() && my_info->portModules != nullptr ) {
335341
auto it = my_info->portModules->find(name);
336342
if ( it != my_info->portModules->end() ) {
337343
EventHandlerMetaData mdata(my_info->getID(), getName(), getType(), name);
@@ -683,13 +689,11 @@ BaseComponent::getComponentInfoStatisticEnableLevel(const std::string& statistic
683689
}
684690

685691
void
686-
BaseComponent::configureCollectionMode(
687-
Statistics::StatisticBase* statistic, const SST::Params& params, const std::string& name)
692+
BaseComponent::configureCollectionMode(Statistics::StatisticBase* statistic, const std::string& name)
688693
{
689694
StatisticBase::StatMode_t statCollectionMode = StatisticBase::STAT_MODE_COUNT;
690695
Output& out = Simulation_impl::getSimulationOutput();
691-
std::string statRateParam = params.find<std::string>("rate", "0ns");
692-
UnitAlgebra collectionRate(statRateParam);
696+
UnitAlgebra collectionRate = statistic->getCollectionRate();
693697

694698
// make sure we have a valid collection rate
695699
// Check that the Collection Rate is a valid unit type that we can use
@@ -766,7 +770,7 @@ BaseComponent::createStatistic(
766770
cpp_params.insert(python_params);
767771
std::string type = cpp_params.find<std::string>("type", "sst.AccumulatorStatistic");
768772
auto* stat = fxn(this, engine, type, name, subId, cpp_params);
769-
configureCollectionMode(stat, cpp_params, name);
773+
configureCollectionMode(stat, name);
770774
engine->registerStatisticWithEngine(stat);
771775
return stat;
772776
}
@@ -775,16 +779,16 @@ Statistics::StatisticBase*
775779
BaseComponent::createEnabledAllStatistic(
776780
Params& params, const std::string& name, const std::string& statSubId, StatCreateFunction fxn)
777781
{
778-
auto iter = m_enabledAllStats.find(name);
779-
if ( iter != m_enabledAllStats.end() ) {
782+
auto iter = m_enabled_all_stats_.find(name);
783+
if ( iter != m_enabled_all_stats_.end() ) {
780784
auto& submap = iter->second;
781785
auto subiter = submap.find(statSubId);
782786
if ( subiter != submap.end() ) { return subiter->second; }
783787
}
784788

785789
// a matching statistic was not found
786-
auto* stat = createStatistic(params, my_info->allStatConfig->params, name, statSubId, true, std::move(fxn));
787-
m_enabledAllStats[name][statSubId] = stat;
790+
auto* stat = createStatistic(params, my_info->all_stat_config_->params, name, statSubId, true, std::move(fxn));
791+
if ( !stat->isNullStatistic() ) { m_enabled_all_stats_[name][statSubId] = stat; }
788792
return stat;
789793
}
790794

@@ -799,8 +803,8 @@ BaseComponent::createExplicitlyEnabledStatistic(
799803
name.c_str());
800804
}
801805

802-
auto piter = my_info->statConfigs->find(id);
803-
if ( piter == my_info->statConfigs->end() ) {
806+
auto piter = my_info->stat_configs_->find(id);
807+
if ( piter == my_info->stat_configs_->end() ) {
804808
out.fatal(
805809
CALL_INFO, 1, "Explicitly enabled statistic '%s' does not have parameters mapped to its ID", name.c_str());
806810
}
@@ -985,7 +989,7 @@ SerializeBaseComponentHelper::map_basecomponent(serializable_base*& s, serialize
985989
ObjectMap* my_info_dir = new ObjectMapHierarchyOnly();
986990
ser.mapper().map_hierarchy_start("my_info", my_info_dir);
987991
ser.mapper().setNextObjectReadOnly();
988-
sst_map_object(ser, const_cast<ComponentId_t&>(comp->my_info->id), "id");
992+
sst_map_object(ser, const_cast<ComponentId_t&>(comp->my_info->id_), "id");
989993
ser.mapper().setNextObjectReadOnly();
990994
sst_map_object(ser, const_cast<std::string&>(comp->my_info->type), "type");
991995
sst_map_object(ser, comp->my_info->defaultTimeBase, "defaultTimeBase");

src/sst/core/baseComponent.h

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ class BaseComponent : public SST::Core::Serialization::serializable_base
8080
const std::string& getType() const { return my_info->getType(); }
8181

8282
/** Returns unique component ID */
83-
inline ComponentId_t getId() const { return my_info->id; }
83+
inline ComponentId_t getId() const { return my_info->id_; }
8484

8585
/** Returns Component Statistic load level */
8686
inline uint8_t getStatisticLoadLevel() const { return my_info->statLoadLevel; }
@@ -437,9 +437,9 @@ class BaseComponent : public SST::Core::Serialization::serializable_base
437437
Statistics::Statistic<T>*
438438
registerStatistic(SST::Params& params, const std::string& statName, const std::string& statSubId, bool inserting)
439439
{
440-
if ( my_info->enabledStatNames ) {
441-
auto iter = my_info->enabledStatNames->find(statName);
442-
if ( iter != my_info->enabledStatNames->end() ) {
440+
if ( my_info->enabled_stat_names_ ) {
441+
auto iter = my_info->enabled_stat_names_->find(statName);
442+
if ( iter != my_info->enabled_stat_names_->end() ) {
443443
// valid, enabled statistic
444444
// During initialization, the component should have assigned a mapping between
445445
// the local name and globally unique stat ID
@@ -451,7 +451,7 @@ class BaseComponent : public SST::Core::Serialization::serializable_base
451451
// if we got here, this is not a stat we explicitly enabled
452452
if ( inserting || doesComponentInfoStatisticExist(statName) ) {
453453
// this is a statistic that I registered
454-
if ( my_info->enabledAllStats ) { return createStatistic<T>(params, STATALL_ID, statName, statSubId); }
454+
if ( my_info->enabled_all_stats_ ) { return createStatistic<T>(params, STATALL_ID, statName, statSubId); }
455455
else if ( my_info->parent_info && my_info->canInsertStatistics() ) {
456456
// I did not explicitly enable nor enable all
457457
// but I can insert statistics into my parent
@@ -591,7 +591,7 @@ class BaseComponent : public SST::Core::Serialization::serializable_base
591591
template <class T, class... ARGS>
592592
T* loadComponentExtension(ARGS... args)
593593
{
594-
ComponentExtension* ret = new T(my_info->id, args...);
594+
ComponentExtension* ret = new T(my_info->id_, args...);
595595
return static_cast<T*>(ret);
596596
}
597597

@@ -674,7 +674,7 @@ class BaseComponent : public SST::Core::Serialization::serializable_base
674674

675675
// Check to see if this can be loaded with new API or if we have to fallback to old
676676
if ( isSubComponentLoadableUsingAPI<T>(type) ) {
677-
auto ret = Factory::getFactory()->CreateWithParams<T>(type, params, sub_info->id, params, args...);
677+
auto ret = Factory::getFactory()->CreateWithParams<T>(type, params, sub_info->id_, params, args...);
678678
return ret;
679679
}
680680
return nullptr;
@@ -791,8 +791,7 @@ class BaseComponent : public SST::Core::Serialization::serializable_base
791791
private:
792792
SimTime_t processCurrentTimeWithUnderflowedBase(const std::string& base) const;
793793

794-
void
795-
configureCollectionMode(Statistics::StatisticBase* statistic, const SST::Params& params, const std::string& name);
794+
void configureCollectionMode(Statistics::StatisticBase* statistic, const std::string& name);
796795

797796
/**
798797
* @brief findExplicitlyEnabledStatistic
@@ -842,7 +841,7 @@ class BaseComponent : public SST::Core::Serialization::serializable_base
842841

843842
if ( isSubComponentLoadableUsingAPI<T>(sub_info->type) ) {
844843
auto ret = Factory::getFactory()->CreateWithParams<T>(
845-
sub_info->type, *sub_info->params, sub_info->id, *sub_info->params, args...);
844+
sub_info->type, *sub_info->params, sub_info->id_, *sub_info->params, args...);
846845
return ret;
847846
}
848847
return nullptr;
@@ -917,7 +916,7 @@ class BaseComponent : public SST::Core::Serialization::serializable_base
917916
std::vector<PortModule*> portModules;
918917
std::map<StatisticId_t, Statistics::StatisticBase*> m_explicitlyEnabledSharedStats;
919918
std::map<StatisticId_t, StatNameMap> m_explicitlyEnabledUniqueStats;
920-
StatNameMap m_enabledAllStats;
919+
StatNameMap m_enabled_all_stats_;
921920

922921
BaseComponent* getParentComponent()
923922
{

0 commit comments

Comments
 (0)