mirror of
https://git.gfz-potsdam.de/naaice/poet.git
synced 2025-12-16 12:54:50 +01:00
Fix: merge issues
This commit is contained in:
parent
92339342dc
commit
1f91e4c196
@ -5,8 +5,8 @@
|
|||||||
## in the variable "ai_surrogate_input_script". See the barite_200.R file as an
|
## in the variable "ai_surrogate_input_script". See the barite_200.R file as an
|
||||||
## example and the general README for more information.
|
## example and the general README for more information.
|
||||||
|
|
||||||
## library(keras3)
|
require(keras3)
|
||||||
## library(tensorflow)
|
require(tensorflow)
|
||||||
|
|
||||||
initiate_model <- function() {
|
initiate_model <- function() {
|
||||||
hidden_layers <- c(48, 96, 24)
|
hidden_layers <- c(48, 96, 24)
|
||||||
|
|||||||
@ -40,14 +40,16 @@ void InitialList::initChemistry(const Rcpp::List &chem) {
|
|||||||
std::ifstream file(ai_surrogate_input_script_path);
|
std::ifstream file(ai_surrogate_input_script_path);
|
||||||
if (!file.is_open()) {
|
if (!file.is_open()) {
|
||||||
// print error message and return
|
// print error message and return
|
||||||
Rcpp::Rcerr << "AI surroghate input script was not found at: " << ai_surrogate_input_script_path << std::endl;
|
Rcpp::Rcerr << "AI surrogate input script was not found at: " << ai_surrogate_input_script_path << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::stringstream buffer;
|
std::stringstream buffer;
|
||||||
buffer << file.rdbuf();
|
buffer << file.rdbuf();
|
||||||
std::string fileContent = buffer.str();
|
std::string fileContent = buffer.str();
|
||||||
file.close();
|
file.close();
|
||||||
|
|
||||||
|
// Get base path
|
||||||
|
ai_surrogate_input_script_path = ai_surrogate_input_script_path.substr(0, ai_surrogate_input_script_path.find_last_of('/') + 1);
|
||||||
// Add the filepath as a global variable in R to enable relative filepaths in the R script
|
// Add the filepath as a global variable in R to enable relative filepaths in the R script
|
||||||
fileContent += "\nai_surrogate_base_path <- \"" + ai_surrogate_input_script_path + "\"";
|
fileContent += "\nai_surrogate_base_path <- \"" + ai_surrogate_input_script_path + "\"";
|
||||||
|
|
||||||
|
|||||||
18
src/poet.cpp
18
src/poet.cpp
@ -463,7 +463,6 @@ int main(int argc, char *argv[]) {
|
|||||||
*global_rt_setup =
|
*global_rt_setup =
|
||||||
master_init_R.value()(*global_rt_setup, run_params.out_dir,
|
master_init_R.value()(*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)");
|
||||||
@ -476,17 +475,14 @@ int main(int argc, char *argv[]) {
|
|||||||
|
|
||||||
const std::string ai_surrogate_input_script = init_list.getChemistryInit().ai_surrogate_input_script;
|
const std::string ai_surrogate_input_script = init_list.getChemistryInit().ai_surrogate_input_script;
|
||||||
|
|
||||||
if (!ai_surrogate_input_script_path.empty()) {
|
MSG("AI: sourcing user-provided script");
|
||||||
R["ai_surrogate_base_path"] = ai_surrogate_input_script_path.substr(0, ai_surrogate_input_script_path.find_last_of('/') + 1);
|
R.parseEvalQ(ai_surrogate_input_script);
|
||||||
|
|
||||||
MSG("AI: sourcing user-provided script");
|
MSG("AI: initialize AI model");
|
||||||
R.parseEvalQ("source('" + ai_surrogate_input_script_path + "')");
|
R.parseEval("model <- initiate_model()");
|
||||||
}
|
|
||||||
MSG("AI: initialize AI model");
|
|
||||||
R.parseEval("model <- initiate_model()");
|
|
||||||
R.parseEval("gpu_info()");
|
R.parseEval("gpu_info()");
|
||||||
}
|
}
|
||||||
|
|
||||||
MSG("Init done on process with rank " + std::to_string(MY_RANK));
|
MSG("Init done on process with rank " + std::to_string(MY_RANK));
|
||||||
|
|
||||||
// MPI_Barrier(MPI_COMM_WORLD);
|
// MPI_Barrier(MPI_COMM_WORLD);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user