22#ifndef EXADG_ACOUSTIC_CONSERVATION_EQUATIONS_THROUGHPUT_H_
23#define EXADG_ACOUSTIC_CONSERVATION_EQUATIONS_THROUGHPUT_H_
26#ifdef EXADG_WITH_LIKWID
33#include <exadg/acoustic_conservation_equations/driver.h>
36#include <exadg/operators/hypercube_resolution_parameters.h>
37#include <exadg/operators/throughput_parameters.h>
38#include <exadg/utilities/general_parameters.h>
41#include <exadg/acoustic_conservation_equations/user_interface/declare_get_application.h>
46create_input_file(std::string
const & input_file)
48 dealii::ParameterHandler prm;
51 general.add_parameters(prm);
54 resolution.add_parameters(prm);
57 throughput.add_parameters(prm);
61 unsigned int const Dim = 2;
62 using Number = double;
63 Acoustics::get_application<Dim, Number>(input_file, MPI_COMM_WORLD)->add_parameters(prm);
65 prm.print_parameters(input_file,
66 dealii::ParameterHandler::Short |
67 dealii::ParameterHandler::KeepDeclarationOrder);
70template<
int dim,
typename Number>
73 std::string
const & input_file,
74 unsigned int const degree,
75 unsigned int const refine_space,
76 unsigned int const n_cells_1d,
77 MPI_Comm
const & mpi_comm,
80 std::shared_ptr<Acoustics::ApplicationBase<dim, Number>> application =
81 Acoustics::get_application<dim, Number>(input_file, mpi_comm);
83 application->set_parameters_throughput_study(degree, refine_space, n_cells_1d);
85 std::shared_ptr<Acoustics::Driver<dim, Number>> driver =
86 std::make_shared<Acoustics::Driver<dim, Number>>(mpi_comm, application, is_test,
true);
90 std::tuple<unsigned int, dealii::types::global_dof_index, double> wall_time =
91 driver->apply_operator(throughput.operator_type,
92 throughput.n_repetitions_inner,
93 throughput.n_repetitions_outer);
95 throughput.wall_times.push_back(wall_time);
100main(
int argc,
char ** argv)
102#ifdef EXADG_WITH_LIKWID
106 dealii::Utilities::MPI::MPI_InitFinalize mpi(argc, argv, 1);
108 MPI_Comm mpi_comm(MPI_COMM_WORLD);
110 std::string input_file;
114 if(dealii::Utilities::MPI::this_mpi_process(mpi_comm) == 0)
117 std::cout <<
"To run the program, use: ./throughput input_file" << std::endl
118 <<
"To setup the input file, use: ./throughput input_file --help" << std::endl;
126 input_file = std::string(argv[1]);
128 if(argc == 3 and std::string(argv[2]) ==
"--help")
130 if(dealii::Utilities::MPI::this_mpi_process(mpi_comm) == 0)
131 ExaDG::create_input_file(input_file);
141 auto const lambda_get_dofs_per_element =
142 [&](
unsigned int const dim,
unsigned int const degree, ExaDG::ElementType
const element_type) {
143 return ExaDG::Acoustics::get_dofs_per_element(dim, degree, element_type);
147 resolution.fill_resolution_vector(lambda_get_dofs_per_element);
150 for(
auto iter = resolution.resolutions.begin(); iter != resolution.resolutions.end(); ++iter)
152 unsigned int const degree = std::get<0>(*iter);
153 unsigned int const refine_space = std::get<1>(*iter);
154 unsigned int const n_cells_1d = std::get<2>(*iter);
156 if(general.dim == 2 and general.precision ==
"float")
158 ExaDG::run<2, float>(
159 throughput, input_file, degree, refine_space, n_cells_1d, mpi_comm, general.is_test);
161 else if(general.dim == 2 and general.precision ==
"double")
163 ExaDG::run<2, double>(
164 throughput, input_file, degree, refine_space, n_cells_1d, mpi_comm, general.is_test);
166 else if(general.dim == 3 and general.precision ==
"float")
168 ExaDG::run<3, float>(
169 throughput, input_file, degree, refine_space, n_cells_1d, mpi_comm, general.is_test);
171 else if(general.dim == 3 and general.precision ==
"double")
173 ExaDG::run<3, double>(
174 throughput, input_file, degree, refine_space, n_cells_1d, mpi_comm, general.is_test);
179 dealii::ExcMessage(
"Only dim = 2|3 and precision=float|double implemented."));
183 if(not(general.is_test))
184 throughput.print_results(mpi_comm);
186#ifdef EXADG_WITH_LIKWID
Definition general_parameters.h:32
Definition hypercube_resolution_parameters.h:183
Definition throughput_parameters.h:92