Fix: merge issues

This commit is contained in:
hans 2024-06-05 16:43:33 +02:00
parent 31da6843b4
commit a65f4992ae
3 changed files with 13 additions and 15 deletions

View File

@ -5,8 +5,8 @@
## in the variable "ai_surrogate_input_script". See the barite_200.R file as an
## example and the general README for more information.
## library(keras3)
## library(tensorflow)
require(keras3)
require(tensorflow)
initiate_model <- function() {
hidden_layers <- c(48, 96, 24)

View File

@ -40,7 +40,7 @@ void InitialList::initChemistry(const Rcpp::List &chem) {
std::ifstream file(ai_surrogate_input_script_path);
if (!file.is_open()) {
// 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;
@ -48,6 +48,8 @@ void InitialList::initChemistry(const Rcpp::List &chem) {
std::string fileContent = buffer.str();
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
fileContent += "\nai_surrogate_base_path <- \"" + ai_surrogate_input_script_path + "\"";

View File

@ -463,7 +463,6 @@ int main(int argc, char *argv[]) {
*global_rt_setup =
master_init_R.value()(*global_rt_setup, run_params.out_dir,
init_list.getInitialGrid().asSEXP());
// MDL: store all parameters
// MSG("Calling R Function to store calling parameters");
// R.parseEvalQ("StoreSetup(setup=mysetup)");
@ -476,16 +475,13 @@ int main(int argc, char *argv[]) {
const std::string ai_surrogate_input_script = init_list.getChemistryInit().ai_surrogate_input_script;
if (!ai_surrogate_input_script_path.empty()) {
R["ai_surrogate_base_path"] = ai_surrogate_input_script_path.substr(0, ai_surrogate_input_script_path.find_last_of('/') + 1);
MSG("AI: sourcing user-provided script");
R.parseEvalQ(ai_surrogate_input_script);
MSG("AI: sourcing user-provided script");
R.parseEvalQ("source('" + ai_surrogate_input_script_path + "')");
}
MSG("AI: initialize AI model");
R.parseEval("model <- initiate_model()");
MSG("AI: initialize AI model");
R.parseEval("model <- initiate_model()");
R.parseEval("gpu_info()");
}
}
MSG("Init done on process with rank " + std::to_string(MY_RANK));