22#ifndef INCLUDE_EXADG_OPERATORS_THROUGHPUT_PARAMETERS_H_
23#define INCLUDE_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>
42measure_operator_evaluation_time(std::function<
void(
void)>
const & evaluate_operator,
43 unsigned int const degree,
44 unsigned int const n_repetitions_inner,
45 unsigned int const n_repetitions_outer,
46 MPI_Comm
const & mpi_comm)
50 dealii::Timer global_timer;
51 global_timer.restart();
52 dealii::Utilities::MPI::MinMaxAvg global_time;
54 double wall_time = std::numeric_limits<double>::max();
58 for(
unsigned int i_outer = 0; i_outer < n_repetitions_outer; ++i_outer)
63#ifdef EXADG_WITH_LIKWID
64 LIKWID_MARKER_START((
"degree_" + std::to_string(degree)).c_str());
68 for(
unsigned int i = 0; i < n_repetitions_inner; ++i)
73#ifdef EXADG_WITH_LIKWID
74 LIKWID_MARKER_STOP((
"degree_" + std::to_string(degree)).c_str());
77 MPI_Barrier(mpi_comm);
78 dealii::Utilities::MPI::MinMaxAvg wall_time_inner =
79 dealii::Utilities::MPI::min_max_avg(timer.wall_time(), mpi_comm);
81 wall_time = std::min(wall_time, wall_time_inner.avg / (
double)n_repetitions_inner);
84 global_time = dealii::Utilities::MPI::min_max_avg(global_timer.wall_time(), mpi_comm);
85 }
while(global_time.avg < 1.0 );
90template<
typename EnumOperatorType>
91struct ThroughputParameters
93 ThroughputParameters()
97 ThroughputParameters(std::string
const & input_file)
99 dealii::ParameterHandler prm;
101 prm.parse_input(input_file,
"",
true,
true);
105 add_parameters(dealii::ParameterHandler & prm)
107 prm.enter_subsection(
"Throughput");
110 "OperatorType", operator_type,
"Operator type.", Patterns::Enum<EnumOperatorType>(),
true);
111 prm.add_parameter(
"RepetitionsInner",
113 "Number of operator evaluations.",
114 dealii::Patterns::Integer(1),
116 prm.add_parameter(
"RepetitionsOuter",
118 "Number of runs (taking minimum wall time).",
119 dealii::Patterns::Integer(1, 10),
122 prm.leave_subsection();
126 print_results(MPI_Comm
const & mpi_comm)
136 unsigned int n_repetitions_inner = 100;
137 unsigned int n_repetitions_outer = 1;
140 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:50
std::string enum_to_string(EnumType const enum_type)
Converts and enum to a string, returning the string.
Definition enum_utilities.h:69