feat: fast serialization/storage using qs package via --qs flag

rebasing/merging
This commit is contained in:
Marco De Lucia 2024-06-11 16:50:02 +02:00
parent 9090d38f17
commit 1b9906ddbf
2 changed files with 34 additions and 21 deletions

View File

@ -163,20 +163,20 @@ Run POET by `mpirun ./poet [OPTIONS] <RUNFILE> <SIMFILE>
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`
@ -291,6 +291,15 @@ where:
the output file will be stored in the directory from which the output file will be stored in the directory from which
`poet_init` was called. `poet_init` was called.
## About the usage of MPI_Wtime()
Implemented time measurement functions uses `MPI_Wtime()`. Some
important information 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).
## Additional functions for the AI surrogate ## Additional functions for the AI surrogate
The AI surrogate can be activated for any benchmark and is by default The AI surrogate can be activated for any benchmark and is by default

View File

@ -156,9 +156,10 @@ ParseRet parseInitValues(char **argv, RuntimeParameters &params) {
params.use_ai_surrogate = cmdl["ai-surrogate"]; params.use_ai_surrogate = cmdl["ai-surrogate"];
// MDL: optional flag "--qs" to switch to qsave() // MDL: optional flag "qs" to switch to qsave()
params.out_ext = "rds"; params.out_ext = "rds";
if (cmdl["qs"]) { if (cmdl["qs"]) {
MSG("Enabled <qs> output");
params.out_ext = "qs"; params.out_ext = "qs";
} }
@ -220,6 +221,9 @@ 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_;
@ -232,7 +236,7 @@ ParseRet parseInitValues(char **argv, RuntimeParameters &params) {
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;
@ -418,7 +422,6 @@ 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;
@ -462,11 +465,8 @@ 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;
@ -509,6 +509,7 @@ int main(int argc, char *argv[]) {
init_list.getChemistryInit(), MPI_COMM_WORLD); init_list.getChemistryInit(), MPI_COMM_WORLD);
const ChemistryModule::SurrogateSetup surr_setup = { const ChemistryModule::SurrogateSetup surr_setup = {
getSpeciesNames(init_list.getInitialGrid(), 0, MPI_COMM_WORLD), getSpeciesNames(init_list.getInitialGrid(), 0, MPI_COMM_WORLD),
run_params.use_dht, run_params.use_dht,
run_params.dht_size, run_params.dht_size,
@ -516,7 +517,8 @@ int main(int argc, char *argv[]) {
run_params.interp_bucket_entries, run_params.interp_bucket_entries,
run_params.interp_size, run_params.interp_size,
run_params.interp_min_entries, run_params.interp_min_entries,
run_params.use_ai_surrogate}; run_params.use_ai_surrogate
};
chemistry.masterEnableSurrogates(surr_setup); chemistry.masterEnableSurrogates(surr_setup);
@ -526,8 +528,10 @@ int main(int argc, char *argv[]) {
// R.parseEvalQ("mysetup <- setup"); // R.parseEvalQ("mysetup <- setup");
// // if (MY_RANK == 0) { // get timestep vector from // // if (MY_RANK == 0) { // get timestep vector from
// // grid_init function ... // // // grid_init function ... //
*global_rt_setup = master_init_R(*global_rt_setup, run_params.out_dir, *global_rt_setup = master_init_R(*global_rt_setup, run_params.out_dir,
init_list.getInitialGrid().asSEXP()); init_list.getInitialGrid().asSEXP());
// MDL: store all parameters // MDL: store all parameters
// MSG("Calling R Function to store calling parameters"); // MSG("Calling R Function to store calling parameters");
// R.parseEvalQ("StoreSetup(setup=mysetup)"); // R.parseEvalQ("StoreSetup(setup=mysetup)");