12 #ifndef _H_SST_CORE_STATISTICS_OUTPUTHDF5
13 #define _H_SST_CORE_STATISTICS_OUTPUTHDF5
15 #include "sst/core/sst_types.h"
17 #include <sst/core/statapi/statoutput.h>
18 #include <sst/core/warnmacros.h>
20 DISABLE_WARN_MISSING_OVERRIDE
28 namespace Statistics {
54 void implRegisteredField(fieldHandle_t fieldHandle)
override;
55 void implStopRegisterFields()
override;
58 void implStopRegisterGroup()
override;
86 void implStopOutputGroup()
override;
95 void implOutputField(fieldHandle_t fieldHandle, uint32_t data)
override;
97 void implOutputField(fieldHandle_t fieldHandle, uint64_t data)
override;
118 DataSet(H5::H5File *file) : file(file) { }
119 virtual ~DataSet() { }
120 H5::H5File* getFile() {
return file; }
121 virtual bool isGroup()
const = 0;
123 virtual void setCurrentStatistic(StatisticBase *UNUSED(stat)) { }
125 virtual void finalizeCurrentStatistic() = 0;
127 virtual void beginGroupRegistration(StatisticGroup *UNUSED(group)) { }
128 virtual void finalizeGroupRegistration() { }
131 virtual void startNewGroupEntry() {}
132 virtual void finishGroupEntry() {}
134 virtual void startNewEntry(StatisticBase *stat) = 0;
135 virtual StatData_u& getFieldLoc(fieldHandle_t fieldHandle) = 0;
136 virtual void finishEntry() = 0;
142 class StatisticInfo :
public DataSet {
143 StatisticBase *statistic;
144 std::vector<fieldHandle_t> indexMap;
145 std::vector<StatData_u> currentData;
146 std::vector<fieldType_t> typeList;
147 std::vector<std::string> fieldNames;
149 H5::DataSet *dataset;
150 H5::CompType *memType;
155 StatisticInfo(StatisticBase *stat, H5::H5File *file) :
156 DataSet(file), statistic(stat), nEntries(0)
158 typeList.push_back(StatisticFieldInfo::UINT64);
159 indexMap.push_back(-1);
160 fieldNames.push_back(
"SimTime");
163 if ( dataset )
delete dataset;
164 if ( memType )
delete memType;
167 void finalizeCurrentStatistic()
override;
169 bool isGroup()
const override {
return false; }
170 void startNewEntry(StatisticBase *stat)
override;
171 StatData_u& getFieldLoc(fieldHandle_t fieldHandle)
override;
172 void finishEntry()
override;
175 class GroupInfo :
public DataSet {
178 std::string statPath;
180 H5::DataSet *dataset;
181 H5::CompType *memType;
185 std::vector<std::string> registeredFields;
186 std::vector<fieldType_t> typeList;
187 std::map<fieldHandle_t, size_t> handleIndexMap;
189 std::vector<StatData_u> currentData;
190 size_t currentCompOffset;
193 GroupStat(GroupInfo *group, StatisticBase *stat);
194 void finalizeRegistration();
195 static std::string getStatName(StatisticBase* stat);
197 void startNewGroupEntry();
199 void startNewEntry(
size_t componentIndex, StatisticBase *stat);
200 StatData_u& getFieldLoc(fieldHandle_t fieldHandle);
203 void finishGroupEntry();
209 std::map<std::string, GroupStat> m_statGroups;
210 GroupStat *m_currentStat;
211 StatisticGroup *m_statGroup;
212 std::vector<BaseComponent*> m_components;
213 H5::DataSet *timeDataSet;
216 GroupInfo(StatisticGroup *group, H5::H5File *file);
217 void beginGroupRegistration(StatisticGroup *UNUSED(group))
override { }
218 void setCurrentStatistic(StatisticBase *stat)
override;
220 void finalizeCurrentStatistic()
override;
221 void finalizeGroupRegistration()
override;
223 bool isGroup()
const override {
return true; }
224 void startNewEntry(StatisticBase *stat)
override;
225 StatData_u& getFieldLoc(fieldHandle_t fieldHandle)
override {
return m_currentStat->getFieldLoc(fieldHandle); }
226 void finishEntry()
override;
228 void startNewGroupEntry()
override;
229 void finishGroupEntry()
override;
230 size_t getNumComponents()
const {
return m_components.size(); }
232 const std::string& getName()
const {
return m_statGroup->name; }
237 DataSet* m_currentDataSet;
238 std::map<StatisticBase*, StatisticInfo*> m_statistics;
239 std::map<std::string, GroupInfo> m_statGroups;
242 StatisticInfo* initStatistic(StatisticBase* statistic);
243 StatisticInfo* getStatisticInfo(StatisticBase* statistic);
Forms the base class for statistics output generation within the SST core.
Definition: statoutput.h:47
fieldHandle_t registerField(const char *fieldName)
Register a field to be output (templated function)
Definition: statoutput.h:85
Forms the base class for statistics gathering within SST.
Definition: statbase.h:61
void implStartOutputEntries(StatisticBase *statistic) override
Implementation function for the start of output.
Definition: statoutputhdf5.cc:133
bool acceptsGroups() const override
True if this StatOutput can handle StatisticGroups.
Definition: statoutputhdf5.h:43
void implStopOutputEntries() override
Implementation function for the end of output.
Definition: statoutputhdf5.cc:140
The class for statistics output to a comma separated file.
Definition: statoutputhdf5.h:35
void startOfSimulation() override
Indicate to Statistic Output that simulation started.
Definition: statoutputhdf5.cc:117
Parameter store.
Definition: params.h:45
void printUsage() override
Print out usage for this Statistic Output.
Definition: statoutputhdf5.cc:65
void endOfSimulation() override
Indicate to Statistic Output that simulation ended.
Definition: statoutputhdf5.cc:122
bool checkOutputParameters() override
Perform a check of provided parameters.
Definition: statoutputhdf5.cc:37
void implOutputField(fieldHandle_t fieldHandle, int32_t data) override
Implementation functions for output.
Definition: statoutputhdf5.cc:166
Definition: statgroup.h:29