OPAL (Object Oriented Parallel Accelerator Library)  2.2.0
OPAL
Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | Private Member Functions | List of all members
Pilot< Opt_t, Sim_t, SolPropagationGraph_t, Comm_t > Class Template Reference

The Optimization Pilot (Master): Coordinates requests by optimizer to workers and reports results back on a given communicator. More...

#include <Pilot.h>

Inheritance diagram for Pilot< Opt_t, Sim_t, SolPropagationGraph_t, Comm_t >:
Inheritance graph
[legend]
Collaboration diagram for Pilot< Opt_t, Sim_t, SolPropagationGraph_t, Comm_t >:
Collaboration graph
[legend]

Public Member Functions

 Pilot (CmdArguments_t args, boost::shared_ptr< Comm_t > comm, const DVarContainer_t &dvar)
 
 Pilot (CmdArguments_t args, boost::shared_ptr< Comm_t > comm, functionDictionary_t known_expr_funcs)
 
 Pilot (CmdArguments_t args, boost::shared_ptr< Comm_t > comm, functionDictionary_t known_expr_funcs, const DVarContainer_t &dvar, const Expressions::Named_t &obj, const Expressions::Named_t &cons, std::vector< double > hypervolRef={}, bool isOptimizerRun=true)
 
virtual ~Pilot ()
 

Protected Types

typedef MasterNode< typename
Opt_t::SolutionState_t,
SolPropagationGraph_t > 
MasterNode_t
 
typedef std::map< size_t,
std::pair< Param_t,
reqVarContainer_t > > 
Jobs_t
 keep track of requests and running jobs More...
 
typedef Jobs_t::iterator JobIter_t
 

Protected Member Functions

void parseInputFile (functionDictionary_t known_expr_funcs, bool isOptimizationRun)
 
virtual void startOptimizer ()
 
virtual void startWorker ()
 
virtual void startPilot ()
 
virtual void setupPoll ()
 executed before starting polling loop More...
 
virtual void prePoll ()
 executed before checking for new request More...
 
virtual void onStop ()
 enable implementation to react to STOP tag More...
 
virtual void postPoll ()
 executed after handling (if any) new request More...
 
virtual void sendNewJobToWorker (int worker)
 
virtual bool onMessage (MPI_Status status, size_t recv_value)
 
bool stop (bool isOpt=true)
 
void run ()
 
 Poller (MPI_Comm comm, double delay=0.1)
 
virtual ~Poller ()
 

Protected Attributes

MPI_Comm worker_comm_
 MPI communicator used for messages to/from worker. More...
 
MPI_Comm opt_comm_
 MPI communicator used for messages to/from optimizer. More...
 
MPI_Comm coworker_comm_
 MPI communicator used for messages between all pilots. More...
 
boost::shared_ptr< Comm_t > comm_
 
CmdArguments_t cmd_args_
 
int global_rank_
 
int my_rank_in_worker_comm_
 
int my_rank_in_opt_comm_
 
int num_coworkers_
 
boost::scoped_ptr< MasterNode_tmaster_node_
 
std::string input_file_
 input file for simulation with embedded optimization problem More...
 
int total_available_workers_
 
bool has_opt_converged_
 
bool continue_polling_
 
Expressions::Named_t objectives_
 objectives More...
 
Expressions::Named_t constraints_
 constraints More...
 
DVarContainer_t dvars_
 design variables More...
 
std::vector< double > hypervolRef_
 hypervolume reference point More...
 
std::vector< bool > is_worker_idle_
 
Jobs_t running_job_list_
 
Jobs_t request_queue_
 
boost::scoped_ptr< Tracejob_trace_
 
- Protected Attributes inherited from Poller
MPI_Comm comm_m
 communicator the poller listens to requests More...
 
bool is_running_
 
double last_polled_
 time of last MPI_Test More...
 
double poll_delay_
 delay in seconds between polls More...
 

Private Member Functions

void setup (functionDictionary_t known_expr_funcs)
 

Detailed Description

template<class Opt_t, class Sim_t, class SolPropagationGraph_t, class Comm_t>
class Pilot< Opt_t, Sim_t, SolPropagationGraph_t, Comm_t >

The Optimization Pilot (Master): Coordinates requests by optimizer to workers and reports results back on a given communicator.

Every worker thread notifies the master here if idle or not. When available the master dispatches one of the pending simulations to the worker who will run the specified simulation and report results back to the master. The Optimizer class will poll the scheduler to check if some (or all) results are available and continue to optimize and request new simulation results.

See Also
Worker
Optimizer
Template Parameters
Opt_ttype of the optimizer
Sim_ttype of the simulation
SolPropagationGraph_tstrategy to distribute solution between master islands
Comm_tcomm splitter strategy

Definition at line 85 of file Pilot.h.

Member Typedef Documentation

template<class Opt_t , class Sim_t , class SolPropagationGraph_t , class Comm_t >
typedef Jobs_t::iterator Pilot< Opt_t, Sim_t, SolPropagationGraph_t, Comm_t >::JobIter_t
protected

Definition at line 180 of file Pilot.h.

template<class Opt_t , class Sim_t , class SolPropagationGraph_t , class Comm_t >
typedef std::map<size_t, std::pair<Param_t, reqVarContainer_t> > Pilot< Opt_t, Sim_t, SolPropagationGraph_t, Comm_t >::Jobs_t
protected

keep track of requests and running jobs

Definition at line 179 of file Pilot.h.

template<class Opt_t , class Sim_t , class SolPropagationGraph_t , class Comm_t >
typedef MasterNode< typename Opt_t::SolutionState_t, SolPropagationGraph_t > Pilot< Opt_t, Sim_t, SolPropagationGraph_t, Comm_t >::MasterNode_t
protected

Definition at line 158 of file Pilot.h.

Constructor & Destructor Documentation

template<class Opt_t , class Sim_t , class SolPropagationGraph_t , class Comm_t >
Pilot< Opt_t, Sim_t, SolPropagationGraph_t, Comm_t >::Pilot ( CmdArguments_t  args,
boost::shared_ptr< Comm_t >  comm,
const DVarContainer_t dvar 
)
inline

Definition at line 91 of file Pilot.h.

template<class Opt_t , class Sim_t , class SolPropagationGraph_t , class Comm_t >
Pilot< Opt_t, Sim_t, SolPropagationGraph_t, Comm_t >::Pilot ( CmdArguments_t  args,
boost::shared_ptr< Comm_t >  comm,
functionDictionary_t  known_expr_funcs 
)
inline

Definition at line 101 of file Pilot.h.

References Pilot< Opt_t, Sim_t, SolPropagationGraph_t, Comm_t >::setup().

Here is the call graph for this function:

template<class Opt_t , class Sim_t , class SolPropagationGraph_t , class Comm_t >
Pilot< Opt_t, Sim_t, SolPropagationGraph_t, Comm_t >::Pilot ( CmdArguments_t  args,
boost::shared_ptr< Comm_t >  comm,
functionDictionary_t  known_expr_funcs,
const DVarContainer_t dvar,
const Expressions::Named_t obj,
const Expressions::Named_t cons,
std::vector< double >  hypervolRef = {},
bool  isOptimizerRun = true 
)
inline

Definition at line 110 of file Pilot.h.

template<class Opt_t , class Sim_t , class SolPropagationGraph_t , class Comm_t >
virtual Pilot< Opt_t, Sim_t, SolPropagationGraph_t, Comm_t >::~Pilot ( )
inlinevirtual

Member Function Documentation

template<class Opt_t , class Sim_t , class SolPropagationGraph_t , class Comm_t >
virtual bool Pilot< Opt_t, Sim_t, SolPropagationGraph_t, Comm_t >::onMessage ( MPI_Status  status,
size_t  recv_value 
)
inlineprotectedvirtual

User specific behavior on receiving a message.

Returns
boolean indicating if Irecv has to be re-posted

Implements Poller.

Reimplemented in SamplePilot< Opt_t, Sim_t, SolPropagationGraph_t, Comm_t >.

Definition at line 419 of file Pilot.h.

References Pilot< Opt_t, Sim_t, SolPropagationGraph_t, Comm_t >::comm_, endl(), EXCHANGE_SOL_STATE_TAG, Pilot< Opt_t, Sim_t, SolPropagationGraph_t, Comm_t >::has_opt_converged_, Pilot< Opt_t, Sim_t, SolPropagationGraph_t, Comm_t >::is_worker_idle_, Pilot< Opt_t, Sim_t, SolPropagationGraph_t, Comm_t >::job_trace_, Pilot< Opt_t, Sim_t, SolPropagationGraph_t, Comm_t >::master_node_, MPI_EXCHANGE_SOL_STATE_DATA_TAG, MPI_EXCHANGE_SOL_STATE_RES_SIZE_TAG, MPI_EXCHANGE_SOL_STATE_RES_TAG, MPI_OPT_JOB_FINISHED_TAG, MPI_Recv_params(), MPI_Recv_reqvars(), MPI_Send_reqvars(), MPI_WORKER_FINISHED_ACK_TAG, Pilot< Opt_t, Sim_t, SolPropagationGraph_t, Comm_t >::num_coworkers_, Pilot< Opt_t, Sim_t, SolPropagationGraph_t, Comm_t >::opt_comm_, OPT_CONVERGED_TAG, OPT_NEW_JOB_TAG, Pilot< Opt_t, Sim_t, SolPropagationGraph_t, Comm_t >::request_queue_, Pilot< Opt_t, Sim_t, SolPropagationGraph_t, Comm_t >::running_job_list_, Pilot< Opt_t, Sim_t, SolPropagationGraph_t, Comm_t >::sendNewJobToWorker(), Pilot< Opt_t, Sim_t, SolPropagationGraph_t, Comm_t >::stop(), Pilot< Opt_t, Sim_t, SolPropagationGraph_t, Comm_t >::worker_comm_, WORKER_FINISHED_TAG, and WORKER_STATUSUPDATE_TAG.

Referenced by Pilot< Opt_t, Sim_t, SolPropagationGraph_t, Comm_t >::run().

Here is the call graph for this function:

template<class Opt_t , class Sim_t , class SolPropagationGraph_t , class Comm_t >
virtual void Pilot< Opt_t, Sim_t, SolPropagationGraph_t, Comm_t >::onStop ( )
inlineprotectedvirtual

enable implementation to react to STOP tag

Implements Poller.

Definition at line 354 of file Pilot.h.

template<class Opt_t , class Sim_t , class SolPropagationGraph_t , class Comm_t >
void Pilot< Opt_t, Sim_t, SolPropagationGraph_t, Comm_t >::parseInputFile ( functionDictionary_t  known_expr_funcs,
bool  isOptimizationRun 
)
inlineprotected
template<class Opt_t , class Sim_t , class SolPropagationGraph_t , class Comm_t >
virtual void Pilot< Opt_t, Sim_t, SolPropagationGraph_t, Comm_t >::postPoll ( )
inlineprotectedvirtual
template<class Opt_t , class Sim_t , class SolPropagationGraph_t , class Comm_t >
virtual void Pilot< Opt_t, Sim_t, SolPropagationGraph_t, Comm_t >::prePoll ( )
inlineprotectedvirtual

executed before checking for new request

Implements Poller.

Definition at line 350 of file Pilot.h.

Referenced by Pilot< Opt_t, Sim_t, SolPropagationGraph_t, Comm_t >::run().

template<class Opt_t , class Sim_t , class SolPropagationGraph_t , class Comm_t >
void Pilot< Opt_t, Sim_t, SolPropagationGraph_t, Comm_t >::run ( )
inlineprotectedvirtual
template<class Opt_t , class Sim_t , class SolPropagationGraph_t , class Comm_t >
virtual void Pilot< Opt_t, Sim_t, SolPropagationGraph_t, Comm_t >::sendNewJobToWorker ( int  worker)
inlineprotectedvirtual
template<class Opt_t , class Sim_t , class SolPropagationGraph_t , class Comm_t >
void Pilot< Opt_t, Sim_t, SolPropagationGraph_t, Comm_t >::setup ( functionDictionary_t  known_expr_funcs)
inlineprivate
template<class Opt_t , class Sim_t , class SolPropagationGraph_t , class Comm_t >
virtual void Pilot< Opt_t, Sim_t, SolPropagationGraph_t, Comm_t >::setupPoll ( )
inlineprotectedvirtual

executed before starting polling loop

Implements Poller.

Definition at line 346 of file Pilot.h.

Referenced by Pilot< Opt_t, Sim_t, SolPropagationGraph_t, Comm_t >::run().

template<class Opt_t , class Sim_t , class SolPropagationGraph_t , class Comm_t >
virtual void Pilot< Opt_t, Sim_t, SolPropagationGraph_t, Comm_t >::startOptimizer ( )
inlineprotectedvirtual
template<class Opt_t , class Sim_t , class SolPropagationGraph_t , class Comm_t >
virtual void Pilot< Opt_t, Sim_t, SolPropagationGraph_t, Comm_t >::startPilot ( )
inlineprotectedvirtual

Definition at line 292 of file Pilot.h.

References Physics::alpha, Pilot< Opt_t, Sim_t, SolPropagationGraph_t, Comm_t >::cmd_args_, Pilot< Opt_t, Sim_t, SolPropagationGraph_t, Comm_t >::comm_, Pilot< Opt_t, Sim_t, SolPropagationGraph_t, Comm_t >::constraints_, Pilot< Opt_t, Sim_t, SolPropagationGraph_t, Comm_t >::continue_polling_, Pilot< Opt_t, Sim_t, SolPropagationGraph_t, Comm_t >::coworker_comm_, endl(), Pilot< Opt_t, Sim_t, SolPropagationGraph_t, Comm_t >::global_rank_, Pilot< Opt_t, Sim_t, SolPropagationGraph_t, Comm_t >::has_opt_converged_, Pilot< Opt_t, Sim_t, SolPropagationGraph_t, Comm_t >::is_worker_idle_, Pilot< Opt_t, Sim_t, SolPropagationGraph_t, Comm_t >::job_trace_, Pilot< Opt_t, Sim_t, SolPropagationGraph_t, Comm_t >::master_node_, Pilot< Opt_t, Sim_t, SolPropagationGraph_t, Comm_t >::my_rank_in_opt_comm_, Pilot< Opt_t, Sim_t, SolPropagationGraph_t, Comm_t >::my_rank_in_worker_comm_, Pilot< Opt_t, Sim_t, SolPropagationGraph_t, Comm_t >::num_coworkers_, Pilot< Opt_t, Sim_t, SolPropagationGraph_t, Comm_t >::objectives_, Pilot< Opt_t, Sim_t, SolPropagationGraph_t, Comm_t >::opt_comm_, Pilot< Opt_t, Sim_t, SolPropagationGraph_t, Comm_t >::run(), Pilot< Opt_t, Sim_t, SolPropagationGraph_t, Comm_t >::total_available_workers_, and Pilot< Opt_t, Sim_t, SolPropagationGraph_t, Comm_t >::worker_comm_.

Referenced by SamplePilot< Opt_t, Sim_t, SolPropagationGraph_t, Comm_t >::setup(), and Pilot< Opt_t, Sim_t, SolPropagationGraph_t, Comm_t >::setup().

Here is the call graph for this function:

template<class Opt_t , class Sim_t , class SolPropagationGraph_t , class Comm_t >
virtual void Pilot< Opt_t, Sim_t, SolPropagationGraph_t, Comm_t >::startWorker ( )
inlineprotectedvirtual
template<class Opt_t , class Sim_t , class SolPropagationGraph_t , class Comm_t >
bool Pilot< Opt_t, Sim_t, SolPropagationGraph_t, Comm_t >::stop ( bool  isOpt = true)
inlineprotected

Member Data Documentation

template<class Opt_t , class Sim_t , class SolPropagationGraph_t , class Comm_t >
CmdArguments_t Pilot< Opt_t, Sim_t, SolPropagationGraph_t, Comm_t >::cmd_args_
protected
template<class Opt_t , class Sim_t , class SolPropagationGraph_t , class Comm_t >
boost::shared_ptr<Comm_t> Pilot< Opt_t, Sim_t, SolPropagationGraph_t, Comm_t >::comm_
protected
template<class Opt_t , class Sim_t , class SolPropagationGraph_t , class Comm_t >
Expressions::Named_t Pilot< Opt_t, Sim_t, SolPropagationGraph_t, Comm_t >::constraints_
protected
template<class Opt_t , class Sim_t , class SolPropagationGraph_t , class Comm_t >
bool Pilot< Opt_t, Sim_t, SolPropagationGraph_t, Comm_t >::continue_polling_
protected
template<class Opt_t , class Sim_t , class SolPropagationGraph_t , class Comm_t >
MPI_Comm Pilot< Opt_t, Sim_t, SolPropagationGraph_t, Comm_t >::coworker_comm_
protected
template<class Opt_t , class Sim_t , class SolPropagationGraph_t , class Comm_t >
DVarContainer_t Pilot< Opt_t, Sim_t, SolPropagationGraph_t, Comm_t >::dvars_
protected
template<class Opt_t , class Sim_t , class SolPropagationGraph_t , class Comm_t >
int Pilot< Opt_t, Sim_t, SolPropagationGraph_t, Comm_t >::global_rank_
protected
template<class Opt_t , class Sim_t , class SolPropagationGraph_t , class Comm_t >
bool Pilot< Opt_t, Sim_t, SolPropagationGraph_t, Comm_t >::has_opt_converged_
protected
template<class Opt_t , class Sim_t , class SolPropagationGraph_t , class Comm_t >
std::vector<double> Pilot< Opt_t, Sim_t, SolPropagationGraph_t, Comm_t >::hypervolRef_
protected

hypervolume reference point

Definition at line 171 of file Pilot.h.

Referenced by Pilot< Opt_t, Sim_t, SolPropagationGraph_t, Comm_t >::startOptimizer().

template<class Opt_t , class Sim_t , class SolPropagationGraph_t , class Comm_t >
std::string Pilot< Opt_t, Sim_t, SolPropagationGraph_t, Comm_t >::input_file_
protected
template<class Opt_t , class Sim_t , class SolPropagationGraph_t , class Comm_t >
std::vector<bool> Pilot< Opt_t, Sim_t, SolPropagationGraph_t, Comm_t >::is_worker_idle_
protected
template<class Opt_t , class Sim_t , class SolPropagationGraph_t , class Comm_t >
boost::scoped_ptr<Trace> Pilot< Opt_t, Sim_t, SolPropagationGraph_t, Comm_t >::job_trace_
protected
template<class Opt_t , class Sim_t , class SolPropagationGraph_t , class Comm_t >
boost::scoped_ptr< MasterNode_t > Pilot< Opt_t, Sim_t, SolPropagationGraph_t, Comm_t >::master_node_
protected
template<class Opt_t , class Sim_t , class SolPropagationGraph_t , class Comm_t >
int Pilot< Opt_t, Sim_t, SolPropagationGraph_t, Comm_t >::my_rank_in_opt_comm_
protected
template<class Opt_t , class Sim_t , class SolPropagationGraph_t , class Comm_t >
int Pilot< Opt_t, Sim_t, SolPropagationGraph_t, Comm_t >::my_rank_in_worker_comm_
protected
template<class Opt_t , class Sim_t , class SolPropagationGraph_t , class Comm_t >
int Pilot< Opt_t, Sim_t, SolPropagationGraph_t, Comm_t >::num_coworkers_
protected
template<class Opt_t , class Sim_t , class SolPropagationGraph_t , class Comm_t >
Expressions::Named_t Pilot< Opt_t, Sim_t, SolPropagationGraph_t, Comm_t >::objectives_
protected
template<class Opt_t , class Sim_t , class SolPropagationGraph_t , class Comm_t >
MPI_Comm Pilot< Opt_t, Sim_t, SolPropagationGraph_t, Comm_t >::opt_comm_
protected
template<class Opt_t , class Sim_t , class SolPropagationGraph_t , class Comm_t >
Jobs_t Pilot< Opt_t, Sim_t, SolPropagationGraph_t, Comm_t >::request_queue_
protected
template<class Opt_t , class Sim_t , class SolPropagationGraph_t , class Comm_t >
Jobs_t Pilot< Opt_t, Sim_t, SolPropagationGraph_t, Comm_t >::running_job_list_
protected
template<class Opt_t , class Sim_t , class SolPropagationGraph_t , class Comm_t >
int Pilot< Opt_t, Sim_t, SolPropagationGraph_t, Comm_t >::total_available_workers_
protected
template<class Opt_t , class Sim_t , class SolPropagationGraph_t , class Comm_t >
MPI_Comm Pilot< Opt_t, Sim_t, SolPropagationGraph_t, Comm_t >::worker_comm_
protected

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