added CMake install process + rearrange data dir

This commit is contained in:
Max Lübke 2021-02-09 19:57:05 +01:00
parent 9aafe8ebee
commit ff332ab9aa
No known key found for this signature in database
GPG Key ID: D3201E51647D1199
12 changed files with 58 additions and 50 deletions

View File

@ -7,6 +7,8 @@ project(POET VERSION 0.1 LANGUAGES CXX C)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED True)
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
list(APPEND CMAKE_MODULE_PATH "${POET_SOURCE_DIR}/CMake")
# set(GCC_CXX_FLAGS "-D STRICT_R_HEADERS")
@ -18,4 +20,6 @@ find_package(R REQUIRED)
find_package(Rcpp REQUIRED)
find_package(RInside REQUIRED)
add_subdirectory(src)
add_subdirectory(src)
add_subdirectory(R_lib)
add_subdirectory(data)

View File

@ -8,6 +8,12 @@
POET is a coupled reactive transport simulator implementing a parallel
architecture and a fast distributed hash table.
## External Libraries
We use external libraries:
- **argh** - https://github.com/adishavit/argh (BSD license)
## Installation
### Requirements
@ -65,29 +71,42 @@ $ R
$ cd <POET_dir>
# Build process
$ cmake . -B build
$ cd build
$ make
# move poet executable into POET project root
$ mv src/poet ..
$ cd ..
$ mkdir build && cd build
$ cmake -DCMAKE_INSTALL_PREFIX=/home/<user>/poet ..
$ make -j<max_numprocs>
$ make install
```
The executable can now be found in the POET project root.
This will install a POET project structure into `/home/<user>/poet` which is
called hereinafter `<POET_INSTALL_DIR>`. With this version of POET I would not
recommend to install to hierarchies like `/usr/local/` etc.
The correspondending directory tree would be look like this:
``` sh
.
└── poet/
├── bin/
│ └── poet
├── data/
│ └── SimDol2D.R
└── R_lib/
├── kin_r_library.R
└── parallel_r_library.R
```
The R libraries will be read in during runtime and the paths are hardcoded
absolute paths inside `poet.cpp`. So, if you consider to move `bin/poet` either
change paths of the R source files and recompile POET or also move `R_lib/*`
according to the binary.
## Running
Before POET is ready to run, a working directory must be created. In this
directory you should find the executable file, the R scripts
`<POET_ROOT>/R_lib/kin_r_library.R` and `<POET_ROOT>/R_lib/parallel_r_library.R`
and the simulation description e.g. `<POET_ROOT>/data/chem_problems/SimDol2D.R`.
Run POET by `mpirun ./poet <OPTIONS> <SIMFILE> <OUTPUT_DIRECTORY>` where:
- **OPTIONS** - runtime parameters (explained below)
- **SIMFILE** - simulation described as R script (currently supported:
`<POET_ROOT>/data/chem_problems/SimDol2D.R`)
`<POET_INSTALL_DIR>/data/SimDol2D.R`)
- **OUTPUT_DIRECTORY** - path, where all output of POET should be stored
### Runtime options
@ -123,29 +142,15 @@ Following values can be set:
### Example: Running from scratch
To continue the above example and start a simulation with `SimDol2D.R`:
We will continue the above example and start a simulation with `SimDol2D.R`,
which is the only simulation supported at this moment. To start the simulation
with 4 processes `cd` into your previously installed POET-dir
`<POET_INSTALL_DIR>/bin` and run:
``` sh
mkdir WORK_DIR
cp data/chem_problems/SimDol2D.R WORK_DIR
cp R_lib/kin_r_library.R R_lib/parallel_r_library.R WORK_DIR
mv poet WORK_DIR
mpirun -n 4 ./poet ../data/SimDol2D.R output
```
The correspondending directory tree would be look like this:
``` sh
.
└── WORK_DIR/
├── poet
├── kin_r_library.R
├── parallel_r_library.R
└── SimDol2D.R
```
Now, to start the simulation with 4 processes `cd` into `WORK_DIR` and run `mpirun -n 4 ./poet
SimDol2D.R output`.
After a finished simulation all data generated by POET will be found in the
directory `output`.
@ -153,27 +158,22 @@ You might want to use the DHT to cache previously simulated data points and
reuse them in further time-steps. Just append `-dht` to the options of POET to
activate the usage of the DHT. The resulting call would look like this:
`mpirun -n 4 ./poet -dht SimDol2D.R output`
``` sh
mpirun -n 4 ./poet -dht SimDol2D.R output
```
## Examples included (more to come)
- **SimDol2D.R** - simple chemistry (Calcite/Dolomite) on a 50x50 2D grid, 20
time steps 2)
- **SimDolKtz.R** - simple chemistry (Calcite/Dolomite) on Ketzin grid (~650k
- ~~ **SimDolKtz.R** - simple chemistry (Calcite/Dolomite) on Ketzin grid (~650k
elements), 20 time steps The flow snapshots are **NOT INCLUDED** in project
directory but must be provided separately
directory but must be provided separately.~~
## About the usage of MPI_Wtime()
Implemented time measurement functions uses `MPI_Wtime()`. Some important
Implemented time measurement functions use `MPI_Wtime()`. Some important
informations from the OpenMPI Man Page:
For example, on platforms that support it, the clock_gettime() function will be
used to obtain a monotonic clock value with whatever precision is supported on
that platform (e.g., nanoseconds).
## External Libraries
We use external libraries:
- **argh** - https://github.com/adishavit/argh (BSD license)

1
R_lib/CMakeLists.txt Normal file
View File

@ -0,0 +1 @@
install(FILES kin_r_library.R parallel_r_library.R DESTINATION R_lib)

1
data/CMakeLists.txt Normal file
View File

@ -0,0 +1 @@
install(FILES SimDol2D.R DESTINATION data)

View File

@ -2,9 +2,11 @@ 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_link_libraries(poet PUBLIC POET_Model POET_Util MPI::MPI_C)
target_compile_definitions(poet PRIVATE OMPI_SKIP_MPICXX)
install(TARGETS poet DESTINATION bin)
add_subdirectory(DHT)
add_subdirectory(model)
add_subdirectory(util)

View File

@ -69,8 +69,8 @@ int main(int argc, char *argv[]) {
/*Loading Dependencies*/
std::string r_load_dependencies = "suppressMessages(library(Rmufits));"
"suppressMessages(library(RedModRphree));"
"source('kin_r_library.R');"
"source('parallel_r_library.R');";
"source('../R_lib/kin_r_library.R');"
"source('../R_lib/parallel_r_library.R');";
R.parseEvalQ(r_load_dependencies);
SimParams params(world_rank, world_size);

View File

@ -1,4 +1,4 @@
add_library(POET_Util RRuntime.cpp SimParams.cpp)
target_include_directories(POET_Util PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${R_INCLUDE_DIRS})
target_link_libraries(POET_Util ${R_LIBRARIES})
target_compile_definitions(POET_Util PUBLIC STRICT_R_HEADERS)
target_link_libraries(POET_Util PUBLIC ${R_LIBRARIES})
target_compile_definitions(POET_Util PUBLIC STRICT_R_HEADERS)