Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Optimize statistics memory usage #1208

Open
wants to merge 4 commits into
base: devel
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions src/sst/core/baseComponent.cc
Original file line number Diff line number Diff line change
Expand Up @@ -632,13 +632,11 @@ BaseComponent::getComponentInfoStatisticEnableLevel(const std::string& statistic
}

void
BaseComponent::configureCollectionMode(
Statistics::StatisticBase* statistic, const SST::Params& params, const std::string& name)
BaseComponent::configureCollectionMode(Statistics::StatisticBase* statistic, const std::string& name)
{
StatisticBase::StatMode_t statCollectionMode = StatisticBase::STAT_MODE_COUNT;
Output& out = Simulation_impl::getSimulationOutput();
std::string statRateParam = params.find<std::string>("rate", "0ns");
UnitAlgebra collectionRate(statRateParam);
UnitAlgebra collectionRate = statistic->getCollectionRate();

// make sure we have a valid collection rate
// Check that the Collection Rate is a valid unit type that we can use
Expand Down Expand Up @@ -715,7 +713,7 @@ BaseComponent::createStatistic(
cpp_params.insert(python_params);
std::string type = cpp_params.find<std::string>("type", "sst.AccumulatorStatistic");
auto* stat = fxn(this, engine, type, name, subId, cpp_params);
configureCollectionMode(stat, cpp_params, name);
configureCollectionMode(stat, name);
engine->registerStatisticWithEngine(stat);
return stat;
}
Expand All @@ -733,7 +731,7 @@ BaseComponent::createEnabledAllStatistic(

// a matching statistic was not found
auto* stat = createStatistic(params, my_info->allStatConfig->params, name, statSubId, true, std::move(fxn));
m_enabledAllStats[name][statSubId] = stat;
if ( !stat->isNullStatistic() ) { m_enabledAllStats[name][statSubId] = stat; }
return stat;
}

Expand Down
3 changes: 1 addition & 2 deletions src/sst/core/baseComponent.h
Original file line number Diff line number Diff line change
Expand Up @@ -782,8 +782,7 @@ class BaseComponent : public SST::Core::Serialization::serializable_base
private:
SimTime_t processCurrentTimeWithUnderflowedBase(const std::string& base) const;

void
configureCollectionMode(Statistics::StatisticBase* statistic, const SST::Params& params, const std::string& name);
void configureCollectionMode(Statistics::StatisticBase* statistic, const std::string& name);

/**
* @brief findExplicitlyEnabledStatistic
Expand Down
5 changes: 5 additions & 0 deletions src/sst/core/sstinfo.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
#include "sst/core/env/envquery.h"
#include "sst/core/model/element_python.h"
#include "sst/core/sstpart.h"
#include "sst/core/statapi/statbase.h"
#include "sst/core/statapi/statoutput.h"
#include "sst/core/subcomponent.h"
#include "sst/core/warnmacros.h"

Expand Down Expand Up @@ -1057,6 +1059,9 @@ SSTLibraryInfo::outputHumanReadable(std::ostream& os, int LibIndex)
outputHumanReadable<SST::Partition::SSTPartitioner>(os, enableFullElementOutput);
outputHumanReadable<SST::Profile::ProfileTool>(os, enableFullElementOutput);
outputHumanReadable<SST::SSTElementPythonModule>(os, enableFullElementOutput);
outputHumanReadable<SST::Statistics::StatisticOutput>(os, enableFullElementOutput);
// template param is not part of output so only need to include one
outputHumanReadable<SST::Statistics::Statistic<uint32_t>>(os, enableFullElementOutput);
}

template <class BaseType>
Expand Down
8 changes: 5 additions & 3 deletions src/sst/core/statapi/stataccumulator.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,15 @@ class AccumulatorStatistic : public Statistic<NumberBase>
m_sum_sq = static_cast<NumberBase>(0);
m_min = std::numeric_limits<NumberBase>::max();
m_max = std::numeric_limits<NumberBase>::min();

// Set the Name of this Statistic
this->setStatisticTypeName("Accumulator");
}

~AccumulatorStatistic() {}

AccumulatorStatistic() : Statistic<NumberBase>() {} // For serialization only

virtual const std::string& getStatTypeName() const { return stat_type_; }


void serialize_order(SST::Core::Serialization::serializer& ser) override
{
SST::Statistics::Statistic<NumberBase>::serialize_order(ser);
Expand Down Expand Up @@ -216,6 +216,8 @@ class AccumulatorStatistic : public Statistic<NumberBase>
StatisticOutput::fieldHandle_t h_count;
StatisticOutput::fieldHandle_t h_max;
StatisticOutput::fieldHandle_t h_min;

inline static const std::string stat_type_ = "Accumulator";
};

} // namespace Statistics
Expand Down
Loading
Loading