diff --git a/src/libs/common/system_variables.cpp b/src/libs/common/system_variables.cpp index 1a8efc54..00eac76b 100644 --- a/src/libs/common/system_variables.cpp +++ b/src/libs/common/system_variables.cpp @@ -24,6 +24,7 @@ #include #include #include +#include #include "system_variables.h" #ifdef OS_WIN @@ -32,6 +33,7 @@ #ifdef OS_LINUX #include "stdio.h" +#include #include #endif @@ -169,11 +171,15 @@ int start(string &cmd_string) if (pid == 0) { setpgid(0, 0); +// int fd = open("stdout.dat", O_CREAT); +// dup2(fd, 1); +// std::cout << "file descrp " << fd << std::endl; int success = execvp(arg_v[0], const_cast(&(arg_v[0]))); if (success == -1) { throw std::runtime_error("execv() failed for command: " + cmd_string); } + } else { diff --git a/src/libs/pestpp_common/EnsembleMethodUtils.cpp b/src/libs/pestpp_common/EnsembleMethodUtils.cpp index 28f70737..848c9745 100644 --- a/src/libs/pestpp_common/EnsembleMethodUtils.cpp +++ b/src/libs/pestpp_common/EnsembleMethodUtils.cpp @@ -4683,7 +4683,7 @@ pair save_real_par_rei(Pest& pest_scenario, ParameterE vector run_ensemble_util(PerformanceLog* performance_log, ofstream& frec,ParameterEnsemble& _pe, ObservationEnsemble& _oe, - RunManagerAbstract* run_mgr_ptr, bool check_pe_consistency, const vector& real_idxs, int da_cycle) + RunManagerAbstract* run_mgr_ptr, bool check_pe_consistency, const vector& real_idxs, int da_cycle, string additional_tag) { stringstream ss; ss << "queuing " << _pe.shape().first << " runs"; @@ -4692,7 +4692,7 @@ vector run_ensemble_util(PerformanceLog* performance_log, ofstream& frec,Pa map real_run_ids; try { - real_run_ids = _pe.add_runs(run_mgr_ptr, real_idxs,da_cycle); + real_run_ids = _pe.add_runs(run_mgr_ptr, real_idxs,da_cycle,additional_tag); } catch (const exception& e) { @@ -5139,7 +5139,7 @@ vector EnsembleMethod::run_lambda_ensembles(vector EnsembleMethod::run_ensemble(ParameterEnsemble& _pe, ObservationEnsemble& _oe, const vector& real_idxs, int cycle) { stringstream ss; + ss.str(""); + ss << " iteration:" << iter; vector failed_real_indices; try { failed_real_indices = run_ensemble_util(performance_log, file_manager.rec_ofstream(), _pe, _oe, run_mgr_ptr, pest_scenario.get_pestpp_options().get_debug_check_par_en_consistency(), - real_idxs, cycle); + real_idxs, cycle,ss.str()); } catch (const exception& e) { @@ -7709,14 +7711,16 @@ bool EnsembleMethod::solve(bool use_mda, vector inflation_factors, vecto oe_lam_best = oe; //copy message(0,"running mean-shifted prior realizations: ",new_pe.shape().first); - run_ensemble_util(performance_log,frec,new_pe,oe_lam_best,run_mgr_ptr); + ss.str(""); + ss << "iteration:" << iter; + vector temp; + run_ensemble_util(performance_log,frec,new_pe,oe_lam_best,run_mgr_ptr,false,temp,NetPackage::NULL_DA_CYCLE, ss.str()); pe_lams[best_idx] = new_pe; //make sure we dont try to process the subset stuff below local_subset_size = pe.shape().first; } - else if ((best_idx != -1) && (use_subset) && (local_subset_size < pe.shape().first)) { diff --git a/src/libs/pestpp_common/EnsembleMethodUtils.h b/src/libs/pestpp_common/EnsembleMethodUtils.h index 416dbb6b..60801900 100644 --- a/src/libs/pestpp_common/EnsembleMethodUtils.h +++ b/src/libs/pestpp_common/EnsembleMethodUtils.h @@ -192,7 +192,8 @@ pair save_real_par_rei(Pest& pest_scenario, ParameterEn vector run_ensemble_util(PerformanceLog* performance_log, ofstream& frec, ParameterEnsemble& _pe, ObservationEnsemble& _oe, RunManagerAbstract* run_mgr_ptr, - bool check_pe_consistency = false, const vector& real_idxs = vector(),int da_cycle=NetPackage::NULL_DA_CYCLE); + bool check_pe_consistency = false, const vector& real_idxs = vector(),int da_cycle=NetPackage::NULL_DA_CYCLE, + string additional_tag=""); class EnsembleSolver { diff --git a/src/libs/run_managers/abstract_base/model_interface.cpp b/src/libs/run_managers/abstract_base/model_interface.cpp index e20c6212..e5bddb6b 100644 --- a/src/libs/run_managers/abstract_base/model_interface.cpp +++ b/src/libs/run_managers/abstract_base/model_interface.cpp @@ -693,6 +693,8 @@ void ModelInterface::run(pest_utils::thread_flag* terminate, pest_utils::thread_ { throw PestError("could not add process to job object: " + cmd_string); } + DWORD pid = GetProcessId(pi); + cout << "...pid: " << pid << endl; DWORD exitcode; while (true) { @@ -746,6 +748,7 @@ void ModelInterface::run(pest_utils::thread_flag* terminate, pest_utils::thread_ cout << pest_utils::get_time_string() << " calling forward run command: '" << cmd_string << "' " << endl; //start the command int command_pid = start(cmd_string); + cout << "...pid: " << command_pid << endl; while (true) { std::this_thread::sleep_for(std::chrono::milliseconds(sleep_ms));