Public Member Functions | Private Member Functions | Private Attributes
ForkApplicInterface Class Reference

Derived application interface class which spawns simulation codes using forks. More...

Inheritance diagram for ForkApplicInterface:
ApplicationInterface Interface

List of all members.

Public Member Functions

 ForkApplicInterface (const ProblemDescDB &problem_db)
 constructor
 ~ForkApplicInterface ()
 destructor
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.
void derived_synch (PRPQueue &prp_queue)
 For asynchronous function evaluations, this method is used to detect completion of jobs and process their results. It provides the processing code that is specific to derived classes. This version waits for at least one completion.
void derived_synch_nowait (PRPQueue &prp_queue)
 For asynchronous function evaluations, this method is used to detect completion of jobs and process their results. It provides the processing code that is specific to derived classes. This version is nonblocking and will return without any completions if none are immediately available.
int derived_synchronous_local_analysis (const int &analysis_id)
const StringArray & analysis_drivers () const
 retrieve the analysis drivers specification for application interfaces
const AnalysisCodeanalysis_code () const
 return AnalysisCode::fileNameMap when defined for derived Interface class

Private Member Functions

void derived_synch_kernel (PRPQueue &prp_queue, const pid_t pid)
 Convenience function for common code between derived_synch() & derived_synch_nowait()
pid_t fork_application (const bool block_flag)
 perform the complete function evaluation by managing the input filter, analysis programs, and output filter
void asynchronous_local_analyses (const int &start, const int &end, const int &step)
 execute analyses asynchronously on the local processor
void synchronous_local_analyses (const int &start, const int &end, const int &step)
 execute analyses synchronously on the local processor
void serve_analyses_asynch ()
 serve the analysis scheduler and execute analysis jobs asynchronously

Private Attributes

ForkAnalysisCode forkSimulator
 ForkAnalysisCode provides convenience functions for forking individual programs and checking fork exit status.
std::map< pid_t, int > processIdMap
 map of fork process id's to function evaluation id's for asynchronous evaluations

Detailed Description

Derived application interface class which spawns simulation codes using forks.

ForkApplicInterface uses a ForkAnalysisCode object for performing simulation invocations.


Member Function Documentation

int derived_synchronous_local_analysis ( const int &  analysis_id) [inline, virtual]
pid_t fork_application ( const bool  block_flag) [private]

perform the complete function evaluation by managing the input filter, analysis programs, and output filter

Manage the input filter, 1 or more analysis programs, and the output filter in blocking or nonblocking mode as governed by block_flag. In the case of a single analysis and no filters, a single fork is performed, while in other cases, an initial fork is reforked multiple times. Called from derived_map() with block_flag == BLOCK and from derived_map_asynch() with block_flag == FALL_THROUGH. Uses ForkAnalysisCode::fork_program() to spawn individual program components within the function evaluation.

References Dakota::abort_handler(), ApplicationInterface::analysisServerId, ApplicationInterface::asynchLocalAnalysisConcurrency, ApplicationInterface::asynchLocalAnalysisFlag, ForkApplicInterface::asynchronous_local_analyses(), ParallelLibrary::barrier_e(), AnalysisCode::command_line_arguments(), ForkAnalysisCode::driver_argument_list(), ApplicationInterface::eaDedMasterFlag, ApplicationInterface::evalCommRank, ApplicationInterface::evalCommSize, Dakota::flush(), ForkAnalysisCode::fork_program(), ForkApplicInterface::forkSimulator, ForkAnalysisCode::ifilter_argument_list(), AnalysisCode::input_filter_name(), AnalysisCode::multiple_parameters_filenames(), ApplicationInterface::numAnalysisDrivers, ApplicationInterface::numAnalysisServers, ForkAnalysisCode::ofilter_argument_list(), AnalysisCode::output_filter_name(), Interface::outputLevel, ApplicationInterface::parallelLib, AnalysisCode::parameters_filename(), AnalysisCode::program_names(), AnalysisCode::results_filename(), ApplicationInterface::self_schedule_analyses(), ForkApplicInterface::serve_analyses_asynch(), ApplicationInterface::serve_analyses_synch(), AnalysisCode::suppress_output_flag(), ApplicationInterface::suppressOutput, and ForkApplicInterface::synchronous_local_analyses().

Referenced by ForkApplicInterface::derived_map(), and ForkApplicInterface::derived_map_asynch().

void asynchronous_local_analyses ( const int &  start,
const int &  end,
const int &  step 
) [private]

execute analyses asynchronously on the local processor

Schedule analyses asynchronously on the local processor using a self-scheduling approach (start to end in step increments). Concurrency is limited by asynchLocalAnalysisConcurrency. Modeled after ApplicationInterface::asynchronous_local_evaluations(). NOTE: This function should be elevated to ApplicationInterface if and when another derived interface class supports asynchronous local analyses.

References Dakota::abort_handler(), ApplicationInterface::asynchLocalAnalysisConcurrency, ForkAnalysisCode::check_status(), ForkAnalysisCode::driver_argument_list(), ForkAnalysisCode::fork_program(), ForkApplicInterface::forkSimulator, ApplicationInterface::numAnalysisDrivers, and ForkApplicInterface::processIdMap.

Referenced by ForkApplicInterface::fork_application().

void synchronous_local_analyses ( const int &  start,
const int &  end,
const int &  step 
) [inline, private]

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 ForkApplicInterface::derived_synchronous_local_analysis().

Referenced by ForkApplicInterface::fork_application().

void serve_analyses_asynch ( ) [private]

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