Skip to content
Snippets Groups Projects
Verified Commit 4749dc25 authored by Dorian Stoll's avatar Dorian Stoll
Browse files

tug: cpp: Remove time measurement

parent 343d1042
No related branches found
No related tags found
No related merge requests found
......@@ -5,24 +5,18 @@
#include <iostream>
#include <string>
#include <tug/Simulation.hpp>
#include <vector>
using TugType = double;
int main(int argc, char **argv) {
double timings[3];
std::cout << "BARITE_200 started...";
run_bench(barite_200_input, "barite_200_output.csv");
std::cout << "BARITE_200 started with output... ";
timings[0] = run_bench(barite_200_input, "barite_200_output.csv");
std::cout << "Runtime: " << timings[0] << " [ms]\n";
std::cout << "BARITE_LARGE started...";
run_bench(barite_large_input, "barite_large_output.csv");
std::cout << "BARITE_LARGE started with output... ";
timings[1] = run_bench(barite_large_input, "barite_large_output.csv");
std::cout << "Runtime: " << timings[1] << " [ms]\n";
std::cout << "SURFEX started with output... ";
timings[2] = run_bench(surfex_input, "surfex_output.csv");
std::cout << "Runtime: " << timings[2] << " [ms]\n";
std::cout << "SURFEX started...";
run_bench(surfex_input, "surfex_output.csv");
return EXIT_SUCCESS;
}
......@@ -7,8 +7,6 @@
#include <Eigen/src/Core/Map.h>
#include <Eigen/src/Core/Matrix.h>
#include <Eigen/src/Core/util/Constants.h>
#include <chrono>
#include <ratio>
#include <vector>
#include <tug/Simulation.hpp>
......@@ -35,7 +33,7 @@ eigenMatrix_to_vector(const Eigen::MatrixX<TugType> &mat) {
}
}
double run_bench(const bench_input &input, const std::string &output_file) {
void run_bench(const bench_input &input, const std::string &output_file) {
std::vector<std::vector<double>> raw_data =
read_conc_csv<double>(input.csv_file_init, input.ncols, input.nrows);
......@@ -45,8 +43,6 @@ double run_bench(const bench_input &input, const std::string &output_file) {
Eigen::Map<RowMajorMat> alpha_x(raw_alpha_x.data(), input.nrows, input.ncols);
Eigen::Map<RowMajorMat> alpha_y(raw_alpha_y.data(), input.nrows, input.ncols);
const auto start_t = std::chrono::high_resolution_clock::now();
// create tug grids and boundary conditions
for (int i = 0; i < raw_data.size(); i++) {
......@@ -89,7 +85,7 @@ double run_bench(const bench_input &input, const std::string &output_file) {
int ompNumThreads = std::stoi(out, NULL);
sim.setNumberThreads(ompNumThreads);
}
sim.setTimestep(input.timestep);
sim.setIterations(input.iterations);
......@@ -100,12 +96,8 @@ double run_bench(const bench_input &input, const std::string &output_file) {
raw_data[i] = eigenMatrix_to_vector(result);
}
const auto end_t = std::chrono::high_resolution_clock::now();
// write results to file
if (!output_file.empty()) {
write_conc_csv(output_file, raw_data);
}
return std::chrono::duration<double, std::milli>(end_t - start_t).count();
}
......@@ -3,6 +3,6 @@
#include <bench_defs.hpp>
double run_bench(const bench_input &input, const std::string &output_file);
void run_bench(const bench_input &input, const std::string &output_file);
#endif // _RUN_HPP
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment