Peano
Loading...
Searching...
No Matches
KernelBenchmarks-main.cpp
Go to the documentation of this file.
1// This file is part of the ExaHyPE2 project. For conditions of distribution and
2// use, please see the copyright notice at www.peano-framework.org
3#include "KernelBenchmarks-main.h"
4
5#include "Constants.h"
6
7// #include "repositories/DataRepository.h"
8#include "repositories/SolverRepository.h"
9// #include "repositories/StepRepository.h"
10
11#include "exahype2/CellData.h"
12#include "exahype2/dg/DGUtils.h"
13#include "Utils.h"
14
15#include "kernels/AderSolver/BufferSizes.h"
16#include "kernels/AderSolver/DGMatrices.h"
17#include "kernels/AderSolver/FaceIntegral.h"
18#include "kernels/AderSolver/FusedSpaceTimePredictorVolumeIntegral.h"
19#include "kernels/AderSolver/MaxScaledEigenvalue.h"
20#include "kernels/AderSolver/Quadrature.h"
21#include "kernels/AderSolver/RiemannSolver.h"
22#include "peano4/peano4.h"
23#include "tarch/accelerator/accelerator.h"
24#include "tarch/accelerator/Device.h"
25#include "tarch/logging/Log.h"
26#include "tarch/multicore/BooleanSemaphore.h"
27#include "tarch/multicore/Core.h"
28#include "tarch/multicore/Lock.h"
29#include "tarch/multicore/multicore.h"
30#include "tarch/NonCriticalAssertions.h"
31#include "tarch/timing/Measurement.h"
32#include "tarch/timing/Watch.h"
33#include "Variants.h"
34
35#include <cstring>
36#include <fstream>
37
39
40tarch::logging::Log _log("::");
41
42constexpr double timeStamp = 0.0;
43constexpr double timeStepSize = 1e-6;
44const tarch::la::Vector<DIMENSIONS, double>
45 cellCenter = benchmarks::exahype2::kernelbenchmarks::DomainOffset
46 + 0.5 * benchmarks::exahype2::kernelbenchmarks::DomainSize;
47const tarch::la::Vector<DIMENSIONS, double> cellSize = benchmarks::exahype2::kernelbenchmarks::DomainSize / 81.0;
48// constexpr int HaloSize = 1;
49
50static_assert(Accuracy >= std::numeric_limits<double>::epsilon() || Accuracy == 0.0);
51
52int main(int argc, char** argv) {
53 peano4::init(&argc, &argv, benchmarks::exahype2::kernelbenchmarks::DomainOffset, benchmarks::exahype2::kernelbenchmarks::DomainSize);
54 repositories::initLogFilters();
55 repositories::startSimulation();
56
57 logInfo("main()", "number of compute threads: " << tarch::multicore::Core::getInstance().getNumberOfThreads());
58 logInfo("main()", "number of threads launching compute kernels: " << NumberOfLaunchingThreads);
59 logInfo("main()", "number of unknowns: " << AderSolver::NumberOfUnknowns);
60 logInfo("main()", "number of auxiliary variables: " << AderSolver::NumberOfAuxiliaryVariables);
61 logInfo("main()", "number of finite volumes per axis per cell: " << AderSolver::Order);
62 logInfo("main()", "number of samples per measurement: " << NumberOfSamples);
63 logInfo("main()", "performing accuracy checks with precision: " << Accuracy);
64#if defined(WITH_GPU_SYCL)
65 logInfo("main()", "set SYCL_DEVICE_FILTER=gpu or ONEAPI_DEVICE_SELECTOR=cuda:0 when using SYCL on the device");
66 logInfo("main()", "set SYCL_PI_TRACE=2 in case of runtime errors");
67#endif
68
69 std::ostringstream snapshotFileName;
70 snapshotFileName << "ader-benchmarks-prec-"
71 << typeid(SolverPrecision).name()
72 << ".csv";
73 std::ofstream file( snapshotFileName.str() );
74 file << "Variant,omp threads,cells,total compute time,total time (including launch),avg compute time,avg time,max,min,std deviation" << std::endl;
75
76 for (int i = 0; i < NumberOfCellsToStudy.size(); i++) {
77 logInfo("main()", "number of cells: " << NumberOfCellsToStudy[i]);
78 // TODO: All the variants below do not adhere to any alignment/padding. Therefore, the Riemann solver will potentially crash.
79 // variant1::runBenchmarks(NumberOfCellsToStudy[i], timeStamp, timeStepSize, cellCenter, cellSize);
80 // variant2::runBenchmarks(NumberOfCellsToStudy[i], timeStamp, timeStepSize, cellCenter, cellSize);
81 // variant3::runBenchmarks(NumberOfCellsToStudy[i], timeStamp, timeStepSize, cellCenter, cellSize);
82 // variant4::runBenchmarks(NumberOfCellsToStudy[i], timeStamp, timeStepSize, cellCenter, cellSize);
83 // variant5::runBenchmarks(NumberOfCellsToStudy[i], timeStamp, timeStepSize, cellCenter, cellSize);
84 // variant6::runBenchmarks(NumberOfCellsToStudy[i], timeStamp, timeStepSize, cellCenter, cellSize);
85 }
86
87 repositories::finishSimulation();
88 peano4::shutdown();
89
90 // if (outcomeIsInvalid) {
91 // return EXIT_FAILURE; // Make sure the CI pipeline reports an error
92 // }
93
94 return EXIT_SUCCESS;
95}
int main(int argc, char **argv)
constexpr double timeStamp
const tarch::la::Vector< DIMENSIONS, double > cellCenter
const tarch::la::Vector< DIMENSIONS, double > cellSize
tarch::logging::Log _log("::")
constexpr double timeStepSize