22#ifndef INCLUDE_EXADG_INCOMPRESSIBLE_NAVIER_STOKES_THROUGHPUT_H_
23#define INCLUDE_EXADG_INCOMPRESSIBLE_NAVIER_STOKES_THROUGHPUT_H_
26#ifdef EXADG_WITH_LIKWID
33#include <exadg/incompressible_navier_stokes/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/incompressible_navier_stokes/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);
63 unsigned int const Dim = 2;
64 typedef double Number;
65 IncNS::get_application<Dim, Number>(input_file, MPI_COMM_WORLD)->add_parameters(prm);
71 prm.print_parameters(input_file,
72 dealii::ParameterHandler::Short |
73 dealii::ParameterHandler::KeepDeclarationOrder);
76template<
int dim,
typename Number>
79 std::string
const & input_file,
80 unsigned int const degree,
81 unsigned int const refine_space,
82 unsigned int const n_cells_1d,
83 MPI_Comm
const & mpi_comm,
86 std::shared_ptr<IncNS::ApplicationBase<dim, Number>> application =
87 IncNS::get_application<dim, Number>(input_file, mpi_comm);
89 application->set_parameters_throughput_study(degree, refine_space, n_cells_1d);
91 std::shared_ptr<IncNS::Driver<dim, Number>> driver =
92 std::make_shared<IncNS::Driver<dim, Number>>(mpi_comm, application, is_test,
true);
96 std::tuple<unsigned int, dealii::types::global_dof_index, double> wall_time =
97 driver->apply_operator(throughput.operator_type,
98 throughput.n_repetitions_inner,
99 throughput.n_repetitions_outer);
101 throughput.wall_times.push_back(wall_time);
106main(
int argc,
char ** argv)
108#ifdef EXADG_WITH_LIKWID
112 dealii::Utilities::MPI::MPI_InitFinalize mpi(argc, argv, 1);
114 MPI_Comm mpi_comm(MPI_COMM_WORLD);
116 std::string input_file;
120 if(dealii::Utilities::MPI::this_mpi_process(mpi_comm) == 0)
123 std::cout <<
"To run the program, use: ./throughput input_file" << std::endl
124 <<
"To setup the input file, use: ./throughput input_file --help" << std::endl;
132 input_file = std::string(argv[1]);
134 if(argc == 3 and std::string(argv[2]) ==
"--help")
136 if(dealii::Utilities::MPI::this_mpi_process(mpi_comm) == 0)
137 ExaDG::create_input_file(input_file);
147 ExaDG::IncNS::PressureDegree pressure_degree = ExaDG::IncNS::PressureDegree::MixedOrder;
149 dealii::ParameterHandler prm;
151 prm.enter_subsection(
"Throughput");
153 prm.add_parameter(
"PressureDegree",
155 "Degree of pressure shape functions.",
156 ExaDG::Patterns::Enum<ExaDG::IncNS::PressureDegree>(),
159 prm.leave_subsection();
161 prm.parse_input(input_file,
"",
true,
true);
163 auto const lambda_get_dofs_per_element =
164 [&](
unsigned int const dim,
unsigned int const degree, ExaDG::ElementType
const element_type) {
165 return ExaDG::IncNS::get_dofs_per_element(
166 throughput.operator_type, pressure_degree, dim, degree, element_type);
170 resolution.fill_resolution_vector(lambda_get_dofs_per_element);
173 for(
auto iter = resolution.resolutions.begin(); iter != resolution.resolutions.end(); ++iter)
175 unsigned int const degree = std::get<0>(*iter);
176 unsigned int const refine_space = std::get<1>(*iter);
177 unsigned int const n_cells_1d = std::get<2>(*iter);
179 if(general.dim == 2 and general.precision ==
"float")
181 ExaDG::run<2, float>(
182 throughput, input_file, degree, refine_space, n_cells_1d, mpi_comm, general.is_test);
184 else if(general.dim == 2 and general.precision ==
"double")
186 ExaDG::run<2, double>(
187 throughput, input_file, degree, refine_space, n_cells_1d, mpi_comm, general.is_test);
189 else if(general.dim == 3 and general.precision ==
"float")
191 ExaDG::run<3, float>(
192 throughput, input_file, degree, refine_space, n_cells_1d, mpi_comm, general.is_test);
194 else if(general.dim == 3 and general.precision ==
"double")
196 ExaDG::run<3, double>(
197 throughput, input_file, degree, refine_space, n_cells_1d, mpi_comm, general.is_test);
202 dealii::ExcMessage(
"Only dim = 2|3 and precision=float|double implemented."));
206 if(not(general.is_test))
207 throughput.print_results(mpi_comm);
209#ifdef EXADG_WITH_LIKWID
Definition general_parameters.h:32
Definition hypercube_resolution_parameters.h:183
Definition throughput_parameters.h:92