12 #ifndef SST_CORE_STATAPI_STATOUTPUTHDF5_H 13 #define SST_CORE_STATAPI_STATOUTPUTHDF5_H 15 #include "sst/core/sst_types.h" 16 #include "sst/core/statapi/statoutput.h" 17 #include "sst/core/warnmacros.h" 19 DISABLE_WARN_MISSING_OVERRIDE
27 namespace Statistics {
42 SST_ELI_ELEMENT_VERSION(1,0,0),
43 "Output to an HDF5 file")
66 void implRegisteredField(fieldHandle_t fieldHandle)
override;
67 void stopRegisterFields()
override;
70 void stopRegisterGroup()
override;
98 void stopOutputGroup()
override;
106 void outputField(fieldHandle_t fieldHandle, int32_t data)
override;
107 void outputField(fieldHandle_t fieldHandle, uint32_t data)
override;
108 void outputField(fieldHandle_t fieldHandle, int64_t data)
override;
109 void outputField(fieldHandle_t fieldHandle, uint64_t data)
override;
110 void outputField(fieldHandle_t fieldHandle,
float data)
override;
111 void outputField(fieldHandle_t fieldHandle,
double data)
override;
129 DataSet(H5::H5File* file) : file(file) {}
130 virtual ~DataSet() {}
131 H5::H5File* getFile() {
return file; }
132 virtual bool isGroup()
const = 0;
134 virtual void setCurrentStatistic(StatisticBase* UNUSED(stat)) {}
136 virtual void finalizeCurrentStatistic() = 0;
138 virtual void beginGroupRegistration(StatisticGroup* UNUSED(group)) {}
139 virtual void finalizeGroupRegistration() {}
141 virtual void startNewGroupEntry(Cycle_t UNUSED(cycle)) {}
142 virtual void finishGroupEntry() {}
144 virtual void startNewEntry(StatisticBase* stat, Cycle_t cycle) = 0;
145 virtual StatData_u& getFieldLoc(fieldHandle_t fieldHandle) = 0;
146 virtual void finishEntry() = 0;
152 class StatisticInfo :
public DataSet
154 StatisticBase* statistic;
155 std::vector<fieldHandle_t> indexMap;
156 std::vector<StatData_u> currentData;
157 std::vector<fieldType_t> typeList;
158 std::vector<std::string> fieldNames;
160 H5::DataSet* dataset;
161 H5::CompType* memType;
166 StatisticInfo(StatisticBase* stat, H5::H5File* file) : DataSet(file), statistic(stat), nEntries(0)
168 typeList.push_back(StatisticFieldType<uint64_t>::id());
169 indexMap.push_back(-1);
170 fieldNames.push_back(
"SimTime");
174 if ( dataset )
delete dataset;
175 if ( memType )
delete memType;
178 void finalizeCurrentStatistic()
override;
180 bool isGroup()
const override {
return false; }
181 void startNewEntry(StatisticBase* stat, Cycle_t cycle)
override;
182 StatData_u& getFieldLoc(fieldHandle_t fieldHandle)
override;
183 void finishEntry()
override;
186 class GroupInfo :
public DataSet
191 std::string statPath;
193 H5::DataSet* dataset;
194 H5::CompType* memType;
198 std::vector<std::string> registeredFields;
199 std::vector<fieldType_t> typeList;
200 std::map<fieldHandle_t, size_t> handleIndexMap;
202 std::vector<StatData_u> currentData;
203 size_t currentCompOffset;
205 GroupStat(GroupInfo* group, StatisticBase* stat);
206 void finalizeRegistration();
207 static std::string getStatName(StatisticBase* stat);
209 void startNewGroupEntry();
211 void startNewEntry(
size_t componentIndex, StatisticBase* stat);
212 StatData_u& getFieldLoc(fieldHandle_t fieldHandle);
215 void finishGroupEntry();
219 std::map<std::string, GroupStat> m_statGroups;
220 GroupStat* m_currentStat;
221 StatisticGroup* m_statGroup;
222 std::vector<BaseComponent*> m_components;
223 H5::DataSet* timeDataSet;
226 GroupInfo(StatisticGroup* group, H5::H5File* file);
227 void beginGroupRegistration(StatisticGroup* UNUSED(group))
override {}
228 void setCurrentStatistic(StatisticBase* stat)
override;
230 void finalizeCurrentStatistic()
override;
231 void finalizeGroupRegistration()
override;
233 bool isGroup()
const override {
return true; }
234 void startNewEntry(StatisticBase* stat, Cycle_t cycle)
override;
235 StatData_u& getFieldLoc(fieldHandle_t fieldHandle)
override {
return m_currentStat->getFieldLoc(fieldHandle); }
236 void finishEntry()
override;
238 void startNewGroupEntry(Cycle_t cycle)
override;
239 void finishGroupEntry()
override;
240 size_t getNumComponents()
const {
return m_components.size(); }
242 const std::string& getName()
const;
246 DataSet* m_currentDataSet;
247 std::map<StatisticBase*, StatisticInfo*> m_statistics;
248 std::map<std::string, GroupInfo> m_statGroups;
250 StatisticInfo* initStatistic(StatisticBase* statistic);
251 StatisticInfo* getStatisticInfo(StatisticBase* statistic);
257 #endif // SST_CORE_STATAPI_STATOUTPUTHDF5_H This class is basically a wrapper for objects to declare the order in which their members should be s...
Definition: serializer.h:43
void outputField(fieldHandle_t fieldHandle, int32_t data) override
Implementation functions for output.
Definition: statoutputhdf5.cc:164
Forms the base class for statistics output generation within the SST core.
Definition: statoutput.h:50
Forms the base class for statistics gathering within SST.
Definition: statbase.h:45
void startRegisterFields(StatisticBase *stat) override
These can be overriden, if necessary, but must be callable by the derived class.
Definition: statoutputhdf5.cc:78
void implStartOutputEntries(StatisticBase *statistic) override
Implementation function for the start of output.
Definition: statoutputhdf5.cc:134
virtual bool checkOutputParameters()=0
Have the Statistic Output check its parameters.
fieldHandle_t registerField(const char *fieldName)
Register a field to be output (templated function)
Definition: statoutput.h:259
bool acceptsGroups() const override
True if this StatOutput can handle StatisticGroups.
Definition: statoutputhdf5.h:50
void implStopOutputEntries() override
Implementation function for the end of output.
Definition: statoutputhdf5.cc:141
Definition: statoutput.h:162
SST_ELI_REGISTER_DERIVED(StatisticOutput, StatisticOutputHDF5, "sst", "statoutputhdf5", SST_ELI_ELEMENT_VERSION(1, 0, 0), "Output to an HDF5 file") StatisticOutputHDF5(Params &outputParameters)
Construct a StatOutputHDF5.
The class for statistics output to a comma separated file.
Definition: statoutputhdf5.h:34
void startOfSimulation() override
Indicate to Statistic Output that simulation started.
Definition: statoutputhdf5.cc:121
Parameter store.
Definition: params.h:55
ImplementSerializable(SST::Statistics::StatisticOutputHDF5) private void printUsage() override
Perform a check of provided parameters.
Definition: statoutputhdf5.cc:67
void endOfSimulation() override
Indicate to Statistic Output that simulation ended.
Definition: statoutputhdf5.cc:125
Definition: statgroup.h:29