From 13404733cdd87d9495dcda86bb91ecfbe940c385 Mon Sep 17 00:00:00 2001 From: TobiasEppacher Date: Mon, 8 Jan 2024 16:35:01 +0100 Subject: [PATCH] Changed default 2dRect benchmark to use xml file and removed performance test cli option (simply always log csv file at the end, no performance overhead during simulation) --- benchmarks/2DParticleRect/2DParticleRect.cpp | 58 ++++++------------- .../2DParticleRect/BenchmarkRectFrame.xml | 25 ++++++++ benchmarks/{2DParticleRect => }/2D_task4.cpp | 2 +- benchmarks/CMakeLists.txt | 2 +- benchmarks/FileLoader.h | 30 ++++++++++ benchmarks/{2DParticleRect => }/contest1.cpp | 2 +- benchmarks/profiles/profile_task4.txt | 38 ------------ benchmarks/simulation_schema.xsd | 1 + src/MolSim.cpp | 3 + src/io/cli/CLIParams.h | 5 -- src/io/cli/CLIParser.cpp | 8 +-- src/io/input/xml/XMLFileReader.cpp | 6 +- src/io/{ => output}/csv/CSVWriter.cpp | 0 src/io/{ => output}/csv/CSVWriter.h | 0 src/simulation/Simulation.cpp | 31 ---------- src/simulation/Simulation.h | 2 - src/simulation/SimulationOverview.cpp | 36 ++++++++++++ src/simulation/SimulationOverview.h | 11 ++++ src/simulation/SimulationParams.cpp | 5 +- src/simulation/SimulationParams.h | 10 +--- .../RadialDistributionFunctionInterceptor.h | 2 +- tests/data/FileLoader.h | 2 +- tests/simulation/SimulationUtils.h | 5 +- 23 files changed, 139 insertions(+), 145 deletions(-) create mode 100644 benchmarks/2DParticleRect/BenchmarkRectFrame.xml rename benchmarks/{2DParticleRect => }/2D_task4.cpp (95%) create mode 100644 benchmarks/FileLoader.h rename benchmarks/{2DParticleRect => }/contest1.cpp (98%) delete mode 100644 benchmarks/profiles/profile_task4.txt create mode 120000 benchmarks/simulation_schema.xsd rename src/io/{ => output}/csv/CSVWriter.cpp (100%) rename src/io/{ => output}/csv/CSVWriter.h (100%) diff --git a/benchmarks/2DParticleRect/2DParticleRect.cpp b/benchmarks/2DParticleRect/2DParticleRect.cpp index 3ece2b8a3..e2f0dbe5f 100644 --- a/benchmarks/2DParticleRect/2DParticleRect.cpp +++ b/benchmarks/2DParticleRect/2DParticleRect.cpp @@ -1,6 +1,8 @@ #include #include +#include "../FileLoader.h" +#include "io/input/FileInputHandler.h" #include "io/logger/Logger.h" #include "io/output/FileOutputHandler.h" #include "particles/containers/ParticleContainer.h" @@ -16,6 +18,10 @@ void execute2DRectBenchmark(int rect_width, int rect_height, double spacing, dou Logger::logger->set_level(spdlog::level::info); Logger::logger->info("Starting 2DRect-benchmark. Dimensions {}x{}...", rect_width, rect_height); + // Parse input file + auto [initial_particles, simulation_arguments] = + FileInputHandler::readFile(FileLoader::get_input_file_path("2DParticleRect/BenchmarkRectFrame.xml"), true); + // Settings for the Linked Cells Container simulation std::array domain_size = {300, 300, 3}; std::array boundary_conditions = { @@ -28,10 +34,6 @@ void execute2DRectBenchmark(int rect_width, int rect_height, double spacing, dou CuboidSpawner spawner(center_offset - std::array{rect_width * spacing / 2, rect_height * spacing / 2, 0}, {rect_width, rect_height, 1}, spacing, 1, {0, 0, 0}, 0); - // Settings for the forces for both simulations - std::vector> forces; - forces.push_back(std::make_shared()); - // ############################################################ // # Direct Sum Container // ############################################################ @@ -41,7 +43,7 @@ void execute2DRectBenchmark(int rect_width, int rect_height, double spacing, dou // Instantiation of the Direct Sum Container simulation - SimulationParams params_ds("2DParticleRect.xml", 0.01, 5, SimulationParams::DirectSumType{}, {}, {}, forces, true, true); + SimulationParams params_ds{*simulation_arguments}; params_ds.num_particles = particles_ds.size(); @@ -51,6 +53,7 @@ void execute2DRectBenchmark(int rect_width, int rect_height, double spacing, dou params_ds.logSummary(); SimulationOverview direct_sum_data = simulation_ds.runSimulation(); direct_sum_data.logSummary(); + direct_sum_data.savePerformanceDataCSV("DirectSum" + std::to_string(rect_width) + "x" + std::to_string(rect_height)); // ############################################################ // # Linked Cells Container @@ -59,52 +62,27 @@ void execute2DRectBenchmark(int rect_width, int rect_height, double spacing, dou std::vector particles_lc; spawner.spawnParticles(particles_lc); // Instantiation of the Linked Cells Container simulation - SimulationParams params_lc{"2DParticleRect.xml", - 0.01, - 5, - SimulationParams::LinkedCellsType{domain_size, lc_cutoff, boundary_conditions}, - {}, - {}, - forces, - true, - true}; + SimulationParams params_lc{*simulation_arguments}; + params_lc.container_type = SimulationParams::LinkedCellsType{domain_size, lc_cutoff, boundary_conditions}; params_lc.num_particles = particles_lc.size(); + Simulation simulation_lc(particles_lc, params_lc); // Simulating with Linked Cells Container params_lc.logSummary(); SimulationOverview linked_cells_data = simulation_lc.runSimulation(); linked_cells_data.logSummary(); + linked_cells_data.savePerformanceDataCSV("LinkedCells" + std::to_string(rect_width) + "x" + std::to_string(rect_height)); // ############################################################ // # Comparison Logging // ############################################################ - std::string ds_summary = ""; - for (auto& summary : direct_sum_data.interceptor_summaries) { - ds_summary += summary + ";"; - } - - std::string lc_summary = ""; - for (auto& summary : linked_cells_data.interceptor_summaries) { - lc_summary += summary + ";"; - } - - Logger::logger->info("Simulation of {} particles in a {}x{} grid\n", rect_width * rect_height, rect_width, rect_height); - - Logger::logger->info("Direct sum container:"); - Logger::logger->info(" Simulation took {:.3f}s", direct_sum_data.total_time_seconds); - Logger::logger->info(" Total iterations: {}", direct_sum_data.total_iterations); - Logger::logger->info(" Average time per iteration: {:.3f}ms\n", direct_sum_data.total_time_seconds / direct_sum_data.total_iterations); - Logger::logger->info(" Summary {}", ds_summary); - - Logger::logger->info("Linked cells container:"); - Logger::logger->info(" Domain size: {:.0f}x{:.0f}x{:.0f}", domain_size[0], domain_size[1], domain_size[2]); - Logger::logger->info(" Linked cells cutoff radius: {:.0f}", lc_cutoff); - Logger::logger->info(" Simulation took {:.3f}s", linked_cells_data.total_time_seconds); - Logger::logger->info(" Total iterations: {}", linked_cells_data.total_iterations); - Logger::logger->info(" Average time per iteration: {:.3f}ms\n", - linked_cells_data.total_time_seconds / linked_cells_data.total_iterations); - Logger::logger->info(" Summary {}", lc_summary); + Logger::logger->info("Comparison of Direct Sum and Linked Cells Container:"); + // Ratio between Direct Sum and Linked Cells Container performance + Logger::logger->info("Runtime Direct Sum: {} s", direct_sum_data.total_time_seconds); + Logger::logger->info("Runtime Linked Cells: {} s", linked_cells_data.total_time_seconds); + Logger::logger->info("Performance ratio (DirectSum / LinkedCells): {}", + direct_sum_data.total_time_seconds / linked_cells_data.total_time_seconds); } /* diff --git a/benchmarks/2DParticleRect/BenchmarkRectFrame.xml b/benchmarks/2DParticleRect/BenchmarkRectFrame.xml new file mode 100644 index 000000000..0a9740105 --- /dev/null +++ b/benchmarks/2DParticleRect/BenchmarkRectFrame.xml @@ -0,0 +1,25 @@ + + + + + + 0.01 + 5.0 + false + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/benchmarks/2DParticleRect/2D_task4.cpp b/benchmarks/2D_task4.cpp similarity index 95% rename from benchmarks/2DParticleRect/2D_task4.cpp rename to benchmarks/2D_task4.cpp index 78dfe4fda..f25d11b88 100644 --- a/benchmarks/2DParticleRect/2D_task4.cpp +++ b/benchmarks/2D_task4.cpp @@ -41,7 +41,6 @@ void execute2DRectBenchmark(int rect_width, int rect_height, double spacing, dou {}, {}, forces, - true, true}; params_lc.num_particles = particles_lc.size(); Simulation simulation_lc(particles_lc, params_lc); @@ -49,6 +48,7 @@ void execute2DRectBenchmark(int rect_width, int rect_height, double spacing, dou params_lc.logSummary(); SimulationOverview linked_cells_data = simulation_lc.runSimulation(); linked_cells_data.logSummary(); + linked_cells_data.savePerformanceDataCSV("Task4" + std::to_string(rect_width) + "x" + std::to_string(rect_height)); } int main() { diff --git a/benchmarks/CMakeLists.txt b/benchmarks/CMakeLists.txt index 8dfffd7c6..2c0a36b4f 100644 --- a/benchmarks/CMakeLists.txt +++ b/benchmarks/CMakeLists.txt @@ -18,5 +18,5 @@ foreach (_source IN ITEMS ${BENCHMARK_SRC}) add_executable(${_name} EXCLUDE_FROM_ALL ${_source}) target_link_libraries(${_name} project_lib) add_dependencies(benchmarks ${_name}) + target_compile_definitions(${_name} PRIVATE BENCHMARK_DATA_DIR="${CMAKE_CURRENT_SOURCE_DIR}") endforeach () - \ No newline at end of file diff --git a/benchmarks/FileLoader.h b/benchmarks/FileLoader.h new file mode 100644 index 000000000..ce93e64a5 --- /dev/null +++ b/benchmarks/FileLoader.h @@ -0,0 +1,30 @@ +#include + +#include +#include + +#pragma once + +class FileLoader { + public: + /** + * @brief Gets the path to the data directory + * + * Uses the cmake target_compile_definitions PRIVATE BENCHMARK_DATA_DIR to define the path to the data directory. + */ + static std::string get_benchmark_data_dir() { +#ifdef BENCHMARK_DATA_DIR + return BENCHMARK_DATA_DIR; +#else + throw std::runtime_error("Error: BENCHMARK_DATA_DIR not defined"); +#endif + } + + /** + * @brief Gets the path to a file in the input directory + * + * @param file_name The name of the file + * @return std::filesystem::path The path to the file + */ + static std::filesystem::path get_input_file_path(const std::string& file_name) { return {get_benchmark_data_dir() + "/" + file_name}; } +}; diff --git a/benchmarks/2DParticleRect/contest1.cpp b/benchmarks/contest1.cpp similarity index 98% rename from benchmarks/2DParticleRect/contest1.cpp rename to benchmarks/contest1.cpp index 560ec5f33..0e564450e 100644 --- a/benchmarks/2DParticleRect/contest1.cpp +++ b/benchmarks/contest1.cpp @@ -52,7 +52,6 @@ void execute2DRectBenchmark() { simple_force_sources, pairwise_forces, false, - false, "./output"}; params_lc.num_particles = particles_lc.size(); Simulation simulation_lc(particles_lc, params_lc); @@ -60,6 +59,7 @@ void execute2DRectBenchmark() { params_lc.logSummary(); SimulationOverview linked_cells_data = simulation_lc.runSimulation(); linked_cells_data.logSummary(); + linked_cells_data.savePerformanceDataCSV("Contest"); } int main() { diff --git a/benchmarks/profiles/profile_task4.txt b/benchmarks/profiles/profile_task4.txt deleted file mode 100644 index a48245b74..000000000 --- a/benchmarks/profiles/profile_task4.txt +++ /dev/null @@ -1,38 +0,0 @@ - Performance counter stats for './2D_task4': - - 11.976,80 msec task-clock # 0,998 CPUs utilized - 106 context-switches # 8,850 /sec - 10 cpu-migrations # 0,835 /sec - 7.254 page-faults # 605,671 /sec - 42.911.841.329 cycles # 3,583 GHz - 48.914.779.670 instructions # 1,14 insn per cycle - 7.906.726.555 branches # 660,170 M/sec - 99.253.680 branch-misses # 1,26% of all branches - - 11,995333820 seconds time elapsed - - 11,965410000 seconds user - -Profile of './contest1' of the relevant functions (sorted by cpu time): - - 24,46% contest1 contest1 [.] LinkedCellsContainer::applyPairwiseForces ◆ - 15,67% contest1 libm.so.6 [.] __ieee754_pow_fma ▒ - 15,10% contest1 contest1 [.] Particle::operator== ▒ - 11,20% contest1 contest1 [.] Cell::addAlreadyInfluencedBy ▒ - 10,37% contest1 contest1 [.] LennardJonesForce::calculateForce ▒ - 5,04% contest1 contest1 [.] LinkedCellsContainer::deleteHaloParticles ▒ - 2,89% contest1 contest1 [.] Particle::setF ▒ - 2,41% contest1 contest1 [.] LinkedCellsContainer::updateCellsParticleReferences ▒ - 1,79% contest1 libm.so.6 [.] pow@@GLIBC_2.29 ▒ - 1,35% contest1 libc.so.6 [.] _int_malloc ▒ - 1,30% contest1 contest1 [.] LinkedCellsContainer::particlePosToCell ▒ - 1,24% contest1 contest1 [.] Particle::operator== ▒ - 0,97% contest1 contest1 [.] VerletFunctor::step ▒ - 0,87% contest1 contest1 [.] Particle::getX ▒ - 0,65% contest1 libc.so.6 [.] malloc ▒ - 0,56% contest1 libc.so.6 [.] _int_free ▒ - 0,41% contest1 contest1 [.] Cell::getParticleReferences ▒ - 0,39% contest1 contest1 [.] Cell::clearAlreadyInfluencedBy ▒ - 0,31% contest1 contest1 [.] Cell::getAlreadyInfluencedBy ▒ - 0,25% contest1 contest1 [.] Cell::addParticleReference ▒ - 0,24% contest1 contest1 [.] Particle::getF \ No newline at end of file diff --git a/benchmarks/simulation_schema.xsd b/benchmarks/simulation_schema.xsd new file mode 120000 index 000000000..f3091075d --- /dev/null +++ b/benchmarks/simulation_schema.xsd @@ -0,0 +1 @@ +../src/io/xml_schemas/simulation_input/simulation_input_schema.xsd \ No newline at end of file diff --git a/src/MolSim.cpp b/src/MolSim.cpp index be1acd51a..a183adbc3 100644 --- a/src/MolSim.cpp +++ b/src/MolSim.cpp @@ -25,5 +25,8 @@ int main(int argc, char* argsv[]) { // Print simulation overview overview.logSummary(); + // Save performance data to csv file + overview.savePerformanceDataCSV(); + return 0; } diff --git a/src/io/cli/CLIParams.h b/src/io/cli/CLIParams.h index 108fa3d29..40c11d9f8 100644 --- a/src/io/cli/CLIParams.h +++ b/src/io/cli/CLIParams.h @@ -8,11 +8,6 @@ struct CLIParams { */ std::filesystem::path input_file_path; - /** - * Whether to run a performance test - */ - bool performance_test; - /** * Whether to use cached data or rerun all the (sub)simulations from scratch */ diff --git a/src/io/cli/CLIParser.cpp b/src/io/cli/CLIParser.cpp index 5534e5070..75f0db984 100644 --- a/src/io/cli/CLIParser.cpp +++ b/src/io/cli/CLIParser.cpp @@ -11,7 +11,6 @@ CLIParams parse_arguments(int argc, char* argsv[]) { std::string log_level; std::string log_output; - bool performance_test = false; bool fresh = false; // choosing 0 as one of the parameters (end_time, delta_t, fps, video_length) is equivalent to choosing the default value @@ -22,7 +21,6 @@ CLIParams parse_arguments(int argc, char* argsv[]) { "The path to the input file. Must be specified, otherwise the program will terminate. Can be inserted as positional argument."); options_desc.add_options()("log_level,l", boost::program_options::value(&log_level)->default_value("info"), "The log level. Possible values: trace, debug, info, warning, error, critical, off"); - options_desc.add_options()("performance_test,p", "Run the simulation in performance test mode"); options_desc.add_options()( "log_output", boost::program_options::value(&log_output)->default_value("std"), "You can only choose between the output options std(only cl output) and file (only file output). Default: no file output"); @@ -64,11 +62,8 @@ CLIParams parse_arguments(int argc, char* argsv[]) { Logger::logger->info(help_message.str()); exit(-1); } - if (variables_map.count("performance_test")) { - performance_test = true; - } - return CLIParams{input_file_path, performance_test, fresh}; + return CLIParams{input_file_path, fresh}; } SimulationParams merge_parameters(const CLIParams& params_cli, const std::optional& file_params) { @@ -81,7 +76,6 @@ SimulationParams merge_parameters(const CLIParams& params_cli, const std::option // Update the parameters with the ones from the command line params.fresh = params_cli.fresh; - params.performance_test = params_cli.performance_test; return params; } \ No newline at end of file diff --git a/src/io/input/xml/XMLFileReader.cpp b/src/io/input/xml/XMLFileReader.cpp index d41586392..4e8ee95d2 100644 --- a/src/io/input/xml/XMLFileReader.cpp +++ b/src/io/input/xml/XMLFileReader.cpp @@ -123,9 +123,9 @@ std::tuple, SimulationParams> prepareParticles(std::filesy auto forces = XSDToInternalTypeAdapter::convertToForces(settings.forces()); - auto params = SimulationParams{curr_file_path, settings.delta_t(), settings.end_time(), container_type, - interceptors, std::get<0>(forces), std::get<1>(forces), false, - fresh, output_base_path}; + auto params = SimulationParams{curr_file_path, settings.delta_t(), settings.end_time(), container_type, + interceptors, std::get<0>(forces), std::get<1>(forces), fresh, + output_base_path}; if (output_base_path.empty()) { output_base_path = params.output_dir_path; diff --git a/src/io/csv/CSVWriter.cpp b/src/io/output/csv/CSVWriter.cpp similarity index 100% rename from src/io/csv/CSVWriter.cpp rename to src/io/output/csv/CSVWriter.cpp diff --git a/src/io/csv/CSVWriter.h b/src/io/output/csv/CSVWriter.h similarity index 100% rename from src/io/csv/CSVWriter.h rename to src/io/output/csv/CSVWriter.h diff --git a/src/simulation/Simulation.cpp b/src/simulation/Simulation.cpp index a7a680e74..15dd614f0 100644 --- a/src/simulation/Simulation.cpp +++ b/src/simulation/Simulation.cpp @@ -8,14 +8,12 @@ #include #include "integration/IntegrationMethods.h" -#include "io/csv/CSVWriter.h" #include "io/logger/Logger.h" #include "particles/containers/directsum/DirectSumContainer.h" #include "particles/containers/linkedcells/LinkedCellsContainer.h" #include "simulation/SimulationParams.h" #include "simulation/interceptors/SimulationInterceptor.h" #include "simulation/interceptors/frame_writer/FrameWriterInterceptor.h" -#include "simulation/interceptors/particle_update_counter/ParticleUpdateCounterInterceptor.h" #include "simulation/interceptors/progress_bar/ProgressBarInterceptor.h" #include "simulation/interceptors/radial_distribution_function/RadialDistributionFunctionInterceptor.h" #include "simulation/interceptors/thermostat/ThermostatInterceptor.h" @@ -98,34 +96,5 @@ SimulationOverview Simulation::runSimulation() { SimulationOverview overview{params, total_time_ms / 1000.0, iteration, interceptor_summaries, std::vector(particle_container->begin(), particle_container->end())}; - if (params.performance_test) { - savePerformanceTest(overview, params); - } - return overview; } - -void Simulation::savePerformanceTest(const SimulationOverview& overview, const SimulationParams& params) { - // write the results to the file - std::time_t now = std::chrono::system_clock::to_time_t(std::chrono::system_clock::now()); - auto formatted_time = fmt::format("{:%d.%m.%Y-%H:%M:%S}", fmt::localtime(now)); - - CSVWriter csv_writer( - params.output_dir_path / ("performance_test_" + formatted_time + ".csv"), - {"num_particles", "particle_container", "delta_t", "total_time[s]", "particle_updates_per_second[1/s]", "total_iterations"}); - - // find ParticleUpdateCounterInterceptor - auto particle_update_counter = std::find_if(params.interceptors.begin(), params.interceptors.end(), [](auto& interceptor) { - return std::dynamic_pointer_cast(interceptor) != nullptr; - }); - - auto particle_updates_per_second = - particle_update_counter != params.interceptors.end() - ? std::dynamic_pointer_cast(*particle_update_counter)->getParticleUpdatesPerSecond() - : -1; - - std::string container_type_string = std::visit([](auto&& arg) { return std::string(arg); }, params.container_type); - - csv_writer.writeRow({params.num_particles, container_type_string, params.delta_t, overview.total_time_seconds, - particle_updates_per_second, overview.total_iterations}); -} diff --git a/src/simulation/Simulation.h b/src/simulation/Simulation.h index f7c3fd8cf..474065d3e 100644 --- a/src/simulation/Simulation.h +++ b/src/simulation/Simulation.h @@ -54,8 +54,6 @@ class Simulation { */ std::unique_ptr integration_functor; - static void savePerformanceTest(const SimulationOverview& overview, const SimulationParams& params); - /** * Befriend the interceptors to allow them to access the private members of this class */ diff --git a/src/simulation/SimulationOverview.cpp b/src/simulation/SimulationOverview.cpp index ef970aab0..25dfcbfba 100644 --- a/src/simulation/SimulationOverview.cpp +++ b/src/simulation/SimulationOverview.cpp @@ -1,7 +1,15 @@ #include "SimulationOverview.h" +#include + +#include +#include +#include + #include "io/logger/Logger.h" +#include "io/output/csv/CSVWriter.h" #include "simulation/SimulationParams.h" +#include "simulation/interceptors/particle_update_counter/ParticleUpdateCounterInterceptor.h" #include "utils/FormatTime.h" void SimulationOverview::logSummary(int depth) const { @@ -26,3 +34,31 @@ void SimulationOverview::logSummary(int depth) const { Logger::logger->info("{}╚════════════════════════════════════════", indent); } + +void SimulationOverview::savePerformanceDataCSV() const { savePerformanceDataCSV(""); } + +void SimulationOverview::savePerformanceDataCSV(const std::string& filename_prefix) const { + // write the results to the file + std::time_t now = std::chrono::system_clock::to_time_t(std::chrono::system_clock::now()); + auto formatted_time = fmt::format("{:%d.%m.%Y-%H:%M:%S}", fmt::localtime(now)); + + CSVWriter csv_writer( + params.output_dir_path / (filename_prefix + (filename_prefix.empty() ? "" : "_") + "performance_data_" + formatted_time + ".csv"), + {"num_particles", "particle_container", "delta_t", "total_time[s]", "particle_updates_per_second[1/s]", "total_iterations"}); + + // find ParticleUpdateCounterInterceptor + auto particle_update_counter = std::find_if(params.interceptors.begin(), params.interceptors.end(), [](auto& interceptor) { + return std::dynamic_pointer_cast(interceptor) != nullptr; + }); + + auto particle_updates_per_second = + particle_update_counter != params.interceptors.end() + ? std::to_string( + std::dynamic_pointer_cast(*particle_update_counter)->getParticleUpdatesPerSecond()) + : "N/A"; + + std::string container_type_string = std::visit([](auto&& arg) { return std::string(arg); }, params.container_type); + + csv_writer.writeRow( + {params.num_particles, container_type_string, params.delta_t, total_time_seconds, particle_updates_per_second, total_iterations}); +} \ No newline at end of file diff --git a/src/simulation/SimulationOverview.h b/src/simulation/SimulationOverview.h index c929eec85..d90a1dee8 100644 --- a/src/simulation/SimulationOverview.h +++ b/src/simulation/SimulationOverview.h @@ -42,4 +42,15 @@ class SimulationOverview { * @param depth determines the indentation of the log message */ void logSummary(int depth = 0) const; + + /** + * @brief Saves the simulation overview to a csv file + */ + void savePerformanceDataCSV() const; + + /** + * @brief Saves the simulation overview to a csv file + * @param filename_prefix Prefix for the outputted filename (\_performance_data_\.csv) + */ + void savePerformanceDataCSV(const std::string& filename_prefix) const; }; \ No newline at end of file diff --git a/src/simulation/SimulationParams.cpp b/src/simulation/SimulationParams.cpp index 6c5744483..618e30900 100644 --- a/src/simulation/SimulationParams.cpp +++ b/src/simulation/SimulationParams.cpp @@ -77,8 +77,8 @@ SimulationParams::SimulationParams(const std::filesystem::path& input_file_path, const std::variant& container_type, const std::vector>& interceptors, const std::vector>& simple_forces, - const std::vector>& pairwise_forces, bool performance_test, - bool fresh, const std::filesystem::path& base_path) + const std::vector>& pairwise_forces, bool fresh, + const std::filesystem::path& base_path) : input_file_path(std::filesystem::absolute(input_file_path)), delta_t(delta_t), end_time(end_time), @@ -86,7 +86,6 @@ SimulationParams::SimulationParams(const std::filesystem::path& input_file_path, container_type(container_type), simple_forces(simple_forces), pairwise_forces(pairwise_forces), - performance_test(performance_test), fresh(fresh) { if (end_time < 0) { Logger::logger->error("End time must be positive"); diff --git a/src/simulation/SimulationParams.h b/src/simulation/SimulationParams.h index 0e3ae909a..e369f9feb 100644 --- a/src/simulation/SimulationParams.h +++ b/src/simulation/SimulationParams.h @@ -102,11 +102,6 @@ class SimulationParams { */ size_t num_particles; - /** - * @brief Whether to run the simulation in performance test mode - */ - bool performance_test; - /** * @brief Flag to indicate whether the simulation should be run from scratch, or whether cached data should be used */ @@ -122,7 +117,6 @@ class SimulationParams { * @param interceptors List of interceptors to be used in the simulation * @param simple_forces Simple Forces to be applied to the particles * @param pairwise_forces Forces to be applied to the particles - * @param performance_test Whether to run the simulation in performance test mode * @param fresh Flag to indicate whether the simulation should be run from scratch, or whether cached data should be used * @param base_path Base path to the output directory. This is used to construct the output directory path if none is given * explicitly. Defaults to "./output/" @@ -131,8 +125,8 @@ class SimulationParams { const std::variant& container_type, const std::vector>& interceptors, const std::vector>& simple_forces, - const std::vector>& pairwise_forces, bool performance_test = false, - bool fresh = false, const std::filesystem::path& base_path = "./output"); + const std::vector>& pairwise_forces, bool fresh = false, + const std::filesystem::path& base_path = "./output"); /** * @brief Prints a summary of the simulation parameters to the console diff --git a/src/simulation/interceptors/radial_distribution_function/RadialDistributionFunctionInterceptor.h b/src/simulation/interceptors/radial_distribution_function/RadialDistributionFunctionInterceptor.h index 81315cc6d..23a72da78 100644 --- a/src/simulation/interceptors/radial_distribution_function/RadialDistributionFunctionInterceptor.h +++ b/src/simulation/interceptors/radial_distribution_function/RadialDistributionFunctionInterceptor.h @@ -2,7 +2,7 @@ #include #include -#include "io/csv/CSVWriter.h" +#include "io/output/csv/CSVWriter.h" #include "simulation/interceptors/SimulationInterceptor.h" class RadialDistributionFunctionInterceptor : public SimulationInterceptor { diff --git a/tests/data/FileLoader.h b/tests/data/FileLoader.h index 0c742b16b..d0b757572 100644 --- a/tests/data/FileLoader.h +++ b/tests/data/FileLoader.h @@ -16,7 +16,7 @@ class FileLoader { #ifdef TEST_DATA_DIR return TEST_DATA_DIR; #else - Logger::logger->error("Error: TEST_DATA_DIR not defined."); + throw std::runtime_error("Error: TEST_DATA_DIR not defined."); #endif } diff --git a/tests/simulation/SimulationUtils.h b/tests/simulation/SimulationUtils.h index c206e6a61..682d804cc 100644 --- a/tests/simulation/SimulationUtils.h +++ b/tests/simulation/SimulationUtils.h @@ -13,9 +13,8 @@ const std::shared_ptr gravitational_force = std::make_shared const std::shared_ptr lennard_jones_force = std::make_shared(); const SimulationParams TEST_DEFAULT_PARAMS_GRAVITY(FileLoader::get_input_file_path("empty.xml"), 0.002, 5, - SimulationParams::DirectSumType{}, {video_writer}, {}, {gravitational_force}, false, - true); + SimulationParams::DirectSumType{}, {video_writer}, {}, {gravitational_force}, true); const SimulationParams TEST_DEFAULT_PARAMS_LENNARD_JONES(FileLoader::get_input_file_path("empty.xml"), 0.002, 5, SimulationParams::DirectSumType{}, {video_writer}, {}, {lennard_jones_force}, - false, true); \ No newline at end of file + true); \ No newline at end of file