Peano
|
#include "Acoustic-main.h"
#include <fenv.h>
#include "config.h"
#include "Constants.h"
#include "exahype2/UserInterface.h"
#include "observers/CreateGrid.h"
#include "observers/CreateGridAndConvergeLoadBalancing.h"
#include "observers/CreateGridButPostponeRefinement.h"
#include "observers/InitGrid.h"
#include "observers/PlotSolution.h"
#include "observers/TimeStep.h"
#include "peano4/peano.h"
#include "repositories/DataRepository.h"
#include "repositories/SolverRepository.h"
#include "repositories/StepRepository.h"
#include "tarch/accelerator/accelerator.h"
#include "tarch/accelerator/Device.h"
#include "tarch/logging/CommandLineLogger.h"
#include "tarch/logging/Log.h"
#include "tarch/logging/LogFilter.h"
#include "tarch/logging/Statistics.h"
#include "tarch/multicore/Core.h"
#include "tarch/multicore/multicore.h"
#include "tarch/NonCriticalAssertions.h"
#include "tarch/timing/Measurement.h"
#include "tarch/timing/Watch.h"
#include "tasks/AcousticEnclaveTask.h"
#include "toolbox/loadbalancing/loadbalancing.h"
Go to the source code of this file.
Functions | |
void | initInputData (double *Q) |
Set input data. | |
void | storeOutcome (const double *Q, const double maxEigenvalue) |
Store outcome of one compute kernel. | |
std::tuple< double, int > | validateOutcome (double *Q, int patchIndex, const double maxEigenvalue) |
Validate data against pre-stored simulation outcome. | |
void | reportRuntime (const std::string &kernelIdentificator, const ::tarch::timing::Measurement &timingKernelLaunch, int patches) |
template<class TempDataEnumerator , ::peano4::utils::LoopPlacement loopParallelism> | |
void | wrapPatchwiseHeapFunctorsHostKernel (int device, ::exahype2::CellData< double, double > &patchData) |
This is a wrapper around the kernel call with the functors. | |
template<class TempDataEnumerator , ::peano4::utils::LoopPlacement loopParallelism> | |
void | wrapBatchedHeapFunctorHostKernels (int device, ::exahype2::CellData< double, double > &patchData) |
Another wrapper. | |
template<class TempDataEnumerator , ::peano4::utils::LoopPlacement loopParallelism> | |
void | wrapVolumewiseFunctorHostKernels (int device, ::exahype2::CellData< double, double > &patchData) |
Another wrapper. | |
template<void(*)(::exahype2::CellData< double, double > &, ::tarch::timing::Measurement &, ::peano4::utils::LoopPlacement) Function, ::peano4::utils::LoopPlacement loopParallelism> | |
void | wrapStatelessHostKernel (int device, ::exahype2::CellData< double, double > &patchData) |
Wrapper around stateless kernel invocations. | |
template<void(*)(int, ::exahype2::CellData< double, double > &, ::tarch::timing::Measurement &) Function> | |
void | wrapDeviceKernel (int device, ::exahype2::CellData< double, double > &patchData) |
void | runBenchmarks (int numberOfPatches, int launchingThreads) |
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 ("::") |
double | validMaxEigenvalue = 0.0 |
double * | validOutcome = nullptr |
static constexpr double | TimeStamp = 0.5 |
static constexpr double | TimeStepSize = 1e-6 |
static constexpr double | CellSize = 0.1 |
static constexpr double | CellOffset = 4.0 |
static constexpr int | HaloSize = 1 |
::tarch::timing::Measurement | timingComputeKernel |
::tarch::multicore::BooleanSemaphore | validateOutcomeSemaphore |
static constexpr int | NumberOfInputEntries |
static constexpr int | NumberOfOutputEntries |
static constexpr int | NumberOfFiniteVolumesPerPatch |
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 89 of file Acoustic-main.cpp.
References NumberOfInputEntries, and tarch::la::PI.
Referenced by runBenchmarks().
Main routine of the SPH code.
Definition at line 2162 of file Acoustic-main.cpp.
References peano4::fillLookupTables(), tarch::mpi::Rank::getGlobalMasterRank(), tarch::accelerator::Device::getInstance(), tarch::mpi::Rank::getInstance(), tarch::multicore::Core::getInstance(), tarch::initNonCriticalAssertionEnvironment(), peano4::initParallelEnvironment(), tarch::multicore::initSmartMPI(), logInfo, runBenchmarks(), tarch::shutdownNonCriticalAssertionEnvironment(), peano4::shutdownParallelEnvironment(), tarch::multicore::shutdownSmartMPI(), toString(), and validOutcome.
void reportRuntime | ( | const std::string & | kernelIdentificator, |
const ::tarch::timing::Measurement & | timingKernelLaunch, | ||
int | patches ) |
Definition at line 161 of file Acoustic-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.
This operation benchmarks exclusively the host performance. This happens in two steps: We first assess the baseline performance, i.e., the serial kernel call, and then we look if the multithreaded stateless optimisation pays off and what speedup we obtain.
These two steps may run on multiple threads to mimic the spacetree tasking and domain decomposition. In OpenMP for example, there is one parallel loop around the two steps which invokes the same benchmark per loop entry. However, only the first thread always will report its runtime. If you are not bandwidth-bound, the data you obtain should thus be independent of the number of threads used.
numberOfPatches | Number of patches to study |
Definition at line 482 of file Acoustic-main.cpp.
References assessKernel(), exahype2::CellData< inType, outType >::cellCentre, CellOffset, CellSize, exahype2::CellData< inType, outType >::cellSize, exahype2::CellData< inType, outType >::dt, endParallelFor, tarch::timing::Measurement::erase(), tarch::freeMemory(), tarch::timing::Watch::getCalendarTime(), tarch::mpi::Rank::getGlobalMasterRank(), tarch::mpi::Rank::getInstance(), tarch::mpi::Rank::getNumberOfRanks(), tarch::mpi::Rank::getRank(), HaloSize, tarch::accelerator::Device::HostDevice, initInputData(), logError, logInfo, tarch::ManagedSharedAcceleratorDeviceMemory, exahype2::CellData< inType, outType >::maxEigenvalue, peano4::utils::Nested, NumberOfInputEntries, NumberOfOutputEntries, parallelFor, exahype2::CellData< inType, outType >::QIn, exahype2::CellData< inType, outType >::QOut, reportRuntime(), peano4::utils::Serial, peano4::grid::GridTraversalEvent::setH(), tarch::timing::Measurement::setValue(), peano4::grid::GridTraversalEvent::setX(), peano4::utils::SpreadOut, tarch::timing::Watch::stop(), storeOutcome(), exahype2::CellData< inType, outType >::t, TimeStamp, TimeStepSize, exahype2::fv::rusanov::timeStepWithRusanovBatchedHeapStateless(), exahype2::fv::rusanov::sycl::timeStepWithRusanovBatchedHeapStateless(), exahype2::fv::rusanov::omp::timeStepWithRusanovBatchedHeapStateless(), exahype2::fv::rusanov::timeStepWithRusanovBatchedInsituStateless(), exahype2::fv::rusanov::sycl::timeStepWithRusanovBatchedManagedStateless(), exahype2::fv::rusanov::sycl::timeStepWithRusanovBatchedUSMStateless(), exahype2::fv::rusanov::cpp::timeStepWithRusanovBatchedUSMStateless(), exahype2::fv::rusanov::omp::timeStepWithRusanovBatchedUSMStateless(), exahype2::fv::rusanov::timeStepWithRusanovPatchwiseHeapStateless(), exahype2::fv::rusanov::sycl::timeStepWithRusanovPatchwiseHeapStateless(), exahype2::fv::rusanov::omp::timeStepWithRusanovPatchwiseHeapStateless(), exahype2::fv::rusanov::timeStepWithRusanovPatchwiseInsituStateless(), exahype2::fv::rusanov::sycl::timeStepWithRusanovPatchwiseUSMStateless(), exahype2::fv::rusanov::cpp::timeStepWithRusanovPatchwiseUSMStateless(), exahype2::fv::rusanov::omp::timeStepWithRusanovPatchwiseUSMStateless(), exahype2::fv::rusanov::sycl::timeStepWithRusanovTaskgraphCopyStateless(), exahype2::fv::rusanov::sycl::timeStepWithRusanovTaskgraphUSMStateless(), exahype2::fv::rusanov::timeStepWithRusanovVolumewiseStateless(), exahype2::fv::rusanov::omp::timeStepWithRusanovVolumewiseStateless(), timingComputeKernel, validateOutcome(), void, wrapBatchedHeapFunctorHostKernels(), wrapDeviceKernel(), wrapPatchwiseHeapFunctorsHostKernel(), wrapStatelessHostKernel(), and wrapVolumewiseFunctorHostKernels().
Referenced by main().
Store 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.
Definition at line 103 of file Acoustic-main.cpp.
References logInfo, applications::exahype2::acoustic::maxEigenvalue(), NumberOfOutputEntries, validateOutcomeSemaphore, validMaxEigenvalue, and validOutcome.
Referenced by runBenchmarks().
std::tuple< double, int > validateOutcome | ( | double * | Q, |
int | patchIndex, | ||
const double | maxEigenvalue ) |
Validate data against pre-stored simulation outcome.
Works if and only if storeOutcome has been performed before.
Definition at line 121 of file Acoustic-main.cpp.
References std::abs(), tarch::la::equals(), logError, applications::exahype2::acoustic::maxEigenvalue(), NumberOfOutputEntries, validateOutcomeSemaphore, validMaxEigenvalue, and validOutcome.
Referenced by runBenchmarks().
void wrapBatchedHeapFunctorHostKernels | ( | int | device, |
::exahype2::CellData< double, double > & | patchData ) |
Another wrapper.
Definition at line 285 of file Acoustic-main.cpp.
References assertionEquals, HaloSize, tarch::accelerator::Device::HostDevice, exahype2::CellData< inType, outType >::maxEigenvalue, exahype2::fv::rusanov::timeStepWithRusanovBatchedHeapFunctors(), and timingComputeKernel.
Referenced by runBenchmarks().
void wrapDeviceKernel | ( | int | device, |
::exahype2::CellData< double, double > & | patchData ) |
Definition at line 459 of file Acoustic-main.cpp.
References assertion, tarch::accelerator::Device::HostDevice, and timingComputeKernel.
Referenced by runBenchmarks().
void wrapPatchwiseHeapFunctorsHostKernel | ( | int | device, |
::exahype2::CellData< double, double > & | patchData ) |
This is a wrapper around the kernel call with the functors.
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.
Here, we use the functor-based generic kernel implementation.
Definition at line 204 of file Acoustic-main.cpp.
References assertionEquals, HaloSize, tarch::accelerator::Device::HostDevice, exahype2::CellData< inType, outType >::maxEigenvalue, exahype2::fv::rusanov::timeStepWithRusanovPatchwiseHeapFunctors(), and timingComputeKernel.
Referenced by runBenchmarks().
void wrapStatelessHostKernel | ( | int | device, |
::exahype2::CellData< double, double > & | patchData ) |
Wrapper around stateless kernel invocations.
Definition at line 451 of file Acoustic-main.cpp.
References assertionEquals, tarch::accelerator::Device::HostDevice, and timingComputeKernel.
Referenced by runBenchmarks().
void wrapVolumewiseFunctorHostKernels | ( | int | device, |
::exahype2::CellData< double, double > & | patchData ) |
Another wrapper.
Definition at line 366 of file Acoustic-main.cpp.
References assertionEquals, HaloSize, tarch::accelerator::Device::HostDevice, exahype2::CellData< inType, outType >::maxEigenvalue, exahype2::fv::rusanov::timeStepWithRusanovVolumewiseFunctors(), and timingComputeKernel.
Referenced by runBenchmarks().
::tarch::logging::Log _log("::") | ( | "::" | ) |
|
staticconstexpr |
Definition at line 43 of file Acoustic-main.cpp.
Referenced by runBenchmarks().
|
staticconstexpr |
Definition at line 42 of file Acoustic-main.cpp.
Referenced by runBenchmarks().
|
staticconstexpr |
Definition at line 44 of file Acoustic-main.cpp.
Referenced by runBenchmarks(), exahype2::fv::rusanov::tests::CopyPatchTest::testCopyPatch(), exahype2::fv::rusanov::internal::timeStepWithRusanovBatchedFunctors(), exahype2::fv::rusanov::internal::timeStepWithRusanovBatchedStateless(), exahype2::fv::rusanov::cpp::internal::timeStepWithRusanovBatchedStateless(), exahype2::fv::rusanov::omp::internal::timeStepWithRusanovBatchedStateless(), exahype2::fv::rusanov::internal::timeStepWithRusanovPatchwiseFunctors(), exahype2::fv::rusanov::internal::timeStepWithRusanovPatchwiseStateless(), exahype2::fv::rusanov::cpp::internal::timeStepWithRusanovPatchwiseStateless(), exahype2::fv::rusanov::omp::internal::timeStepWithRusanovPatchwiseStateless(), wrapBatchedHeapFunctorHostKernels(), wrapPatchwiseHeapFunctorsHostKernel(), and wrapVolumewiseFunctorHostKernels().
|
staticconstexpr |
Definition at line 74 of file Acoustic-main.cpp.
Referenced by reportRuntime().
|
staticconstexpr |
Definition at line 64 of file Acoustic-main.cpp.
Referenced by initInputData(), and runBenchmarks().
|
staticconstexpr |
Definition at line 69 of file Acoustic-main.cpp.
Referenced by runBenchmarks(), storeOutcome(), and validateOutcome().
|
staticconstexpr |
Definition at line 40 of file Acoustic-main.cpp.
Referenced by runBenchmarks().
|
staticconstexpr |
Definition at line 41 of file Acoustic-main.cpp.
Referenced by runBenchmarks().
::tarch::timing::Measurement timingComputeKernel |
Definition at line 45 of file Acoustic-main.cpp.
Referenced by reportRuntime(), runBenchmarks(), wrapBatchedHeapFunctorHostKernels(), wrapDeviceKernel(), wrapPatchwiseHeapFunctorsHostKernel(), wrapStatelessHostKernel(), and wrapVolumewiseFunctorHostKernels().
::tarch::multicore::BooleanSemaphore validateOutcomeSemaphore |
Definition at line 46 of file Acoustic-main.cpp.
Referenced by storeOutcome(), and validateOutcome().
double validMaxEigenvalue = 0.0 |
Definition at line 38 of file Acoustic-main.cpp.
Referenced by storeOutcome(), and validateOutcome().
double* validOutcome = nullptr |
Definition at line 39 of file Acoustic-main.cpp.
Referenced by main(), storeOutcome(), and validateOutcome().