$extrastylesheet
|
Dakota
Version 6.2
|
Derived application interface class that spawns a simulation code using a separate process and communicates with it through files. More...
Public Member Functions | |
| ProcessApplicInterface (const ProblemDescDB &problem_db) | |
| constructor | |
| ~ProcessApplicInterface () | |
| destructor | |
Protected Member Functions | |
| void | derived_map (const Variables &vars, const ActiveSet &set, Response &response, int fn_eval_id) |
| Called by map() and other functions to execute the simulation in synchronous mode. The portion of performing an evaluation that is specific to a derived class. | |
| void | derived_map_asynch (const ParamResponsePair &pair) |
| Called by map() and other functions to execute the simulation in asynchronous mode. The portion of performing an asynchronous evaluation that is specific to a derived class. | |
| const StringArray & | analysis_drivers () const |
| retrieve the analysis drivers specification for application interfaces | |
| void | file_cleanup () const |
| void | remove_params_results_files (const bfs::path ¶ms_path, const bfs::path &results_path) const |
| Remove (potentially autotagged for multiple programs) parameters and results files with passed root names. | |
| void | autotag_files (const bfs::path ¶ms_path, const bfs::path &results_path, const String &eval_id_tag) const |
| Utility to automatically tag parameters and results files with passed root names (the files may already need per-program tagging) | |
| virtual void | map_bookkeeping (pid_t pid, int fn_eval_id)=0 |
| bookkeeping of process and evaluation ids for asynchronous maps | |
| virtual pid_t | create_evaluation_process (bool block_flag)=0 |
| Spawn the evaluation by managing the input filter, analysis drivers, and output filter. Called from derived_map() & derived_map_asynch(). | |
| void | synchronous_local_analyses (int start, int end, int step) |
| execute analyses synchronously on the local processor | |
| void | define_filenames (const String &eval_id_tag) |
| define modified filenames from user input by handling Unix temp file and optionally tagging with given eval_id_tag | |
| void | write_parameters_files (const Variables &vars, const ActiveSet &set, const Response &response, const int id) |
| write the parameters data and response request data to one or more parameters files (using one or more invocations of write_parameters_file()) in either standard or aprepro format | |
| void | read_results_files (Response &response, const int id, const String &eval_id_tag) |
| read the response object from one or more results files using full eval_id_tag passed | |
| bfs::path | get_workdir_name () |
| construct a work directory name (tmp or named), with optional tag | |
| void | prepare_process_environment () |
| set PATH, environment variables, and change directory prior to fork/system/spawn | |
| void | reset_process_environment () |
| reset PATH and current directory after system/spawn (workdir case) | |
Protected Attributes | |
| bool | fileTagFlag |
| flags tagging of parameter/results files | |
| bool | fileSaveFlag |
| flags retention of parameter/results files | |
| bool | commandLineArgs |
| flag indicating use of passing of filenames as command line arguments to the analysis drivers and input/output filters | |
| bool | apreproFlag |
| flag indicating use of the APREPRO (the Sandia "A PRE PROcessor" utility) format for parameter files | |
| bool | multipleParamsFiles |
| flag indicating the need for separate parameters files for multiple analysis drivers | |
| std::string | iFilterName |
| the name of the input filter (input_filter user specification) | |
| std::string | oFilterName |
| the name of the output filter (output_filter user specification) | |
| std::vector< String > | programNames |
| the names of the analysis code programs (analysis_drivers user specification) | |
| std::string | specifiedParamsFileName |
| the name of the parameters file from user specification | |
| std::string | paramsFileName |
| the parameters file name actually used (modified with tagging or temp files); only valid from define_filenames to write_parameters_files | |
| std::string | paramsFileWritten |
| actual, qualified name of the params file written, possibly with workdir | |
| std::string | specifiedResultsFileName |
| the name of the results file from user specification | |
| std::string | resultsFileName |
| the results file name actually used (modified with tagging or temp files); only valid from define_filenames to write_parameters_files | |
| std::string | resultsFileWritten |
| actual, qualified name of the results file written, possibly with workdir | |
| std::string | fullEvalId |
| complete evalIdTag, possibly including hierarchical tagging and final eval id, but not program numbers, for passing to write_parameters_files | |
| bool | allowExistingResults |
| by default analysis code interfaces delete results files if they exist; user may override with this flag and we'll try to gather and only fork if needed | |
| std::map< int, PathTriple > | fileNameMap |
| Maps function evaluation ID to triples (parameters, results, and workdir) paths used in spawning function evaluations. Workdir will be empty if not created specifically for this eval. | |
| bool | useWorkdir |
| whether to use a work_directory | |
| std::string | workDirName |
| work_directory name, if specified... | |
| bool | dirTag |
| whether to tag the working directory | |
| bool | dirSave |
| whether dir_save was specified | |
| bfs::path | curWorkdir |
| active working directory for this evaluation; valid only from define_filenames to create_evaluation_process | |
| bfs::path | createdDir |
| non-empty if created for this eval; valid only from define_filenames to write_parameters_files | |
| StringArray | linkFiles |
| template directory (if specified) | |
| StringArray | copyFiles |
| template files (if specified) | |
| bool | templateReplace |
| whether to replace existing files | |
Private Member Functions | |
| void | write_parameters_file (const Variables &vars, const ActiveSet &set, const Response &response, const std::string &prog, const std::vector< String > &an_comps, const std::string ¶ms_fname) |
| write the variables, active set vector, derivative variables vector, and analysis components to the specified parameters file in either standard or aprepro format | |
Private Attributes | |
| String2DArray | analysisComponents |
| the set of optional analysis components used by the analysis drivers (from the analysis_components interface specification) | |
Derived application interface class that spawns a simulation code using a separate process and communicates with it through files.
ProcessApplicInterface is subclassed for process handles or file completion testing.
| void file_cleanup | ( | ) | const [protected, virtual] |
Remove any files and directories still referenced in the fileNameMap
Reimplemented from Interface.
References WorkdirHelper::concat_path(), ProcessApplicInterface::dirSave, ProcessApplicInterface::fileNameMap, ProcessApplicInterface::fileSaveFlag, ProcessApplicInterface::iFilterName, ProcessApplicInterface::multipleParamsFiles, ProcessApplicInterface::programNames, and WorkdirHelper::recursive_remove().
| void autotag_files | ( | const bfs::path & | params_path, |
| const bfs::path & | results_path, | ||
| const String & | eval_id_tag | ||
| ) | const [protected] |
Utility to automatically tag parameters and results files with passed root names (the files may already need per-program tagging)
Move specified params and results files to unique tagged versions when needed
References WorkdirHelper::concat_path(), ProcessApplicInterface::iFilterName, ProcessApplicInterface::multipleParamsFiles, ProcessApplicInterface::oFilterName, Interface::outputLevel, ProcessApplicInterface::programNames, WorkdirHelper::rename(), ProcessApplicInterface::specifiedParamsFileName, ProcessApplicInterface::specifiedResultsFileName, and ApplicationInterface::suppressOutput.
Referenced by ProcessApplicInterface::read_results_files().
| void synchronous_local_analyses | ( | int | start, |
| int | end, | ||
| int | step | ||
| ) | [inline, protected] |
execute analyses synchronously on the local processor
Execute analyses synchronously in succession on the local processor (start to end in step increments). Modeled after ApplicationInterface::synchronous_local_evaluations().
References ApplicationInterface::synchronous_local_analysis().
Referenced by ProcessHandleApplicInterface::create_evaluation_process().
| void prepare_process_environment | ( | ) | [protected] |
set PATH, environment variables, and change directory prior to fork/system/spawn
Guidance: environment (PATH, current directory) should be set immediately before Dakota spawns a process and reset immediately afterwards (except fork which never returns)
References WorkdirHelper::change_directory(), ProcessApplicInterface::curWorkdir, Interface::outputLevel, ProcessApplicInterface::paramsFileName, ProcessApplicInterface::resultsFileName, WorkdirHelper::set_environment(), WorkdirHelper::set_preferred_path(), and ProcessApplicInterface::useWorkdir.
Referenced by SpawnApplicInterface::create_analysis_process(), ForkApplicInterface::create_analysis_process(), SysCallApplicInterface::spawn_analysis_to_shell(), SysCallApplicInterface::spawn_evaluation_to_shell(), SysCallApplicInterface::spawn_input_filter_to_shell(), and SysCallApplicInterface::spawn_output_filter_to_shell().
| void reset_process_environment | ( | ) | [protected] |
reset PATH and current directory after system/spawn (workdir case)
Undo anything done prior to spawn
References Interface::outputLevel, WorkdirHelper::reset(), WorkdirHelper::startup_pwd(), and ProcessApplicInterface::useWorkdir.
Referenced by SpawnApplicInterface::create_analysis_process(), ForkApplicInterface::create_analysis_process(), SysCallApplicInterface::spawn_analysis_to_shell(), SysCallApplicInterface::spawn_evaluation_to_shell(), SysCallApplicInterface::spawn_input_filter_to_shell(), and SysCallApplicInterface::spawn_output_filter_to_shell().
1.7.6.1