#include <PerformanceMeter.h>
|
| PerformanceMeter (StructuredBlockStorage &blockStorage) |
| Creates a PerformanceMeter To actually measure performance, the class has to be connected to a timeloop. More...
|
|
|
void | operator() () |
| Call operator which starts/stops the measurement. More...
|
|
void | timingStart () |
| This function is wrapped and returned in getBeforeFunction() More...
|
|
void | timingEnd () |
| This function is wrapped and returned in getAfterFunction() More...
|
|
std::function< void() > | getBeforeFunction () |
| Returns a pointer to the function that starts all measurements Use this function to connect a PerformanceMeter to a timeloop. More...
|
|
std::function< void() > | getAfterFunction () |
| Returns a pointer to the function that ends all measurements Use this function to connect a PerformanceMeter to a timeloop. More...
|
|
void | clear () |
| Resets Timings. More...
|
|
|
void | addMeasurement (const std::string &name, const CountFunction &countFunction, uint_t countFreq=0, real_t scaling=1) |
| Adds a performance measurement, associated with all cells (usually MLUPS) More...
|
|
void | addMeasurement (const std::string &name, real_t scaling=1) |
| Adds a performance measurement, associated with all cells (usually MLUPS) More...
|
|
template<typename FField > |
void | addMeasurementBasedOnFlagField (const std::string &name, ConstBlockDataID flagFieldID, typename FField::flag_t activeMask, uint_t countFreq=0, real_t scaling=1) |
|
◆ CountFunction
◆ PerformanceMeter()
◆ addMeasurement() [1/2]
void walberla::timeloop::PerformanceMeter::addMeasurement |
( |
const std::string & |
name, |
|
|
const CountFunction & |
countFunction, |
|
|
uint_t |
countFreq = 0 , |
|
|
real_t |
scaling = 1 |
|
) |
| |
Adds a performance measurement, associated with all cells (usually MLUPS)
- Parameters
-
name | name of the performance number (f.e. MLUPS) |
countFunction | this function is called very countFreq'th call and has to return the number of 'active' cells on the given block |
countFreq | frequency of counting, if zero the counting happens once in the beginning |
scaling | The performance number is multiplied with this scaling factor before printing. Example MLUPS , for the "M" a factor of 1e-6 is needed |
Behaves like addMeasurement() function above, with n= total number of cells
◆ addMeasurement() [2/2]
void walberla::timeloop::PerformanceMeter::addMeasurement |
( |
const std::string & |
name, |
|
|
real_t |
scaling = 1 |
|
) |
| |
Adds a performance measurement, associated with all cells (usually MLUPS)
- Parameters
-
name | name of the performance number (f.e. MLUPS) |
scaling | The performance number is multiplied with this scaling factor before printing. Example MLUPS , for the "M" a factor of 1e-6 is needed |
Behaves like addMeasurement() function above, with n= total number of cells
◆ addMeasurementBasedOnFlagField()
template<typename FField >
void walberla::timeloop::PerformanceMeter::addMeasurementBasedOnFlagField |
( |
const std::string & |
name, |
|
|
ConstBlockDataID |
flagFieldID, |
|
|
typename FField::flag_t |
activeMask, |
|
|
uint_t |
countFreq = 0 , |
|
|
real_t |
scaling = 1 |
|
) |
| |
◆ clear()
void walberla::timeloop::PerformanceMeter::clear |
( |
| ) |
|
Resets Timings.
Added measurements are not cleared.
◆ getAfterFunction()
std::function< void() > walberla::timeloop::PerformanceMeter::getAfterFunction |
( |
| ) |
|
Returns a pointer to the function that ends all measurements Use this function to connect a PerformanceMeter to a timeloop.
timeloop.addFuncAfterTimeStep ( perfMeter.getAfterFunction() );
◆ getBeforeFunction()
std::function< void() > walberla::timeloop::PerformanceMeter::getBeforeFunction |
( |
| ) |
|
Returns a pointer to the function that starts all measurements Use this function to connect a PerformanceMeter to a timeloop.
timeloop.addFuncBeforeTimeStep( perfMeter.getBeforeFunction() );
◆ getReduced()
shared_ptr< std::map< std::string, real_t > > walberla::timeloop::PerformanceMeter::getReduced |
( |
int |
targetRank = 0 | ) |
|
Collects the result of the PerformanceMeter from all MPI_Processes.
- Parameters
-
targetRank | MPI world rank of the process where the PerformanceMeter is reduced to on all other processes a null pointer is returned. If targetRank < 0 all processes have a valid result |
- Returns
- a map of measurement-name to measurement value if (worldRank == targetRank ) || targetRank < 0 and a null pointer otherwise
◆ logResultOnRoot()
void walberla::timeloop::PerformanceMeter::logResultOnRoot |
( |
| ) |
|
Logs all added performance measurements on the root process.
◆ operator()()
void walberla::timeloop::PerformanceMeter::operator() |
( |
| ) |
|
Call operator which starts/stops the measurement.
When the PerformanceMeter is added to a timeloop this operator is called. One measurement period, goes from one operator() call to the next call of operator() -> Add this before all sweeps in the timeloop.
If more fine grained control is needed use getBeforeFunction() and getAfterFunction() then only the sweeps between these functions are measured
◆ print()
void walberla::timeloop::PerformanceMeter::print |
( |
std::ostream & |
os, |
|
|
int |
targetRank = 0 |
|
) |
| |
Prints all added measurements to the given output stream on specified process.
- Parameters
-
os | Output stream where results are printed |
targetRank | the MPI world rank of the process that should print. or a negative value, if all process should print. |
◆ reduce()
void walberla::timeloop::PerformanceMeter::reduce |
( |
std::vector< real_t > & |
reduced, |
|
|
int |
targetRank |
|
) |
| |
|
private |
Communicates the total number of cells among processes.
- Parameters
-
[out] | reduced | vector that after returning holds the total number of cells for each Measurement on the process with has world rank = targetRank, or on all processes if targetRank < 0 |
[in] | targetRank | see above |
◆ timingEnd()
void walberla::timeloop::PerformanceMeter::timingEnd |
( |
| ) |
|
This function is wrapped and returned in getAfterFunction()
Stops the timing, if dynamic flags are set, the cells are counted and a running average of the cell count is computed.
◆ timingStart()
void walberla::timeloop::PerformanceMeter::timingStart |
( |
| ) |
|
◆ timingStartStop()
void walberla::timeloop::PerformanceMeter::timingStartStop |
( |
| ) |
|
|
private |
◆ updateCellCounts()
void walberla::timeloop::PerformanceMeter::updateCellCounts |
( |
| ) |
|
|
private |
Loops over measurements and updates them if necessary.
◆ blockStorage_
◆ firstTimingStartStopCall_
bool walberla::timeloop::PerformanceMeter::firstTimingStartStopCall_ |
|
private |
Used for operator() to indicate if called the first time.
◆ measurements_
std::vector<Measurement> walberla::timeloop::PerformanceMeter::measurements_ |
|
private |
◆ timer_
WcTimer walberla::timeloop::PerformanceMeter::timer_ |
|
private |
The documentation for this class was generated from the following files: