|
Peano
|
#include "KernelBenchmarksFVRusanov-main.h"#include "config.h"#include "Constants.h"#include "repositories/DataRepository.h"#include "repositories/SolverRepository.h"#include "repositories/StepRepository.h"#include "tasks/FVRusanovEnclaveTask.h"#include "peano4/peano.h"#include "tarch/NonCriticalAssertions.h"#include "tarch/accelerator/accelerator.h"#include "tarch/accelerator/Device.h"#include "tarch/multicore/multicore.h"#include "tarch/multicore/Core.h"#include "tarch/multicore/BooleanSemaphore.h"#include "tarch/multicore/Lock.h"#include "tarch/logging/Log.h"#include "tarch/timing/Measurement.h"#include "tarch/timing/Watch.h"#include <cstring>#include <fenv.h>
Go to the source code of this file.
Functions | |
| void | initInputData (double *Q) |
| Set input data. | |
| void | allocateAndStoreOutcome (const double *const *Q, const double *const maxEigenvalue, const int numberOfPatches) |
| Allocates and stores outcome of one compute kernel. | |
| void | freeOutcome (const int numberOfPatches) |
| void | validateOutcome (const double *const *Q, const double *const maxEigenvalue, const int numberOfPatches) |
| Validate data against pre-stored simulation outcome. | |
| void | reportRuntime (const std::string &kernelIdentificator, const tarch::timing::Measurement &timingKernelLaunch, int numberOfPatches) |
| Reports the runtime and throughput of the benchmarks. | |
| template<void(*)(exahype2::CellData< double, double > &, tarch::timing::Measurement &, peano4::utils::LoopPlacement) Kernel, peano4::utils::LoopPlacement loopPlacement> | |
| void | wrapHostKernel (int device, exahype2::CellData< double, double > &patchData) |
| We want to use all kernels exactly the same way. | |
| template<void(*)(int, exahype2::CellData< double, double > &, tarch::timing::Measurement &) Kernel> | |
| void | wrapDeviceKernel (int device, exahype2::CellData< double, double > &patchData) |
| void | runBenchmarks (int numberOfPatches) |
| Run the benchmark for one particular number of patches. | |
| int | main (int argc, char **argv) |
| Main routine of the SPH code. | |
Variables | |
| tarch::logging::Log | _log ("::") |
| constexpr double | TimeStamp = 0.5 |
| constexpr double | TimeStepSize = 1e-6 |
| constexpr double | CellSize = 0.1 |
| constexpr double | CellOffset = 4.0 |
| constexpr int | HaloSize = 1 |
| constexpr int | NumberOfInputEntriesPerPatch |
| constexpr int | NumberOfOutputEntriesPerPatch |
| constexpr int | NumberOfFiniteVolumesPerPatch |
| double ** | validQ = nullptr |
| double * | validMaxEigenvalue = nullptr |
| bool | outcomeIsInvalid = false |
| tarch::timing::Measurement | timingComputeKernel |
| void allocateAndStoreOutcome | ( | const double *const * | Q, |
| const double *const | maxEigenvalue, | ||
| const int | numberOfPatches ) |
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 99 of file KernelBenchmarksFVRusanov-main.cpp.
References logInfo, NumberOfOutputEntriesPerPatch, validMaxEigenvalue, and validQ.
Referenced by runBenchmarks().

Definition at line 116 of file KernelBenchmarksFVRusanov-main.cpp.
References validMaxEigenvalue, and validQ.
Referenced by main().

Set input data.
We really don't care if this makes any sense. Just make the data reasonably smooth and ensure that all is positive, as there are density and energy among the unknowns. If they become negative or zero, the compute kernels do not make any sense anymore.
Definition at line 84 of file KernelBenchmarksFVRusanov-main.cpp.
References NumberOfInputEntriesPerPatch, and tarch::la::PI.
Referenced by runBenchmarks().

Main routine of the SPH code.
Definition at line 838 of file KernelBenchmarksFVRusanov-main.cpp.
References peano4::fillLookupTables(), freeOutcome(), tarch::multicore::Core::getInstance(), tarch::initNonCriticalAssertionEnvironment(), peano4::initParallelEnvironment(), tarch::multicore::initSmartMPI(), logInfo, outcomeIsInvalid, runBenchmarks(), tarch::shutdownNonCriticalAssertionEnvironment(), peano4::shutdownParallelEnvironment(), and tarch::multicore::shutdownSmartMPI().

| void reportRuntime | ( | const std::string & | kernelIdentificator, |
| const tarch::timing::Measurement & | timingKernelLaunch, | ||
| int | numberOfPatches ) |
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 198 of file KernelBenchmarksFVRusanov-main.cpp.
References tarch::timing::Measurement::getValue(), logInfo, NumberOfFiniteVolumesPerPatch, timingComputeKernel, and tarch::timing::Measurement::toString().
Referenced by runBenchmarks().


Run the benchmark for one particular number of patches.
| numberOfPatches | Number of patches to study |
Definition at line 243 of file KernelBenchmarksFVRusanov-main.cpp.
References allocateAndStoreOutcome(), tarch::allocateMemory(), assessKernel(), exahype2::CellData< inType, outType >::cellCentre, CellOffset, CellSize, exahype2::CellData< inType, outType >::cellSize, exahype2::CellData< inType, outType >::dt, endParallelFor, tarch::freeMemory(), tarch::timing::Watch::getCalendarTime(), HaloSize, tarch::Heap, tarch::accelerator::Device::HostDevice, initInputData(), tarch::ManagedSharedAcceleratorDeviceMemory, exahype2::CellData< inType, outType >::maxEigenvalue, NumberOfInputEntriesPerPatch, NumberOfOutputEntriesPerPatch, parallelFor, exahype2::CellData< inType, outType >::QIn, exahype2::CellData< inType, outType >::QOut, reportRuntime(), peano4::utils::Serial, tarch::timing::Measurement::setValue(), peano4::utils::SpreadOut, tarch::timing::Watch::stop(), exahype2::CellData< inType, outType >::t, TimeStamp, TimeStepSize, exahype2::fv::rusanov::omp::timeStepWithRusanovBatchedHeapStateless(), exahype2::fv::rusanov::cpp::timeStepWithRusanovBatchedUSMStateless(), exahype2::fv::rusanov::sycl::timeStepWithRusanovBatchedUSMStateless(), exahype2::fv::rusanov::omp::timeStepWithRusanovPatchwiseHeapStateless(), exahype2::fv::rusanov::cpp::timeStepWithRusanovPatchwiseUSMStateless(), exahype2::fv::rusanov::sycl::timeStepWithRusanovPatchwiseUSMStateless(), exahype2::fv::rusanov::sycl::timeStepWithRusanovTaskgraphUSMStateless(), timingComputeKernel, validateOutcome(), void, wrapDeviceKernel(), and wrapHostKernel().
Referenced by main().


| void validateOutcome | ( | const double *const * | Q, |
| const double *const | maxEigenvalue, | ||
| const int | numberOfPatches ) |
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 135 of file KernelBenchmarksFVRusanov-main.cpp.
References std::abs(), tarch::la::equals(), logError, NumberOfOutputEntriesPerPatch, outcomeIsInvalid, validMaxEigenvalue, and validQ.
Referenced by runBenchmarks().


| void wrapDeviceKernel | ( | int | device, |
| exahype2::CellData< double, double > & | patchData ) |
Definition at line 233 of file KernelBenchmarksFVRusanov-main.cpp.
References assertion, tarch::accelerator::Device::HostDevice, and timingComputeKernel.
| void wrapHostKernel | ( | int | device, |
| exahype2::CellData< double, double > & | patchData ) |
We want to use all kernels exactly the same way.
However, the various kernels all have slightly different signatures. So we write small helper functions (wrappers) which map the generic test signature onto the specific kernel.
To make this possible, all parameters which are not part of the generic interface, i.e., which are not patch data or the boolean, have to be mapped onto template arguments.
Definition at line 227 of file KernelBenchmarksFVRusanov-main.cpp.
References assertionEquals, tarch::accelerator::Device::HostDevice, and timingComputeKernel.
| tarch::logging::Log _log("::") | ( | "::" | ) |
|
constexpr |
Definition at line 40 of file KernelBenchmarksFVRusanov-main.cpp.
|
constexpr |
Definition at line 39 of file KernelBenchmarksFVRusanov-main.cpp.
|
constexpr |
Definition at line 41 of file KernelBenchmarksFVRusanov-main.cpp.
|
constexpr |
Definition at line 61 of file KernelBenchmarksFVRusanov-main.cpp.
|
constexpr |
Definition at line 45 of file KernelBenchmarksFVRusanov-main.cpp.
|
constexpr |
Definition at line 53 of file KernelBenchmarksFVRusanov-main.cpp.
| bool outcomeIsInvalid = false |
Definition at line 72 of file KernelBenchmarksFVRusanov-main.cpp.
|
constexpr |
Definition at line 37 of file KernelBenchmarksFVRusanov-main.cpp.
|
constexpr |
Definition at line 38 of file KernelBenchmarksFVRusanov-main.cpp.
| tarch::timing::Measurement timingComputeKernel |
Definition at line 74 of file KernelBenchmarksFVRusanov-main.cpp.
| double* validMaxEigenvalue = nullptr |
Definition at line 71 of file KernelBenchmarksFVRusanov-main.cpp.
| double** validQ = nullptr |
Definition at line 70 of file KernelBenchmarksFVRusanov-main.cpp.