Peano
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 <fenv.h>
37 #pragma float_control(precise, on)
38 #pragma STDC FENV_ACCESS ON
39 
40 #include <fstream>
41 
43 
44 tarch::logging::Log _log("::");
45 
46 constexpr double timeStamp = 0.0;
47 constexpr double timeStepSize = 1e-6;
48 const tarch::la::Vector<DIMENSIONS, double>
49  cellCenter = benchmarks::exahype2::kernelbenchmarks::DomainOffset
50  + 0.5 * benchmarks::exahype2::kernelbenchmarks::DomainSize;
51 const tarch::la::Vector<DIMENSIONS, double> cellSize = benchmarks::exahype2::kernelbenchmarks::DomainSize / 81.0;
52 // constexpr int HaloSize = 1;
53 
54 static_assert(Accuracy >= std::numeric_limits<double>::epsilon() || Accuracy == 0.0);
55 
56 int main(int argc, char** argv) {
57  peano4::init(&argc, &argv, benchmarks::exahype2::kernelbenchmarks::DomainOffset, benchmarks::exahype2::kernelbenchmarks::DomainSize);
58  repositories::initLogFilters();
59 
60  if constexpr (EnableFPE) {
61  feenableexcept(FE_DIVBYZERO | FE_INVALID | FE_OVERFLOW);
62  }
63 
64  logInfo("main()", "number of compute threads: " << tarch::multicore::Core::getInstance().getNumberOfThreads());
65  logInfo("main()", "number of threads launching compute kernels: " << NumberOfLaunchingThreads);
66  logInfo("main()", "number of unknowns: " << AderSolver::NumberOfUnknowns);
67  logInfo("main()", "number of auxiliary variables: " << AderSolver::NumberOfAuxiliaryVariables);
68  logInfo("main()", "number of finite volumes per axis per cell: " << AderSolver::Order);
69  logInfo("main()", "number of samples per measurement: " << NumberOfSamples);
70  logInfo("main()", "floating-point exception handler enabled: " << std::boolalpha << EnableFPE);
71  logInfo("main()", "performing accuracy checks with precision: " << Accuracy);
72 #if defined(WITH_GPU_SYCL)
73  logInfo("main()", "set SYCL_DEVICE_FILTER=gpu or ONEAPI_DEVICE_SELECTOR=cuda:0 when using SYCL on the device");
74  logInfo("main()", "set SYCL_PI_TRACE=2 in case of runtime errors");
75 #endif
76 
77  std::ostringstream snapshotFileName;
78  snapshotFileName << "ader-benchmarks-prec-"
79  << typeid(SolverPrecision).name()
80  << ".csv";
81  std::ofstream file( snapshotFileName.str() );
82  file << "Variant,omp threads,cells,total compute time,total time (including launch),avg compute time,avg time,max,min,std deviation" << std::endl;
83 
84  for (int i = 0; i < NumberOfCellsToStudy.size(); i++) {
85  logInfo("main()", "number of cells: " << NumberOfCellsToStudy[i]);
92  }
93 
94  peano4::shutdown();
95 
96  // if (outcomeIsInvalid) {
97  // return EXIT_FAILURE; // Make sure the CI pipeline reports an error
98  // }
99 
100  return EXIT_SUCCESS;
101 }
constexpr double timeStamp
const tarch::la::Vector< DIMENSIONS, double > cellCenter
const tarch::la::Vector< DIMENSIONS, double > cellSize
constexpr double timeStepSize
int main(int argc, char **argv)
tarch::logging::Log _log("::")
void runBenchmarks(int numberOfCells, double timeStamp, double timeStepSize, const tarch::la::Vector< DIMENSIONS, double > cellCenter, const tarch::la::Vector< DIMENSIONS, double > cellSize)
Definition: Variant1.cpp:224
void runBenchmarks(int numberOfCells, double timeStamp, double timeStepSize, const tarch::la::Vector< DIMENSIONS, double > cellCenter, const tarch::la::Vector< DIMENSIONS, double > cellSize)
Definition: Variant2.cpp:229
void runBenchmarks(int numberOfCells, double timeStamp, double timeStepSize, const tarch::la::Vector< DIMENSIONS, double > cellCenter, const tarch::la::Vector< DIMENSIONS, double > cellSize)
Definition: Variant3.cpp:225
void runBenchmarks(int numberOfCells, double timeStamp, double timeStepSize, const tarch::la::Vector< DIMENSIONS, double > cellCenter, const tarch::la::Vector< DIMENSIONS, double > cellSize)
Definition: Variant4.cpp:223
void runBenchmarks(int numberOfCells, double timeStamp, double timeStepSize, const tarch::la::Vector< DIMENSIONS, double > cellCenter, const tarch::la::Vector< DIMENSIONS, double > cellSize)
Definition: Variant5.cpp:225
void runBenchmarks(int numberOfCells, double timeStamp, double timeStepSize, const tarch::la::Vector< DIMENSIONS, double > cellCenter, const tarch::la::Vector< DIMENSIONS, double > cellSize)
Definition: Variant6.cpp:231