Peano
Loading...
Searching...
No Matches
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.
 
void allocateAndStoreOutcome (const double *const *Q, const double *const maxEigenvalue, const int numberOfCells)
 Allocates and stores outcome of one compute kernel.
 
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.
 
void reportRuntime (const std::string &kernelIdentificator, const tarch::timing::Measurement &timingKernelLaunch, int numberOfCells)
 Reports the runtime and throughput of the benchmarks.
 
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.
 
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 123 of file KernelBenchmarks-main.cpp.

References benchmarks::exahype2::kernelbenchmarks::NumberOfOutputEntriesPerCell, validMaxEigenvalue, and validQ.

Referenced by runBenchmarks().

Here is the caller graph for this function:

◆ freeOutcome()

void freeOutcome ( const int numberOfCells)

Definition at line 140 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 90 of file KernelBenchmarks-main.cpp.

References CellCenter, and CellSize.

◆ main()

int main ( int argc,
char ** argv )

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

References freeOutcome(), 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 222 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 351 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 242 of file KernelBenchmarks-main.cpp.

References CellCenter, CellSize, TimeStamp, and TimeStepSize.

Referenced by runBenchmarks().

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 159 of file KernelBenchmarks-main.cpp.

References benchmarks::exahype2::kernelbenchmarks::NumberOfOutputEntriesPerCell, outcomeIsInvalid, validMaxEigenvalue, and validQ.

Referenced by runBenchmarks().

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 67 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 50 of file KernelBenchmarks-main.cpp.

◆ NumberOfOutputEntriesPerCell

constexpr int NumberOfOutputEntriesPerCell = 0
constexpr

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

◆ outcomeIsInvalid

bool outcomeIsInvalid = false

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

Referenced by main(), and validateOutcome().

◆ TimeStamp

constexpr double TimeStamp = 0.0
constexpr

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

Referenced by runBenchmarks(), and runKernels().

◆ TimeStepSize

constexpr double TimeStepSize = 1e-6
constexpr

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

Referenced by runBenchmarks(), and runKernels().

◆ timingComputeKernel

◆ validMaxEigenvalue

double* validMaxEigenvalue = nullptr

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

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

◆ validQ

double** validQ = nullptr

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

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