milupHPC documentation
Public Member Functions | Static Public Member Functions | Public Attributes | Private Member Functions | Private Attributes | List of all members
H5Profiler Class Reference

Singleton class for HDF5 profiler. More...

#include "h5profiler.h"

+ Collaboration diagram for H5Profiler:
Collaboration graph

Public Member Functions

 H5Profiler (H5Profiler const &)=delete
 
void operator= (H5Profiler const &)=delete
 
void const setStep (const int &_step)
 Set current step of profiler. More...
 
void const setRank (const int &_myRank)
 Set MPI rank. More...
 
void const setNumProcs (const int &_numProcs)
 Set number of MPI processes. More...
 
void const disableWrite ()
 Disable write to output file. More...
 
void const enableWrite ()
 Enable write to output file. More...
 
template<typename T >
void createValueDataSet (const std::string &path, int steps, std::size_t maxSteps=HighFive::DataSpace::UNLIMITED)
 Track single value (per MPI rank). More...
 
template<typename T >
void value2file (const std::string &path, T value)
 Write value to single value data set. More...
 
template<typename T >
void createVectorDataSet (const std::string &path, int steps, std::size_t size, std::size_t maxSteps=HighFive::DataSpace::UNLIMITED)
 Track vector values (per MPI rank). More...
 
template<typename T >
void vector2file (const std::string &path, std::vector< T > data)
 
template<typename T >
void vector2file (const std::string &path, T *data)
 

Static Public Member Functions

static H5Profiler & getInstance (const std::string &outfile="")
 Constructor/Instance getter for HDF5 profiler. More...
 

Public Attributes

int currentMaxLength = 0
 

Private Member Functions

 H5Profiler (const std::string &outfile)
 

Private Attributes

HighFive::File h5file
 
std::unordered_map< std::string, HighFive::DataSet > dataSets
 
int numProcs
 
int step
 
int myRank
 
bool disabled
 
std::unordered_map< std::string, double > timeStart
 
std::unordered_map< std::string, double > timeElapsed
 
std::unordered_map< std::string, int > currentSteps
 
std::unordered_map< std::string, int > totalSteps
 
std::unordered_map< std::string, std::size_t > vectorSizes
 

Detailed Description

Singleton class for HDF5 profiler.

Definition at line 118 of file h5profiler.h.

Constructor & Destructor Documentation

◆ H5Profiler() [1/2]

H5Profiler::H5Profiler ( H5Profiler const &  )
delete

◆ H5Profiler() [2/2]

H5Profiler::H5Profiler ( const std::string &  outfile)
private

Constructor.

Parameters
outfileoutput file

Definition at line 4 of file h5profiler.cpp.

Member Function Documentation

◆ createValueDataSet()

template<typename T >
void H5Profiler::createValueDataSet ( const std::string &  path,
int  steps,
std::size_t  maxSteps = HighFive::DataSpace::UNLIMITED 
)
inline

Track single value (per MPI rank).

Template Parameters
Tdata set data type
Parameters
pathHDF5 path to data/key
steps
maxSteps

Definition at line 185 of file h5profiler.h.

◆ createVectorDataSet()

template<typename T >
void H5Profiler::createVectorDataSet ( const std::string &  path,
int  steps,
std::size_t  size,
std::size_t  maxSteps = HighFive::DataSpace::UNLIMITED 
)
inline

Track vector values (per MPI rank).

Template Parameters
Tdata set data type
Parameters
pathHDF5 path to data/key
steps
sizevector size
maxSteps

Definition at line 226 of file h5profiler.h.

◆ disableWrite()

void const H5Profiler::disableWrite ( )
inline

Disable write to output file.

Definition at line 160 of file h5profiler.h.

◆ enableWrite()

void const H5Profiler::enableWrite ( )
inline

Enable write to output file.

Definition at line 164 of file h5profiler.h.

◆ getInstance()

static H5Profiler & H5Profiler::getInstance ( const std::string &  outfile = "")
inlinestatic

Constructor/Instance getter for HDF5 profiler.

constructor is only called ONCE due to the singleton pattern, arguments have to be passed when first calling getInstance()

Parameters
[in]outfilefile to write
Returns
instance of HDF5 profiler

Definition at line 130 of file h5profiler.h.

◆ operator=()

void H5Profiler::operator= ( H5Profiler const &  )
delete

◆ setNumProcs()

void const H5Profiler::setNumProcs ( const int &  _numProcs)
inline

Set number of MPI processes.

Parameters
_numProcsnumber of MPI processes

Definition at line 156 of file h5profiler.h.

◆ setRank()

void const H5Profiler::setRank ( const int &  _myRank)
inline

Set MPI rank.

Parameters
_myRankMPI rank

Definition at line 150 of file h5profiler.h.

◆ setStep()

void const H5Profiler::setStep ( const int &  _step)
inline

Set current step of profiler.

Parameters
[in]_stepsimulation step

Definition at line 144 of file h5profiler.h.

◆ value2file()

template<typename T >
void H5Profiler::value2file ( const std::string &  path,
T  value 
)
inline

Write value to single value data set.

Template Parameters
Tdata set data type
Parameters
pathHDF5 path to data/key
valuevalue to be written

Definition at line 202 of file h5profiler.h.

◆ vector2file() [1/2]

template<typename T >
void H5Profiler::vector2file ( const std::string &  path,
std::vector< T >  data 
)
inline

Write value to vector value data set.

Template Parameters
Tdata set data type
Parameters
pathHDF5 path to data/key
datavalue(s)/data to be written as std::vector<T>

Definition at line 246 of file h5profiler.h.

◆ vector2file() [2/2]

template<typename T >
void H5Profiler::vector2file ( const std::string &  path,
T *  data 
)
inline

Write value to vector value data set.

Template Parameters
Tdata set data type
Parameters
pathHDF5 path to data/key
datavalue(s)/data to be written as T*

Definition at line 267 of file h5profiler.h.

+ Here is the call graph for this function:

Member Data Documentation

◆ currentMaxLength

int H5Profiler::currentMaxLength = 0

Definition at line 166 of file h5profiler.h.

◆ currentSteps

std::unordered_map<std::string, int> H5Profiler::currentSteps
private

Definition at line 297 of file h5profiler.h.

◆ dataSets

std::unordered_map<std::string, HighFive::DataSet> H5Profiler::dataSets
private

Definition at line 287 of file h5profiler.h.

◆ disabled

bool H5Profiler::disabled
private

Definition at line 291 of file h5profiler.h.

◆ h5file

HighFive::File H5Profiler::h5file
private

Definition at line 286 of file h5profiler.h.

◆ myRank

int H5Profiler::myRank
private

Definition at line 290 of file h5profiler.h.

◆ numProcs

int H5Profiler::numProcs
private

Definition at line 288 of file h5profiler.h.

◆ step

int H5Profiler::step
private

Definition at line 289 of file h5profiler.h.

◆ timeElapsed

std::unordered_map<std::string, double> H5Profiler::timeElapsed
private

Definition at line 295 of file h5profiler.h.

◆ timeStart

std::unordered_map<std::string, double> H5Profiler::timeStart
private

Definition at line 294 of file h5profiler.h.

◆ totalSteps

std::unordered_map<std::string, int> H5Profiler::totalSteps
private

Definition at line 298 of file h5profiler.h.

◆ vectorSizes

std::unordered_map<std::string, std::size_t> H5Profiler::vectorSizes
private

Definition at line 300 of file h5profiler.h.


The documentation for this class was generated from the following files:
  • include/utils/h5profiler.h
  • src/utils/h5profiler.cpp

milupHPC - H5Profiler Class Reference
Generated on Wed Aug 31 2022 12:16:53 by Doxygen 1.9.3