print version of POET at program startup

This commit is contained in:
Max Lübke 2021-02-09 18:57:57 +01:00
parent 70c457f519
commit 9aafe8ebee
No known key found for this signature in database
GPG Key ID: D3201E51647D1199
3 changed files with 23 additions and 6 deletions

View File

@ -1,4 +1,7 @@
configure_file(poet.h.in poet.h)
add_executable(poet poet.cpp) 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_link_libraries(poet PRIVATE POET_Model POET_Util MPI::MPI_C)
target_compile_definitions(poet PRIVATE OMPI_SKIP_MPICXX) target_compile_definitions(poet PRIVATE OMPI_SKIP_MPICXX)

View File

@ -30,6 +30,8 @@
#include <string> #include <string>
#include <vector> #include <vector>
#include <poet.h>
using namespace std; using namespace std;
using namespace poet; using namespace poet;
using namespace Rcpp; using namespace Rcpp;
@ -55,15 +57,20 @@ int main(int argc, char *argv[]) {
MPI_Comm_split(MPI_COMM_WORLD, 1, world_rank, &dht_comm); 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 */ /* initialize R runtime */
RRuntime R(argc, argv); RRuntime R(argc, argv);
/*Loading Dependencies*/ /*Loading Dependencies*/
std::string r_load_dependencies = std::string r_load_dependencies = "suppressMessages(library(Rmufits));"
"suppressMessages(library(Rmufits));" "suppressMessages(library(RedModRphree));"
"suppressMessages(library(RedModRphree));" "source('kin_r_library.R');"
"source('kin_r_library.R');" "source('parallel_r_library.R');";
"source('parallel_r_library.R');";
R.parseEvalQ(r_load_dependencies); R.parseEvalQ(r_load_dependencies);
SimParams params(world_rank, world_size); SimParams params(world_rank, world_size);
@ -168,7 +175,7 @@ int main(int argc, char *argv[]) {
MPI_Barrier(MPI_COMM_WORLD); MPI_Barrier(MPI_COMM_WORLD);
} // END SIMULATION LOOP } // END SIMULATION LOOP
cout << "CPP: finished simulation loop" << endl; cout << "CPP: finished simulation loop" << endl;

7
src/poet.h.in Normal file
View File

@ -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