Fixing rebase conflicts

This commit is contained in:
Marco De Lucia 2024-09-12 12:36:11 +02:00
parent 71b519f7ef
commit 04958194c4
3 changed files with 83 additions and 57 deletions

114
README.md
View File

@ -1,12 +1,16 @@
<!-- <!--
<<<<<<< HEAD
Time-stamp: "Last modified 2024-09-12 11:39:28 delucia" Time-stamp: "Last modified 2024-09-12 11:39:28 delucia"
=======
Time-stamp: "Last modified 2024-06-13 09:43:22 delucia"
>>>>>>> 9272556 (Fixes in README and poet.cpp)
--> -->
# POET # POET
[POET](https://doi.org/10.5281/zenodo.4757913) is a coupled reactive transport [POET](https://doi.org/10.5281/zenodo.4757913) is a coupled reactive
simulator implementing a parallel architecture and a fast, original MPI-based transport simulator implementing a parallel architecture and a fast,
Distributed Hash Table. original MPI-based Distributed Hash Table.
![POET's Coupling Scheme](./docs/Scheme_POET_en.svg) ![POET's Coupling Scheme](./docs/Scheme_POET_en.svg)
@ -17,7 +21,7 @@ pages](https://naaice.git-pages.gfz-potsdam.de/poet).
## External Libraries ## External Libraries
The following external header library is shipped with POET: The following external libraries are shipped with POET:
- **argh** - https://github.com/adishavit/argh (BSD license) - **argh** - https://github.com/adishavit/argh (BSD license)
- **IPhreeqc** with patches from GFZ - - **IPhreeqc** with patches from GFZ -
@ -36,17 +40,32 @@ To compile POET you need following software to be installed:
- CMake 3.9+ - CMake 3.9+
- Eigen3 3.4+ (required by `tug`) - Eigen3 3.4+ (required by `tug`)
- *optional*: `doxygen` with `dot` bindings for documentation - *optional*: `doxygen` with `dot` bindings for documentation
- R language and environment (distro dependent) - R language and environment including headers or `-dev` packages
(distro dependent)
The following R packages (and their dependencies) must also be installed: The following R packages (and their dependencies) must also be
installed:
- [Rcpp](https://cran.r-project.org/web/packages/Rcpp/index.html) - [Rcpp](https://cran.r-project.org/web/packages/Rcpp/index.html)
- [RInside](https://cran.r-project.org/web/packages/RInside/index.html) - [RInside](https://cran.r-project.org/web/packages/RInside/index.html)
- [qs](https://cran.r-project.org/web/packages/qs/index.html) - [qs](https://cran.r-project.org/web/packages/qs/index.html)
This can be simply achieved by issuing the following commands:
```sh
# start R environment
$ R
# install R dependencies (case sensitive!)
> install.packages(c("Rcpp", "RInside","qs"))
> q(save="no")
```
### Compiling source code ### Compiling source code
POET is built with CMake. You can generate Makefiles by running the usual: POET is built with CMake. You can generate Makefiles by running the
usual:
```sh ```sh
mkdir build && cd build mkdir build && cd build
@ -58,22 +77,22 @@ and generate Makefiles from it. You're now able to run `make` to start
build process. build process.
If everything went well you'll find the executables at If everything went well you'll find the executables at
`build/app/poet`, but it is recommended to install the POET project `build/src/poet`, but it is recommended to install the POET project
structure to a desired `CMAKE_INSTALL_PREFIX` with `make install`. structure to a desired `CMAKE_INSTALL_PREFIX` with `make install`.
During the generation of Makefiles, various options can be specified During the generation of Makefiles, various options can be specified
via `cmake -D <option>=<value> [...]`. Currently, there are the via `cmake -D <option>=<value> [...]`. Currently, there are the
following available options: following available options:
- **POET_DHT_Debug**=_boolean_ - toggles the output of detailed statistics about - **POET_DHT_Debug**=_boolean_ - toggles the output of detailed
DHT usage. Defaults to _OFF_. statistics about DHT usage. Defaults to _OFF_.
- **POET_ENABLE_TESTING**=_boolean_ - enables small set of unit tests (more to - **POET_ENABLE_TESTING**=_boolean_ - enables small set of unit tests
come). Defaults to _OFF_. (more to come). Defaults to _OFF_.
- **POET_PHT_ADDITIONAL_INFO**=_boolean_ - enabling the count of accesses to one - **POET_PHT_ADDITIONAL_INFO**=_boolean_ - enabling the count of
PHT bucket. Use with caution, as things will get slowed down significantly. accesses to one PHT bucket. Use with caution, as things will get
Defaults to _OFF_. slowed down significantly. Defaults to _OFF_.
- **POET_PREPROCESS_BENCHS**=*boolean* - enables the preprocessing of predefined - **POET_PREPROCESS_BENCHS**=*boolean* - enables the preprocessing of
models/benchmarks. Defaults to *ON*. predefined models/benchmarks. Defaults to *ON*.
### Example: Build from scratch ### Example: Build from scratch
@ -130,7 +149,8 @@ poet
With the installation of POET, two executables are provided: With the installation of POET, two executables are provided:
- `poet` - the main executable to run simulations - `poet` - the main executable to run simulations
- `poet_init` - a preprocessor to generate input files for POET from R scripts - `poet_init` - a preprocessor to generate input files for POET from
R scripts
Preprocessed benchmarks can be found in the `share/poet` directory Preprocessed benchmarks can be found in the `share/poet` directory
with an according *runtime* setup. More on those files and how to with an according *runtime* setup. More on those files and how to
@ -142,28 +162,29 @@ Run POET by `mpirun ./poet [OPTIONS] <RUNFILE> <SIMFILE>
<OUTPUT_DIRECTORY>` where: <OUTPUT_DIRECTORY>` where:
- **OPTIONS** - POET options (explained below) - **OPTIONS** - POET options (explained below)
- **RUNFILE** - Runtime parameters described as R script - **RUNFILE** - Runtime parameters described as R script
- **SIMFILE** - Simulation input prepared by `poet_init` - **SIMFILE** - Simulation input prepared by `poet_init`
- **OUTPUT_DIRECTORY** - path, where all output of POET should be stored - **OUTPUT_DIRECTORY** - path, where all output of POET should be
stored
### POET options ### POET command line arguments
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_) |
| **-P, --progress** | | show progress bar | | **-P, --progress** | | show progress bar |
| **--ai-surrogate** | | activates the AI surrogate chemistry model (defaults to _OFF_) | | **--ai-surrogate** | | activates the AI surrogate chemistry model (defaults to _OFF_) |
| **--dht** | | enabling DHT usage (defaults to _OFF_) | | **--dht** | | enabling DHT usage (defaults to _OFF_) |
| **--qs** | | store results using qs::qsave() (.qs extension) instead of default RDS (.rds) | | **--qs** | | store results using qs::qsave() (.qs extension) instead of default RDS (.rds) |
| **--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 megabyte (defaults to _1000 MByte_) | | **--dht-size=** | _1-n_ | size of DHT per process involved in megabyte (defaults to _1000 MByte_) |
| **--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 |
| **--interp-size** | _1-n_ | size of PHT (interpolation) per process in megabyte | | **--interp-size** | _1-n_ | size of PHT (interpolation) per process in megabyte |
| **--interp-bucket-entries** | _1-n_ | number of entries to store at maximum in one PHT bucket | | **--interp-bucket-entries** | _1-n_ | number of entries to store at maximum in one PHT bucket |
| **--interp-min** | _1-n_ | number of entries in PHT bucket needed to start interpolation | | **--interp-min** | _1-n_ | number of entries in PHT bucket needed to start interpolation |
#### Additions to `dht-snaps` #### Additions to `dht-snaps`
@ -177,12 +198,13 @@ Following values can be set:
### Example: Running from scratch ### Example: Running from scratch
We will continue the above example and start a simulation with *barite_het*, We will continue the above example and start a simulation with
which simulation files can be found in *barite_het*, which simulation files can be found in
`<INSTALL_DIR>/share/poet/barite/barite_het*`. As transport a heterogeneous `<INSTALL_DIR>/share/poet/barite/barite_het*`. As transport a
diffusion is used. It's a small 2D grid, 2x5 grid, simulating 50 time steps with heterogeneous diffusion is used. It's a small 2D grid, 2x5 grid,
a time step size of 100 seconds. To start the simulation with 4 processes `cd` simulating 50 time steps with a time step size of 100 seconds. To
into your previously installed POET-dir `<POET_INSTALL_DIR>/bin` and run: start the simulation with 4 processes `cd` into your previously
installed POET-dir `<POET_INSTALL_DIR>/bin` and run:
```sh ```sh
cp ../share/poet/barite/barite_het* . cp ../share/poet/barite/barite_het* .
@ -192,11 +214,11 @@ mpirun -n 4 ./poet barite_het_rt.R barite_het.rds output
After a finished simulation all data generated by POET will be found After a finished simulation all data generated by POET will be found
in the directory `output`. in the directory `output`.
You might want to use the DHT to cache previously simulated data and reuse them You might want to use the DHT to cache previously simulated data and
in further time-steps. Just append `--dht` to the options of POET to activate reuse them in further time-steps. Just append `--dht` to the options
the usage of the DHT. Also, after each iteration a DHT snapshot shall be of POET to activate the usage of the DHT. Also, after each iteration a
produced. This is done by appending the `--dht-snaps=<value>` option. The DHT snapshot shall be produced. This is done by appending the
resulting call would look like this: `--dht-snaps=<value>` option. The resulting call would look like this:
```sh ```sh
mpirun -n 4 ./poet --dht --dht-snaps=2 barite_het_rt.R barite_het.rds output mpirun -n 4 ./poet --dht --dht-snaps=2 barite_het_rt.R barite_het.rds output

@ -1 +1 @@
Subproject commit 48e65d87ad70f84aec01c27d9560cd3094a8129c Subproject commit e6e5e0d5156c093241a53e6ce074ef346d64ae26

View File

@ -1,3 +1,5 @@
// Time-stamp: "Last modified 2024-06-13 09:46:48 delucia"
/* /*
** Copyright (C) 2018-2021 Alexander Lindemann, Max Luebke (University of ** Copyright (C) 2018-2021 Alexander Lindemann, Max Luebke (University of
** Potsdam) ** Potsdam)
@ -220,23 +222,19 @@ ParseRet parseInitValues(char **argv, RuntimeParameters &params) {
// R["dht_log"] = simparams.dht_log; // R["dht_log"] = simparams.dht_log;
try { try {
// Rcpp::Function source("source");
// Rcpp::Function ReadRObj("ReadRObj");
// Rcpp::Function SaveRObj("SaveRObj");
Rcpp::List init_params_(ReadRObj_R(init_file)); Rcpp::List init_params_(ReadRObj_R(init_file));
params.init_params = init_params_; params.init_params = init_params_;
global_rt_setup = std::make_unique<Rcpp::List>( global_rt_setup = std::make_unique<Rcpp::List>(source_R(runtime_file, Rcpp::Named("local", true)));
source_R(runtime_file, Rcpp::Named("local", true)));
*global_rt_setup = (*global_rt_setup)["value"]; *global_rt_setup = (*global_rt_setup)["value"];
// MDL add "out_ext" for output format to R setup // MDL add "out_ext" for output format to R setup
(*global_rt_setup)["out_ext"] = params.out_ext; (*global_rt_setup)["out_ext"] = params.out_ext;
params.timesteps = params.timesteps =
Rcpp::as<std::vector<double>>(global_rt_setup->operator[]("timesteps")); Rcpp::as<std::vector<double>>(global_rt_setup->operator[]("timesteps"));
} catch (const std::exception &e) { } catch (const std::exception &e) {
ERRMSG("Error while parsing R scripts: " + std::string(e.what())); ERRMSG("Error while parsing R scripts: " + std::string(e.what()));
return ParseRet::PARSER_ERROR; return ParseRet::PARSER_ERROR;
@ -253,7 +251,7 @@ void call_master_iter_end(RInside &R, const Field &trans, const Field &chem) {
R.parseEval(std::string("state_T <- setNames(data.frame(matrix(TMP, nrow=" + R.parseEval(std::string("state_T <- setNames(data.frame(matrix(TMP, nrow=" +
std::to_string(trans.GetRequestedVecSize()) + std::to_string(trans.GetRequestedVecSize()) +
")), TMP_PROPS)")); ")), TMP_PROPS)"));
R["TMP"] = Rcpp::wrap(chem.AsVector()); R["TMP"] = Rcpp::wrap(chem.AsVector());
R["TMP_PROPS"] = Rcpp::wrap(chem.GetProps()); R["TMP_PROPS"] = Rcpp::wrap(chem.GetProps());
R.parseEval(std::string("state_C <- setNames(data.frame(matrix(TMP, nrow=" + R.parseEval(std::string("state_C <- setNames(data.frame(matrix(TMP, nrow=" +
@ -267,11 +265,11 @@ void call_master_iter_end(RInside &R, const Field &trans, const Field &chem) {
static Rcpp::List RunMasterLoop(RInsidePOET &R, const RuntimeParameters &params, static Rcpp::List RunMasterLoop(RInsidePOET &R, const RuntimeParameters &params,
DiffusionModule &diffusion, DiffusionModule &diffusion,
ChemistryModule &chem) { ChemistryModule &chem) {
/* Iteration Count is dynamic, retrieving value from R (is only needed by /* Iteration Count is dynamic, retrieving value from R (is only needed by
* master for the following loop) */ * master for the following loop) */
uint32_t maxiter = params.timesteps.size(); uint32_t maxiter = params.timesteps.size();
if (params.print_progressbar) { if (params.print_progressbar) {
chem.setProgressBarPrintout(true); chem.setProgressBarPrintout(true);
} }
@ -422,6 +420,7 @@ static Rcpp::List RunMasterLoop(RInsidePOET &R, const RuntimeParameters &params,
return profiling; return profiling;
} }
<<<<<<< HEAD
std::vector<std::string> getSpeciesNames(const Field &&field, int root, std::vector<std::string> getSpeciesNames(const Field &&field, int root,
MPI_Comm comm) { MPI_Comm comm) {
std::uint32_t n_elements; std::uint32_t n_elements;
@ -465,6 +464,11 @@ std::vector<std::string> getSpeciesNames(const Field &&field, int root,
return species_names_out; return species_names_out;
} }
=======
// MAIN
>>>>>>> 9272556 (Fixes in README and poet.cpp)
int main(int argc, char *argv[]) { int main(int argc, char *argv[]) {
int world_size; int world_size;