From db8e08f5bc2cda6260d3b6e89a75d0cf85e2514b Mon Sep 17 00:00:00 2001 From: Matthew Carbone Date: Mon, 25 Dec 2023 23:03:28 -0500 Subject: [PATCH] Add hdspin-postprocess executable --- CMakeLists.txt | 17 +++++++++++++++++ src/main.cpp | 2 -- src/main_postprocess.cpp | 10 ++++++++++ src/utils.cpp | 6 ++++-- 4 files changed, 31 insertions(+), 4 deletions(-) create mode 100644 src/main_postprocess.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 9b0822f..9e602ca 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -39,6 +39,9 @@ if (${BUILD_TESTS}) endif() + +# Build the core package + find_package(MPI REQUIRED) if(MPI_FOUND) @@ -83,3 +86,17 @@ else() endif() target_link_libraries(hdspin ${MPI_CXX_LIBRARIES}) + + +# Build the postprocessing executable +# Useful for if the main job doesn't actually finish, but we want to just +# process what we have + +add_executable( + hdspin-postprocess + src/main_postprocess.cpp + src/utils.cpp + src/processing_utils.cpp +) + +target_link_libraries(hdspin-postprocess ${MPI_CXX_LIBRARIES}) diff --git a/src/main.cpp b/src/main.cpp index 0583131..d9f2992 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -73,8 +73,6 @@ int main(int argc, char *argv[]) "is faster, and selects that one." )->check(CLI::IsMember({"standard", "gillespie", "auto"})); - // YOU LEFT OFF HERE!!!! - // Need to change this definition in the utils files app.add_option( "-n, --n_tracers", p.n_tracers, "The number of simulations to run in total, defaults to 100." diff --git a/src/main_postprocess.cpp b/src/main_postprocess.cpp new file mode 100644 index 0000000..313a845 --- /dev/null +++ b/src/main_postprocess.cpp @@ -0,0 +1,10 @@ +#include +#include "processing_utils.h" + + +int main(int argc, char *argv[]) +{ + MPI_Init(&argc, &argv); + processing_utils::postprocess(); + MPI_Finalize(); +} diff --git a/src/utils.cpp b/src/utils.cpp index 79a9e5f..e4c1c23 100644 --- a/src/utils.cpp +++ b/src/utils.cpp @@ -251,10 +251,12 @@ void make_directories() system(command.c_str()); } + +// Does nothing for now void cleanup_directories() { - std::string command = "rm -r " + std::string(GRID_PATH); - system(command.c_str()); + // std::string command = "rm -r " + std::string(GRID_PATH); + // system(command.c_str()); } void make_energy_grid_logspace(const size_t log10_timesteps, const size_t n_gridpoints)