Public Member Functions | Private Attributes
ForkAnalysisCode Class Reference

Derived class in the AnalysisCode class hierarchy which spawns simulations using forks. More...

Inheritance diagram for ForkAnalysisCode:
AnalysisCode

List of all members.

Public Member Functions

 ForkAnalysisCode (const ProblemDescDB &problem_db)
 constructor
 ~ForkAnalysisCode ()
 destructor
pid_t fork_program (const bool block_flag)
 spawn a child process using fork()/vfork()/execvp() and wait for completion using waitpid() if block_flag is true
void check_status (const int status)
 check the exit status of a forked process and abort if an error code was returned
void ifilter_argument_list ()
 set argList for execution of the input filter
void ofilter_argument_list ()
 set argList for execution of the output filter
void driver_argument_list (const int analysis_id)
 set argList for execution of the specified analysis driver

Private Attributes

std::vector< std::string > argList
 an array of strings for use with execvp(const char *, char * const *). These are converted to an array of const char*'s in fork_program().

Detailed Description

Derived class in the AnalysisCode class hierarchy which spawns simulations using forks.

ForkAnalysisCode creates a copy of the parent DAKOTA process using fork()/vfork() and then replaces the copy with a simulation process using execvp(). The parent process can then use waitpid() to wait on completion of the simulation process.


Member Function Documentation

void check_status ( const int  status)

check the exit status of a forked process and abort if an error code was returned

Check to see if the process terminated abnormally (WIFEXITED(status)==0) or if either execvp or the application returned a status code of -1 (WIFEXITED(status)!=0 && (signed char)WEXITSTATUS(status)==-1). If one of these conditions is detected, output a failure message and abort. Note: the application code should not return a status code of -1 unless an immediate abort of dakota is wanted. If for instance, failure capturing is to be used, the application code should write the word "FAIL" to the appropriate results file and return a status code of 0 through exit().

References Dakota::abort_handler().

Referenced by ForkApplicInterface::asynchronous_local_analyses(), ForkApplicInterface::derived_synch(), ForkApplicInterface::derived_synch_nowait(), ForkAnalysisCode::fork_program(), and ForkApplicInterface::serve_analyses_asynch().


The documentation for this class was generated from the following files: