Peano
KernelBenchmarks-main.cpp File Reference

Go to the source code of this file.

Functions

tarch::logging::Log _log ("::")
 
void initInputData (double *Q)
 Set input data. More...
 
void allocateAndStoreOutcome (const double *const *Q, const double *const maxEigenvalue, const int numberOfCells)
 Allocates and stores outcome of one compute kernel. More...
 
void freeOutcome (const int numberOfCells)
 
void validateOutcome (const double *const *Q, const double *const maxEigenvalue, const int numberOfCells)
 Validate data against pre-stored simulation outcome. More...
 
void reportRuntime (const std::string &kernelIdentificator, const tarch::timing::Measurement &timingKernelLaunch, int numberOfCells)
 Reports the runtime and throughput of the benchmarks. More...
 
double runKernels (int device, exahype2::CellData< double, double > &cellData, int cellIndex, tarch::timing::Measurement &measurement)
 
void runBenchmarks (int numberOfCells)
 Run the benchmark for one particular number of cells. More...
 
int main (int argc, char **argv)
 

Variables

constexpr double TimeStamp = 0.0
 
constexpr double TimeStepSize = 1e-6
 
const tarch::la::Vector< DIMENSIONS, double > CellCenter = benchmarks::exahype2::kernelbenchmarks::DomainOffset + 0.5*benchmarks::exahype2::kernelbenchmarks::DomainSize
 
const tarch::la::Vector< DIMENSIONS, double > CellSize = benchmarks::exahype2::kernelbenchmarks::DomainSize / 81.0
 
constexpr int NumberOfInputEntriesPerCell
 
constexpr int NumberOfOutputEntriesPerCell = 0
 
constexpr int NumberOfFiniteVolumesPerCell
 
double ** validQ = nullptr
 
double * validMaxEigenvalue = nullptr
 
bool outcomeIsInvalid = false
 
tarch::timing::Measurement timingComputeKernel
 

Function Documentation

◆ _log()

tarch::logging::Log _log ( "::"  )

◆ allocateAndStoreOutcome()

void allocateAndStoreOutcome ( const double *const *  Q,
const double *const  maxEigenvalue,
const int  numberOfCells 
)

Allocates and stores outcome of one compute kernel.

Make a persistent snapshot of a solution and assume, from hereon, that this snapshot is the valid data. You can call this routine as often as you want. Only the very first call will trigger a snapshot.

Note: needs to freed using the freeOutcome() routine.

Definition at line 128 of file KernelBenchmarks-main.cpp.

References applications::exahype2::ccz4::maxEigenvalue(), benchmarks::exahype2::kernelbenchmarks::NumberOfOutputEntriesPerCell, validMaxEigenvalue, and validQ.

Referenced by runBenchmarks().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ freeOutcome()

void freeOutcome ( const int  numberOfCells)

Definition at line 145 of file KernelBenchmarks-main.cpp.

References validMaxEigenvalue, and validQ.

Referenced by main().

Here is the caller graph for this function:

◆ initInputData()

void initInputData ( double *  Q)

Set input data.

We use the values from the centralMost Cell in the domain with an arbitrary cell size of 1/81 of the domain size.

TODO: should we update this to actual initial conditions?

Definition at line 94 of file KernelBenchmarks-main.cpp.

References CellCenter, and CellSize.

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 425 of file KernelBenchmarks-main.cpp.

References freeOutcome(), static-limiting-euler-airfoil::init, outcomeIsInvalid, and runBenchmarks().

Here is the call graph for this function:

◆ reportRuntime()

void reportRuntime ( const std::string &  kernelIdentificator,
const tarch::timing::Measurement &  timingKernelLaunch,
int  numberOfCells 
)

Reports the runtime and throughput of the benchmarks.

First set of outputs refers to the time of the compute kernel itself. Second set of outputs refers to the time including the kernel launch overhead. The throughput is measured in the updates of volumes per second (dof/s).

Definition at line 227 of file KernelBenchmarks-main.cpp.

References timingComputeKernel.

◆ runBenchmarks()

void runBenchmarks ( int  numberOfCells)

Run the benchmark for one particular number of cells.

Parameters
numberOfCellsNumber of cells to study

Definition at line 348 of file KernelBenchmarks-main.cpp.

References allocateAndStoreOutcome(), CellCenter, CellSize, benchmarks::exahype2::kernelbenchmarks::initInputData(), benchmarks::exahype2::kernelbenchmarks::NumberOfInputEntriesPerCell, benchmarks::exahype2::kernelbenchmarks::NumberOfOutputEntriesPerCell, benchmarks::exahype2::kernelbenchmarks::reportRuntime(), runKernels(), TimeStamp, TimeStepSize, timingComputeKernel, and validateOutcome().

Referenced by main().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ runKernels()

double runKernels ( int  device,
exahype2::CellData< double, double > &  cellData,
int  cellIndex,
tarch::timing::Measurement &  measurement 
)

Definition at line 247 of file KernelBenchmarks-main.cpp.

References CellCenter, CellSize, applications::exahype2::ccz4::maxEigenvalue(), TimeStamp, and TimeStepSize.

Referenced by runBenchmarks().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ validateOutcome()

void validateOutcome ( const double *const *  Q,
const double *const  maxEigenvalue,
const int  numberOfCells 
)

Validate data against pre-stored simulation outcome.

Works if and only if storeOutcome has been performed before. Does not abort in case there are errors. If there are errors, we return a status code != 0.

Definition at line 164 of file KernelBenchmarks-main.cpp.

References applications::exahype2::ccz4::maxEigenvalue(), benchmarks::exahype2::kernelbenchmarks::NumberOfOutputEntriesPerCell, outcomeIsInvalid, validMaxEigenvalue, and validQ.

Referenced by runBenchmarks().

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ CellCenter

const tarch::la::Vector<DIMENSIONS,double> CellCenter = benchmarks::exahype2::kernelbenchmarks::DomainOffset + 0.5*benchmarks::exahype2::kernelbenchmarks::DomainSize

◆ CellSize

const tarch::la::Vector<DIMENSIONS,double> CellSize = benchmarks::exahype2::kernelbenchmarks::DomainSize / 81.0

◆ NumberOfFiniteVolumesPerCell

constexpr int NumberOfFiniteVolumesPerCell
constexpr
Initial value:
= AderSolver::Order
* AderSolver::Order
#if DIMENSIONS == 3
* AderSolver::Order
#endif

Definition at line 71 of file KernelBenchmarks-main.cpp.

◆ NumberOfInputEntriesPerCell

constexpr int NumberOfInputEntriesPerCell
constexpr
Initial value:
= (AderSolver::Order + 1)
* (AderSolver::Order + 1)
#if DIMENSIONS == 3
* (AderSolver::Order + 1)
#endif
* (AderSolver::NumberOfUnknowns + AderSolver::NumberOfAuxiliaryVariables)

Definition at line 54 of file KernelBenchmarks-main.cpp.

◆ NumberOfOutputEntriesPerCell

constexpr int NumberOfOutputEntriesPerCell = 0
constexpr

Definition at line 62 of file KernelBenchmarks-main.cpp.

◆ outcomeIsInvalid

bool outcomeIsInvalid = false

Definition at line 82 of file KernelBenchmarks-main.cpp.

Referenced by main(), and validateOutcome().

◆ TimeStamp

constexpr double TimeStamp = 0.0
constexpr

Definition at line 46 of file KernelBenchmarks-main.cpp.

Referenced by runBenchmarks(), and runKernels().

◆ TimeStepSize

constexpr double TimeStepSize = 1e-6
constexpr

Definition at line 47 of file KernelBenchmarks-main.cpp.

Referenced by runBenchmarks(), and runKernels().

◆ timingComputeKernel

◆ validMaxEigenvalue

double* validMaxEigenvalue = nullptr

Definition at line 81 of file KernelBenchmarks-main.cpp.

Referenced by allocateAndStoreOutcome(), freeOutcome(), and validateOutcome().

◆ validQ

double** validQ = nullptr

Definition at line 80 of file KernelBenchmarks-main.cpp.

Referenced by allocateAndStoreOutcome(), freeOutcome(), and validateOutcome().