mirror of
https://git.gfz-potsdam.de/naaice/poet.git
synced 2025-12-16 12:54:50 +01:00
Prepare project to transfer to svn + set poet version with help of
git/textfiles
This commit is contained in:
parent
a5f95c328d
commit
8b9450d3c0
28
CMake/POET_Scripts.cmake
Normal file
28
CMake/POET_Scripts.cmake
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
# Set or get version
|
||||||
|
macro(get_POET_version)
|
||||||
|
if(EXISTS ${PROJECT_SOURCE_DIR}/.git)
|
||||||
|
find_program(GIT_EXECUTABLE git DOC "git executable")
|
||||||
|
mark_as_advanced(GIT_EXECUTABLE)
|
||||||
|
execute_process(
|
||||||
|
COMMAND ${GIT_EXECUTABLE} rev-parse --abbrev-ref HEAD
|
||||||
|
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
|
||||||
|
OUTPUT_VARIABLE POET_GIT_BRANCH
|
||||||
|
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||||
|
execute_process(
|
||||||
|
COMMAND ${GIT_EXECUTABLE} describe --always
|
||||||
|
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
|
||||||
|
OUTPUT_VARIABLE POET_GIT_VERSION
|
||||||
|
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||||
|
if(NOT POET_GIT_BRANCH STREQUAL "master")
|
||||||
|
set(POET_VERSION "${POET_GIT_BRANCH}/${POET_GIT_VERSION}")
|
||||||
|
else()
|
||||||
|
set(POET_VERSION "${POET_GIT_VERSION}")
|
||||||
|
endif()
|
||||||
|
elseif(EXISTS ${PROJECT_SOURCE_DIR}/.svn)
|
||||||
|
file(STRINGS .gitversion POET_VERSION)
|
||||||
|
else()
|
||||||
|
set(POET_VERSION "0.1")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
message(STATUS "Configuring POET version ${POET_VERSION}")
|
||||||
|
endmacro(get_POET_version)
|
||||||
@ -1,7 +1,7 @@
|
|||||||
# Version 3.9+ offers new MPI package variables
|
# Version 3.9+ offers new MPI package variables
|
||||||
cmake_minimum_required(VERSION 3.9)
|
cmake_minimum_required(VERSION 3.9)
|
||||||
|
|
||||||
project(POET VERSION 0.1 LANGUAGES CXX C)
|
project(POET CXX C)
|
||||||
|
|
||||||
# specify the C++ standard
|
# specify the C++ standard
|
||||||
set(CMAKE_CXX_STANDARD 14)
|
set(CMAKE_CXX_STANDARD 14)
|
||||||
@ -9,10 +9,10 @@ set(CMAKE_CXX_STANDARD_REQUIRED True)
|
|||||||
|
|
||||||
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
|
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
|
||||||
|
|
||||||
|
include("CMake/POET_Scripts.cmake")
|
||||||
list(APPEND CMAKE_MODULE_PATH "${POET_SOURCE_DIR}/CMake")
|
list(APPEND CMAKE_MODULE_PATH "${POET_SOURCE_DIR}/CMake")
|
||||||
|
|
||||||
# set(GCC_CXX_FLAGS "-D STRICT_R_HEADERS")
|
# set(GCC_CXX_FLAGS "-D STRICT_R_HEADERS") add_definitions(${GCC_CXX_FLAGS})
|
||||||
# add_definitions(${GCC_CXX_FLAGS})
|
|
||||||
|
|
||||||
find_package(MPI REQUIRED)
|
find_package(MPI REQUIRED)
|
||||||
|
|
||||||
|
|||||||
89
README.md
89
README.md
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
<!--
|
<!--
|
||||||
Time-stamp: "Last modified 2021-02-08 13:46:00 mluebke"
|
Time-stamp: "Last modified 2021-02-08 13:46:00 mluebke"
|
||||||
-->
|
-->
|
||||||
@ -38,31 +37,43 @@ The following R libraries must then be installed:
|
|||||||
|
|
||||||
### Compiling source code
|
### Compiling source code
|
||||||
|
|
||||||
The generation of makefiles is done with CMake. So, running
|
The generation of makefiles is done with CMake. If you obtain POET from a git repository you should be able to generate Makefiles by running
|
||||||
|
|
||||||
```
|
```sh
|
||||||
cmake . -B build
|
mkdir build && cd build
|
||||||
|
cmake ..
|
||||||
```
|
```
|
||||||
|
|
||||||
will create the directory `build`. `cd` into it and run `make` to start build
|
This will create the directory `build` and processes the CMake files and generate Makefiles from it. You're now able to run `make` to start build
|
||||||
process.
|
process.
|
||||||
|
|
||||||
If everything went well you'll find the executable at `build/src/poet`.
|
If POET was obtained from the official SVN repository or the redmine at <https://redmine.cs.uni-potsdam.de/projects/poet> the branch or tag to be used have to be set via
|
||||||
|
|
||||||
During the generation of Makefiles, various options can be specified via `cmake
|
```sh
|
||||||
-D <option>=<value> [...]`. Currently there are the following available options:
|
mkdir build && cd build
|
||||||
|
cmake -D POET_SET_BRANCH="<BRANCH>" ..
|
||||||
|
```
|
||||||
|
|
||||||
- **DHT_Debug**=*boolean* - toggles the output of detailed statistics about DHT
|
where currently available branches/tags are:
|
||||||
usage (`cmake -D DHT_Debug=ON`). Defaults to *OFF*.
|
|
||||||
- **BUIL_DOC**=*boolean* - toggles the generation of documantiation during
|
- dev
|
||||||
compilation process. Defaults to *ON*.
|
|
||||||
|
If everything went well you'll find the executable at `build/src/poet`, but it is recommended to install the POET project structure to a desired `CMAKE_INSTALL_PREFIX` with `make install`.
|
||||||
|
|
||||||
|
During the generation of Makefiles, various options can be specified via `cmake -D <option>=<value> [...]`. Currently there are the following available options:
|
||||||
|
|
||||||
|
- **DHT_Debug**=_boolean_ - toggles the output of detailed statistics about DHT
|
||||||
|
usage (`cmake -D DHT_Debug=ON`). Defaults to _OFF_.
|
||||||
|
- **BUILD_DOC**=_boolean_ - toggles the generation of documantiation during
|
||||||
|
compilation process. Defaults to _ON_.
|
||||||
|
- _only from svn version:_ **POET_SET_BRANCH**=_string_ - set branch or tag whose code is used
|
||||||
|
|
||||||
### Example: Build from scratch
|
### Example: Build from scratch
|
||||||
|
|
||||||
Assuming that only the C/C++ compiler, MPI libraries, R runtime environment and
|
Assuming that only the C/C++ compiler, MPI libraries, R runtime environment and
|
||||||
CMake have been installed, POET can be installed as follows:
|
CMake have been installed, POET can be installed as follows:
|
||||||
|
|
||||||
``` sh
|
```sh
|
||||||
# start R environment
|
# start R environment
|
||||||
$ R
|
$ R
|
||||||
|
|
||||||
@ -88,7 +99,7 @@ recommend to install to hierarchies like `/usr/local/` etc.
|
|||||||
|
|
||||||
The correspondending directory tree would look like this:
|
The correspondending directory tree would look like this:
|
||||||
|
|
||||||
``` sh
|
```sh
|
||||||
.
|
.
|
||||||
└── poet/
|
└── poet/
|
||||||
├── bin/
|
├── bin/
|
||||||
@ -130,17 +141,17 @@ Run POET by `mpirun ./poet <OPTIONS> <SIMFILE> <OUTPUT_DIRECTORY>` where:
|
|||||||
|
|
||||||
The following parameters can be set:
|
The following parameters can be set:
|
||||||
|
|
||||||
| Option | Value | Description |
|
| Option | Value | Description |
|
||||||
|-------------------------|--------------|-----------------------------------------------------------------|
|
| ----------------------- | ------------ | -------------------------------------------------------------- |
|
||||||
| **-work-package-size=** | *1..n* | size of work packages (defaults to *5*) |
|
| **-work-package-size=** | _1..n_ | size of work packages (defaults to _5_) |
|
||||||
| **-ignore-result** | | disables store of simulation resuls |
|
| **-ignore-result** | | disables store of simulation resuls |
|
||||||
| **-dht** | | enabling DHT usage (defaults to *OFF*) |
|
| **-dht** | | enabling DHT usage (defaults to _OFF_) |
|
||||||
| **-dht-nolog** | | disabling applying of logarithm before rounding |
|
| **-dht-nolog** | | disabling applying of logarithm before rounding |
|
||||||
| **-dht-signif=** | *1..n* | set rounding to number of significant digits (defaults to *5*) |
|
| **-dht-signif=** | _1..n_ | set rounding to number of significant digits (defaults to _5_) |
|
||||||
| **-dht-strategy=** | *0-1* | change DHT strategy. **NOT IMPLEMENTED YET** (Defaults to *0*) |
|
| **-dht-strategy=** | _0-1_ | change DHT strategy. **NOT IMPLEMENTED YET** (Defaults to _0_) |
|
||||||
| **-dht-size=** | *1-n* | size of DHT per process involved in byte (defaults to *1 GiB*) |
|
| **-dht-size=** | _1-n_ | size of DHT per process involved in byte (defaults to _1 GiB_) |
|
||||||
| **-dht-snaps=** | *0-2* | disable or enable storage of DHT snapshots |
|
| **-dht-snaps=** | _0-2_ | disable or enable storage of DHT snapshots |
|
||||||
| **-dht-file=** | `<SNAPSHOT>` | initializes DHT with the given snapshot file |
|
| **-dht-file=** | `<SNAPSHOT>` | initializes DHT with the given snapshot file |
|
||||||
|
|
||||||
#### Additions to `dht-signif`
|
#### Additions to `dht-signif`
|
||||||
|
|
||||||
@ -148,27 +159,26 @@ Only used if no vector is given in setup file. For individual valuies per column
|
|||||||
use R vector `signif_vector` in `SIMFILE`.
|
use R vector `signif_vector` in `SIMFILE`.
|
||||||
|
|
||||||
#### Additions to `dht-snaps`
|
#### Additions to `dht-snaps`
|
||||||
Following values can be set:
|
|
||||||
- *0* = snapshots are disabled
|
|
||||||
- *1* = only stores snapshot at the end of the simulation with name
|
|
||||||
`<OUTPUT_DIRECTORY>.dht`
|
|
||||||
- *2* = stores snapshot at the end and after each iteration iteration
|
|
||||||
snapshot files are stored in <DIRECTORY>/iter<n>.dht
|
|
||||||
|
|
||||||
|
Following values can be set:
|
||||||
|
|
||||||
|
- _0_ = snapshots are disabled
|
||||||
|
- _1_ = only stores snapshot at the end of the simulation with name
|
||||||
|
`<OUTPUT_DIRECTORY>.dht`
|
||||||
|
- _2_ = stores snapshot at the end and after each iteration iteration
|
||||||
|
snapshot files are stored in `<DIRECTORY>/iter<n>.dht`
|
||||||
|
|
||||||
### Example: Running from scratch
|
### Example: Running from scratch
|
||||||
|
|
||||||
|
|
||||||
We will 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
|
which is the only simulation supported at this moment. To start the simulation
|
||||||
with 4 processes `cd` into your previously installed POET-dir
|
with 4 processes `cd` into your previously installed POET-dir
|
||||||
`<POET_INSTALL_DIR>/bin` and run:
|
`<POET_INSTALL_DIR>/bin` and run:
|
||||||
|
|
||||||
``` sh
|
```sh
|
||||||
mpirun -n 4 ./poet ../data/SimDol2D.R output
|
mpirun -n 4 ./poet ../data/SimDol2D.R output
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
After a finished simulation all data generated by POET will be found in the
|
After a finished simulation all data generated by POET will be found in the
|
||||||
directory `output`.
|
directory `output`.
|
||||||
|
|
||||||
@ -176,20 +186,21 @@ 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
|
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:
|
activate the usage of the DHT. The resulting call would look like this:
|
||||||
|
|
||||||
``` sh
|
```sh
|
||||||
mpirun -n 4 ./poet -dht SimDol2D.R output
|
mpirun -n 4 ./poet -dht SimDol2D.R output
|
||||||
```
|
```
|
||||||
|
|
||||||
## Examples included (more to come)
|
## Examples included (more to come)
|
||||||
|
|
||||||
- **SimDol2D.R** - simple chemistry (Calcite/Dolomite) on a 50x50 2D grid, 20
|
- **SimDol2D.R** - simple chemistry (Calcite/Dolomite) on a 50x50 2D grid, 20
|
||||||
time steps 2)
|
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
|
elements), 20 time steps The flow snapshots are **NOT INCLUDED** in project
|
||||||
directory but must be provided separately.~~ At this moment **SimDolKtz.R** is
|
directory but must be provided separately.~~ At this moment **SimDolKtz.R** is
|
||||||
not supported.
|
not supported.
|
||||||
|
|
||||||
## About the usage of MPI_Wtime()
|
## About the usage of MPI_Wtime()
|
||||||
|
|
||||||
Implemented time measurement functions uses `MPI_Wtime()`. Some important
|
Implemented time measurement functions uses `MPI_Wtime()`. Some important
|
||||||
informations from the OpenMPI Man Page:
|
informations from the OpenMPI Man Page:
|
||||||
|
|
||||||
|
|||||||
@ -63,7 +63,7 @@ USE_MDFILE_AS_MAINPAGE = @PROJECT_SOURCE_DIR@/./README.md
|
|||||||
# Note that relative paths are relative to the directory from which doxygen is
|
# Note that relative paths are relative to the directory from which doxygen is
|
||||||
# run.
|
# run.
|
||||||
|
|
||||||
EXCLUDE = @PROJECT_SOURCE_DIR@/src/util/argh.h
|
EXCLUDE = @SRC_CODE_DIR@/./util/argh.h
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
# Project related configuration options
|
# Project related configuration options
|
||||||
|
|||||||
@ -1,8 +1,13 @@
|
|||||||
set(SRC_CODE_DIR ${CMAKE_CURRENT_SOURCE_DIR} CACHE INTERNAL "directory indicating which source code version is used")
|
set(SRC_CODE_DIR
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
|
CACHE INTERNAL "directory indicating which source code version is used")
|
||||||
|
|
||||||
|
get_poet_version()
|
||||||
|
|
||||||
configure_file(poet.h.in poet.h)
|
configure_file(poet.h.in poet.h)
|
||||||
|
|
||||||
add_executable(poet poet.cpp)
|
add_executable(poet poet.cpp)
|
||||||
target_include_directories(poet PUBLIC "${PROJECT_CURRENT_BINARY_DIR}")
|
target_include_directories(poet PUBLIC "${CMAKE_CURRENT_BINARY_DIR}")
|
||||||
target_link_libraries(poet PUBLIC 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)
|
target_compile_definitions(poet PRIVATE OMPI_SKIP_MPICXX)
|
||||||
|
|
||||||
|
|||||||
@ -58,9 +58,7 @@ int main(int argc, char *argv[]) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (world_rank == 0) {
|
if (world_rank == 0) {
|
||||||
cout << "Running POET in version " << poet_version_major << "."
|
cout << "Running POET in version " << poet_version << endl << endl;
|
||||||
<< poet_version_minor << endl
|
|
||||||
<< endl;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* initialize R runtime */
|
/* initialize R runtime */
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
#ifndef POET_H
|
#ifndef POET_H
|
||||||
#define POET_H
|
#define POET_H
|
||||||
|
|
||||||
const int poet_version_major = @POET_VERSION_MAJOR@;
|
const char *poet_version = "@POET_VERSION@";
|
||||||
const int poet_version_minor = @POET_VERSION_MINOR@;
|
|
||||||
|
|
||||||
#endif // POET_H
|
#endif // POET_H
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user