OPAL (Object Oriented Parallel Accelerator Library) 2024.2
OPAL
SamplePilot< Opt_t, Sim_t, SolPropagationGraph_t, Comm_t > Class Template Reference

#include <SamplePilot.h>

Inheritance diagram for SamplePilot< Opt_t, Sim_t, SolPropagationGraph_t, Comm_t >:
Collaboration diagram for SamplePilot< Opt_t, Sim_t, SolPropagationGraph_t, Comm_t >:

Public Member Functions

 SamplePilot (CmdArguments_t args, std::shared_ptr< Comm_t > comm, functionDictionary_t known_expr_funcs, const DVarContainer_t &dvar, const Expressions::Named_t &obj, const std::map< std::string, std::shared_ptr< SamplingMethod > > &sampleMethods, const std::vector< std::string > &storeobjstr, const std::vector< std::string > &filesToKeep, const std::map< std::string, std::string > &userVariables)
virtual ~SamplePilot ()

Protected Types

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

Protected Member Functions

virtual void setup (functionDictionary_t known_expr_funcs, const std::vector< std::string > &storeobjstr, const std::vector< std::string > &filesToKeep, const std::map< std::string, std::string > &userVariables)
virtual void startSampler ()
void startWorker (const std::vector< std::string > &storeobjstr, const std::vector< std::string > &filesToKeep, const std::map< std::string, std::string > &userVariables)
virtual void postPoll ()
 executed after handling (if any) new request
virtual void sendNewJobToWorker (int worker)
virtual bool onMessage (MPI_Status status, size_t recv_value)
void parseInputFile (functionDictionary_t, bool isOptimizationRun)
virtual void startOptimizer ()
virtual void startWorker (const std::map< std::string, std::string > &userVariables)
virtual void startPilot ()
virtual void setupPoll ()
 executed before starting polling loop
virtual void prePoll ()
 executed before checking for new request
virtual void onStop ()
 enable implementation to react to STOP tag
bool stop (bool isOpt=true)
void run ()

Protected Attributes

Jobs_t running_job_list_
Jobs_t request_queue_
MPI_Comm worker_comm_
 MPI communicator used for messages to/from worker.
MPI_Comm opt_comm_
 MPI communicator used for messages to/from optimizer.
MPI_Comm coworker_comm_
 MPI communicator used for messages between all pilots.
std::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_
std::unique_ptr< MasterNode_tmaster_node_
std::string input_file_
 input file for simulation with embedded optimization problem
int total_available_workers_
bool has_opt_converged_
bool continue_polling_
Expressions::Named_t objectives_
 objectives
Expressions::Named_t constraints_
 constraints
DVarContainer_t dvars_
 design variables
std::vector< double > hypervolRef_
 hypervolume reference point
std::vector< bool > is_worker_idle_
std::unique_ptr< Tracejob_trace_
MPI_Comm comm_m
 communicator the poller listens to requests
bool is_running_
double last_polled_
 time of last MPI_Test
double poll_delay_
 delay in seconds between polls

Private Attributes

std::map< std::string, std::shared_ptr< SamplingMethod > > sampleMethods_m

Detailed Description

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

Definition at line 46 of file SamplePilot.h.

Member Typedef Documentation

◆ JobIter_t

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

Definition at line 96 of file SamplePilot.h.

◆ Jobs_t

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

keep track of requests and running jobs

Definition at line 95 of file SamplePilot.h.

◆ MasterNode_t

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
protectedinherited

Definition at line 173 of file Pilot.h.

Constructor & Destructor Documentation

◆ SamplePilot()

template<class Opt_t, class Sim_t, class SolPropagationGraph_t, class Comm_t>
SamplePilot< Opt_t, Sim_t, SolPropagationGraph_t, Comm_t >::SamplePilot ( CmdArguments_t args,
std::shared_ptr< Comm_t > comm,
functionDictionary_t known_expr_funcs,
const DVarContainer_t & dvar,
const Expressions::Named_t & obj,
const std::map< std::string, std::shared_ptr< SamplingMethod > > & sampleMethods,
const std::vector< std::string > & storeobjstr,
const std::vector< std::string > & filesToKeep,
const std::map< std::string, std::string > & userVariables )
inline

Definition at line 54 of file SamplePilot.h.

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

Here is the call graph for this function:

◆ ~SamplePilot()

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

Definition at line 88 of file SamplePilot.h.

Member Function Documentation

◆ onMessage()

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

◆ onStop()

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 ( )
inlineprotectedvirtualinherited

enable implementation to react to STOP tag

Implements Poller.

Definition at line 369 of file Pilot.h.

◆ parseInputFile()

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 ,
bool isOptimizationRun )
inlineprotectedinherited

◆ postPoll()

template<class Opt_t, class Sim_t, class SolPropagationGraph_t, class Comm_t>
virtual void SamplePilot< Opt_t, Sim_t, SolPropagationGraph_t, Comm_t >::postPoll ( )
inlineprotectedvirtual

◆ prePoll()

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 ( )
inlineprotectedvirtualinherited

executed before checking for new request

Implements Poller.

Definition at line 365 of file Pilot.h.

Referenced by run().

◆ 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 ( )
inlineprotectedvirtualinherited

The poll loop stops when receiving a 'MPI_STOP_TAG' otherwise passes message to user.

Reimplemented from Poller.

Definition at line 602 of file Pilot.h.

References cmd_args_, continue_polling_, coworker_comm_, MPI_STOP_TAG, onMessage(), opt_comm_, OPT_CONVERGED_TAG, postPoll(), prePoll(), setupPoll(), stop(), and worker_comm_.

Referenced by startPilot().

Here is the call graph for this function:

◆ sendNewJobToWorker()

template<class Opt_t, class Sim_t, class SolPropagationGraph_t, class Comm_t>
virtual void SamplePilot< Opt_t, Sim_t, SolPropagationGraph_t, Comm_t >::sendNewJobToWorker ( int worker)
inlineprotectedvirtual

◆ setup()

template<class Opt_t, class Sim_t, class SolPropagationGraph_t, class Comm_t>
virtual void SamplePilot< Opt_t, Sim_t, SolPropagationGraph_t, Comm_t >::setup ( functionDictionary_t known_expr_funcs,
const std::vector< std::string > & storeobjstr,
const std::vector< std::string > & filesToKeep,
const std::map< std::string, std::string > & userVariables )
inlineprotectedvirtual

◆ setupPoll()

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 ( )
inlineprotectedvirtualinherited

executed before starting polling loop

Implements Poller.

Definition at line 361 of file Pilot.h.

Referenced by run().

◆ startOptimizer()

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 ( )
inlineprotectedvirtualinherited

Definition at line 269 of file Pilot.h.

References cmd_args_, comm_, constraints_, dvars_, global_rank_, hypervolRef_, and objectives_.

Referenced by setup().

◆ startPilot()

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 ( )
inlineprotectedvirtualinherited

Definition at line 307 of file Pilot.h.

References cmd_args_, comm_, constraints_, continue_polling_, coworker_comm_, global_rank_, has_opt_converged_, is_worker_idle_, job_trace_, master_node_, my_rank_in_opt_comm_, my_rank_in_worker_comm_, num_coworkers_, objectives_, opt_comm_, run(), total_available_workers_, and worker_comm_.

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

Here is the call graph for this function:

◆ startSampler()

template<class Opt_t, class Sim_t, class SolPropagationGraph_t, class Comm_t>
virtual void SamplePilot< Opt_t, Sim_t, SolPropagationGraph_t, Comm_t >::startSampler ( )
inlineprotectedvirtual

◆ startWorker() [1/2]

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 ( const std::map< std::string, std::string > & userVariables)
inlineprotectedvirtualinherited

Definition at line 285 of file Pilot.h.

References cmd_args_, comm_, constraints_, global_rank_, input_file_, and objectives_.

Referenced by setup().

◆ startWorker() [2/2]

template<class Opt_t, class Sim_t, class SolPropagationGraph_t, class Comm_t>
void SamplePilot< Opt_t, Sim_t, SolPropagationGraph_t, Comm_t >::startWorker ( const std::vector< std::string > & storeobjstr,
const std::vector< std::string > & filesToKeep,
const std::map< std::string, std::string > & userVariables )
inlineprotected

◆ stop()

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)
inlineprotectedinherited

Member Data Documentation

◆ cmd_args_

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_
protectedinherited

Definition at line 164 of file Pilot.h.

Referenced by parseInputFile(), Pilot(), Pilot(), run(), startOptimizer(), startPilot(), startWorker(), and stop().

◆ comm_

◆ comm_m

MPI_Comm Poller::comm_m
protectedinherited

◆ constraints_

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_
protectedinherited

◆ continue_polling_

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_
protectedinherited

◆ coworker_comm_

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_
protectedinherited

MPI communicator used for messages between all pilots.

Definition at line 161 of file Pilot.h.

Referenced by run(), startPilot(), and stop().

◆ dvars_

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_
protectedinherited

◆ global_rank_

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_
protectedinherited

◆ has_opt_converged_

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_
protectedinherited

◆ hypervolRef_

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_
protectedinherited

hypervolume reference point

Definition at line 186 of file Pilot.h.

Referenced by startOptimizer().

◆ input_file_

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_
protectedinherited

input file for simulation with embedded optimization problem

Definition at line 177 of file Pilot.h.

Referenced by parseInputFile(), startWorker(), and SamplePilot< Opt_t, Sim_t, SolPropagationGraph_t, Comm_t >::startWorker().

◆ is_running_

bool Poller::is_running_
protectedinherited

◆ is_worker_idle_

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_
protectedinherited

◆ job_trace_

template<class Opt_t, class Sim_t, class SolPropagationGraph_t, class Comm_t>
std::unique_ptr<Trace> Pilot< Opt_t, Sim_t, SolPropagationGraph_t, Comm_t >::job_trace_
protectedinherited

◆ last_polled_

double Poller::last_polled_
protectedinherited

time of last MPI_Test

Definition at line 57 of file Poller.h.

Referenced by Poller(), and run().

◆ master_node_

template<class Opt_t, class Sim_t, class SolPropagationGraph_t, class Comm_t>
std::unique_ptr< MasterNode_t > Pilot< Opt_t, Sim_t, SolPropagationGraph_t, Comm_t >::master_node_
protectedinherited

Definition at line 174 of file Pilot.h.

Referenced by onMessage(), and startPilot().

◆ my_rank_in_opt_comm_

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_
protectedinherited

Definition at line 168 of file Pilot.h.

Referenced by startPilot().

◆ my_rank_in_worker_comm_

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_
protectedinherited

◆ num_coworkers_

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_
protectedinherited

Definition at line 170 of file Pilot.h.

Referenced by onMessage(), startPilot(), and stop().

◆ objectives_

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_
protectedinherited

◆ opt_comm_

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_
protectedinherited

MPI communicator used for messages to/from optimizer.

Definition at line 159 of file Pilot.h.

Referenced by onMessage(), SamplePilot< Opt_t, Sim_t, SolPropagationGraph_t, Comm_t >::onMessage(), run(), startPilot(), and stop().

◆ poll_delay_

double Poller::poll_delay_
protectedinherited

delay in seconds between polls

Definition at line 59 of file Poller.h.

Referenced by Poller(), and run().

◆ request_queue_

template<class Opt_t, class Sim_t, class SolPropagationGraph_t, class Comm_t>
Jobs_t SamplePilot< Opt_t, Sim_t, SolPropagationGraph_t, Comm_t >::request_queue_
protected

Definition at line 98 of file SamplePilot.h.

Referenced by onMessage(), postPoll(), and sendNewJobToWorker().

◆ running_job_list_

template<class Opt_t, class Sim_t, class SolPropagationGraph_t, class Comm_t>
Jobs_t SamplePilot< Opt_t, Sim_t, SolPropagationGraph_t, Comm_t >::running_job_list_
protected

Definition at line 97 of file SamplePilot.h.

Referenced by onMessage(), and sendNewJobToWorker().

◆ sampleMethods_m

template<class Opt_t, class Sim_t, class SolPropagationGraph_t, class Comm_t>
std::map< std::string, std::shared_ptr<SamplingMethod> > SamplePilot< Opt_t, Sim_t, SolPropagationGraph_t, Comm_t >::sampleMethods_m
private

Definition at line 299 of file SamplePilot.h.

Referenced by startSampler().

◆ total_available_workers_

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_
protectedinherited

◆ worker_comm_

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_
protectedinherited

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