From 66bef8148ad9cba082d06c2b8e6fa34d752b1bc6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Max=20L=C3=BCbke?= Date: Tue, 9 Feb 2021 18:57:57 +0100 Subject: [PATCH] print version of POET at program startup --- src/CMakeLists.txt | 3 +++ src/poet.cpp | 19 +++++++++++++------ src/poet.h.in | 7 +++++++ 3 files changed, 23 insertions(+), 6 deletions(-) create mode 100644 src/poet.h.in diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 449fe66c6..ce3a89413 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,4 +1,7 @@ +configure_file(poet.h.in poet.h) + add_executable(poet poet.cpp) +target_include_directories(poet PUBLIC "${PROJECT_BINARY_DIR}/src") target_link_libraries(poet PRIVATE POET_Model POET_Util MPI::MPI_C) target_compile_definitions(poet PRIVATE OMPI_SKIP_MPICXX) diff --git a/src/poet.cpp b/src/poet.cpp index 5ed95302c..8c57ca079 100644 --- a/src/poet.cpp +++ b/src/poet.cpp @@ -30,6 +30,8 @@ #include #include +#include + using namespace std; using namespace poet; using namespace Rcpp; @@ -55,15 +57,20 @@ int main(int argc, char *argv[]) { MPI_Comm_split(MPI_COMM_WORLD, 1, world_rank, &dht_comm); } + if (world_rank == 0) { + cout << "Running POET in version " << poet_version_major << "." + << poet_version_minor << endl + << endl; + } + /* initialize R runtime */ RRuntime R(argc, argv); /*Loading Dependencies*/ - std::string r_load_dependencies = - "suppressMessages(library(Rmufits));" - "suppressMessages(library(RedModRphree));" - "source('kin_r_library.R');" - "source('parallel_r_library.R');"; + std::string r_load_dependencies = "suppressMessages(library(Rmufits));" + "suppressMessages(library(RedModRphree));" + "source('kin_r_library.R');" + "source('parallel_r_library.R');"; R.parseEvalQ(r_load_dependencies); SimParams params(world_rank, world_size); @@ -168,7 +175,7 @@ int main(int argc, char *argv[]) { MPI_Barrier(MPI_COMM_WORLD); - } // END SIMULATION LOOP + } // END SIMULATION LOOP cout << "CPP: finished simulation loop" << endl; diff --git a/src/poet.h.in b/src/poet.h.in new file mode 100644 index 000000000..66700e7b8 --- /dev/null +++ b/src/poet.h.in @@ -0,0 +1,7 @@ +#ifndef POET_H +#define POET_H + +const int poet_version_major = @POET_VERSION_MAJOR@; +const int poet_version_minor = @POET_VERSION_MINOR@; + +#endif // POET_H