Prepare project to transfer to svn + set poet version with help of

git/textfiles
This commit is contained in:
Max Lübke 2021-02-19 17:12:03 +01:00
parent a5f95c328d
commit 8b9450d3c0
7 changed files with 93 additions and 52 deletions

28
CMake/POET_Scripts.cmake Normal file
View 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)

View File

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

View File

@ -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,24 +37,36 @@ 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
@ -131,15 +142,15 @@ 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,17 +159,17 @@ 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
@ -168,7 +179,6 @@ with 4 processes `cd` into your previously installed POET-dir
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`.
@ -190,6 +200,7 @@ 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:

View File

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

View File

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

View File

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

View File

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