22#ifndef EXADG_OPERATORS_THROUGHPUT_PARAMETERS_H_
23#define EXADG_OPERATORS_THROUGHPUT_PARAMETERS_H_
26#ifdef EXADG_WITH_LIKWID
31#include <deal.II/base/parameter_handler.h>
32#include <deal.II/base/timer.h>
35#include <exadg/utilities/enum_patterns.h>
36#include <exadg/utilities/print_solver_results.h>
41measure_operator_evaluation_time(std::function<
void(
void)>
const & evaluate_operator,
42 unsigned int const degree,
43 unsigned int const n_repetitions_inner,
44 unsigned int const n_repetitions_outer,
45 MPI_Comm
const & mpi_comm)
49 dealii::Timer global_timer;
50 global_timer.restart();
51 dealii::Utilities::MPI::MinMaxAvg global_time;
53 double wall_time = std::numeric_limits<double>::max();
57 for(
unsigned int i_outer = 0; i_outer < n_repetitions_outer; ++i_outer)
62#ifdef EXADG_WITH_LIKWID
63 LIKWID_MARKER_START((
"degree_" + std::to_string(degree)).c_str());
67 for(
unsigned int i = 0; i < n_repetitions_inner; ++i)
72#ifdef EXADG_WITH_LIKWID
73 LIKWID_MARKER_STOP((
"degree_" + std::to_string(degree)).c_str());
76 MPI_Barrier(mpi_comm);
77 dealii::Utilities::MPI::MinMaxAvg wall_time_inner =
78 dealii::Utilities::MPI::min_max_avg(timer.wall_time(), mpi_comm);
80 wall_time = std::min(wall_time, wall_time_inner.avg / (
double)n_repetitions_inner);
83 global_time = dealii::Utilities::MPI::min_max_avg(global_timer.wall_time(), mpi_comm);
84 }
while(global_time.avg < 1.0 );
89template<
typename EnumOperatorType>
90struct ThroughputParameters
92 ThroughputParameters()
96 ThroughputParameters(std::string
const & input_file)
98 dealii::ParameterHandler prm;
100 prm.parse_input(input_file,
"",
true,
true);
104 add_parameters(dealii::ParameterHandler & prm)
106 prm.enter_subsection(
"Throughput");
109 "OperatorType", operator_type,
"Operator type.", Patterns::Enum<EnumOperatorType>(),
true);
110 prm.add_parameter(
"RepetitionsInner",
112 "Number of operator evaluations.",
113 dealii::Patterns::Integer(1),
115 prm.add_parameter(
"RepetitionsOuter",
117 "Number of runs (taking minimum wall time).",
118 dealii::Patterns::Integer(1, 10),
121 prm.leave_subsection();
125 print_results(MPI_Comm
const & mpi_comm)
135 unsigned int n_repetitions_inner = 100;
136 unsigned int n_repetitions_outer = 1;
139 mutable std::vector<std::tuple<unsigned int, dealii::types::global_dof_index, double>> wall_times;
EnumType default_constructor()
Returns the first value of EnumType. This is well-defined as compared to EnumType().
Definition enum_utilities.h:52
std::string enum_to_string(EnumType const enum_type)
Converts and enum to a string, returning the string.
Definition enum_utilities.h:71