Dakota  Version
Explore and Predict with Confidence
Public Member Functions | Static Public Member Functions | Public Attributes | Private Attributes | List of all members
IteratorScheduler Class Reference

This class encapsulates scheduling operations for concurrent sub-iteration within an outer level context (e.g., meta-iteration, nested models). More...

Public Member Functions

 IteratorScheduler (ParallelLibrary &parallel_lib, bool peer_assign_jobs, int num_servers=0, int procs_per_iterator=0, short scheduling=DEFAULT_SCHEDULING)
 constructor More...
 
 ~IteratorScheduler ()
 destructor
 
void construct_sub_iterator (ProblemDescDB &problem_db, Iterator &sub_iterator, Model &sub_model, const String &method_ptr, const String &method_name, const String &model_ptr)
 instantiate sub_iterator on the current rank if not already constructed
 
IntIntPair configure (ProblemDescDB &problem_db, Iterator &sub_iterator, Model &sub_model)
 performs sufficient initialization to define partitioning controls (min and max processors per iterator server) More...
 
IntIntPair configure (ProblemDescDB &problem_db, const String &method_string, Iterator &sub_iterator, Model &sub_model)
 performs sufficient initialization to define partitioning controls (min and max processors per iterator server) More...
 
IntIntPair configure (ProblemDescDB &problem_db, Iterator &sub_iterator)
 performs sufficient initialization to define partitioning controls (min and max processors per iterator server) More...
 
void partition (int max_iterator_concurrency, IntIntPair &ppi_pr)
 convenience function for initializing iterator communicators, setting parallel configuration attributes, and managing outputs and restart. More...
 
void init_iterator (ProblemDescDB &problem_db, Iterator &sub_iterator, Model &sub_model)
 invokes static version of this function with appropriate parallelism level
 
void init_iterator (ProblemDescDB &problem_db, const String &method_string, Iterator &sub_iterator, Model &sub_model)
 invokes static version of this function with appropriate parallelism level
 
void set_iterator (Iterator &sub_iterator)
 invokes static version of this function with appropriate parallelism level
 
void run_iterator (Iterator &sub_iterator)
 invokes static version of this function with appropriate parallelism level
 
void free_iterator (Iterator &sub_iterator)
 invokes static version of this function with appropriate parallelism level
 
void free_iterator_parallelism ()
 convenience function for deallocating the concurrent iterator parallelism level
 
template<typename MetaType >
void schedule_iterators (MetaType &meta_object, Iterator &sub_iterator)
 short convenience function for distributing control among master_dynamic_schedule_iterators(), serve_iterators(), and peer_static_schedule_iterators() More...
 
template<typename MetaType >
void master_dynamic_schedule_iterators (MetaType &meta_object)
 executed by the scheduler master to manage a dynamic schedule of iterator jobs among slave iterator servers More...
 
void stop_iterator_servers ()
 executed by the scheduler master to terminate slave iterator servers
 
template<typename MetaType >
void serve_iterators (MetaType &meta_object, Iterator &sub_iterator)
 executed on the slave iterator servers to perform iterator jobs assigned by the scheduler master More...
 
template<typename MetaType >
void peer_static_schedule_iterators (MetaType &meta_object, Iterator &sub_iterator)
 executed on iterator peers to manage a static schedule of iterator jobs
 
void update (ParConfigLIter pc_iter)
 update schedPCIter
 
void update (size_t index)
 update miPLIndex as well as associated settings for concurrent iterator scheduling from the corresponding ParallelLevel
 
void update (ParConfigLIter pc_iter, size_t index)
 invoke update(ParConfigLIter) and update(size_t) in sequence
 
void iterator_message_lengths (int params_msg_len, int results_msg_len)
 update paramsMsgLen and resultsMsgLen
 
bool lead_rank () const
 determines if current processor is rank 0 of the parent comm
 

Static Public Member Functions

static void init_iterator (ProblemDescDB &problem_db, Iterator &sub_iterator, ParLevLIter pl_iter)
 convenience function for allocation of an iterator and (parallel) initialization of its comms More...
 
static void init_iterator (ProblemDescDB &problem_db, Iterator &sub_iterator, Model &sub_model, ParLevLIter pl_iter)
 convenience function for allocation of an iterator and (parallel) initialization of its comms More...
 
static void init_iterator (ProblemDescDB &problem_db, const String &method_string, Iterator &sub_iterator, Model &sub_model, ParLevLIter pl_iter)
 convenience function for lightweight allocation of an iterator and (parallel) initialization of its comms More...
 
static void set_iterator (Iterator &sub_iterator, ParLevLIter pl_iter)
 convenience function for setting comms prior to running an iterator More...
 
static void run_iterator (Iterator &sub_iterator, ParLevLIter pl_iter)
 Convenience function for invoking an iterator and managing parallelism. This version omits communicator repartitioning. Function must be public due to use by MINLPNode. More...
 
static void free_iterator (Iterator &sub_iterator, ParLevLIter pl_iter)
 convenience function for deallocating comms after running an iterator More...
 

Public Attributes

ParallelLibraryparallelLib
 reference to the ParallelLibrary instance
 
int numIteratorJobs
 number of iterator executions to schedule
 
int numIteratorServers
 number of concurrent iterator partitions
 
int procsPerIterator
 partition size request
 
int iteratorCommRank
 processor rank in iteratorComm
 
int iteratorCommSize
 number of processors in iteratorComm
 
int iteratorServerId
 identifier for an iterator server
 
bool messagePass
 flag for message passing among iterator servers
 
short iteratorScheduling
 {DEFAULT,MASTER,PEER}_SCHEDULING
 
bool peerAssignJobs
 flag indicating need for peer 1 to assign jobs to peers 2-n
 
ParConfigLIter schedPCIter
 iterator for active parallel configuration
 
size_t miPLIndex
 index of active parallel level (corresponding to ParallelConfiguration::miPLIters) to use for parallelLib send/recv
 

Private Attributes

int paramsMsgLen
 length of MPI buffer for parameter input instance(s)
 
int resultsMsgLen
 length of MPI buffer for results output instance(s)
 

Detailed Description

This class encapsulates scheduling operations for concurrent sub-iteration within an outer level context (e.g., meta-iteration, nested models).

In time, a Scheduler class hierarchy is envisioned, but for now, this class is not part of a hierarchy.

Constructor & Destructor Documentation

◆ IteratorScheduler()

IteratorScheduler ( ParallelLibrary parallel_lib,
bool  peer_assign_jobs,
int  num_servers = 0,
int  procs_per_iterator = 0,
short  scheduling = DEFAULT_SCHEDULING 
)

constructor

Current constructor parameters are the input specification components, which are requests subject to override by ParallelLibrary::init_iterator_communicators().

Member Function Documentation

◆ init_iterator() [1/3]

void init_iterator ( ProblemDescDB problem_db,
Iterator sub_iterator,
ParLevLIter  pl_iter 
)
static

◆ init_iterator() [2/3]

void init_iterator ( ProblemDescDB problem_db,
Iterator sub_iterator,
Model sub_model,
ParLevLIter  pl_iter 
)
static

convenience function for allocation of an iterator and (parallel) initialization of its comms

This is a convenience function for encapsulating the allocation of communicators prior to running an iterator.

References ProblemDescDB::get_iterator(), ProblemDescDB::get_ushort(), Model::init_comms_bcast_flag(), Iterator::init_communicators(), Iterator::is_null(), Iterator::iterated_model(), Iterator::maximum_evaluation_concurrency(), Iterator::method_name(), Model::serve_init_communicators(), and Model::stop_init_communicators().

◆ init_iterator() [3/3]

void init_iterator ( ProblemDescDB problem_db,
const String &  method_string,
Iterator sub_iterator,
Model sub_model,
ParLevLIter  pl_iter 
)
static

convenience function for lightweight allocation of an iterator and (parallel) initialization of its comms

This is a convenience function for encapsulating the allocation of communicators prior to running an iterator.

References ProblemDescDB::get_iterator(), Model::init_comms_bcast_flag(), Iterator::init_communicators(), Iterator::is_null(), Iterator::iterated_model(), Iterator::maximum_evaluation_concurrency(), Iterator::method_string(), Model::serve_init_communicators(), and Model::stop_init_communicators().

◆ set_iterator()

void set_iterator ( Iterator sub_iterator,
ParLevLIter  pl_iter 
)
static

◆ run_iterator()

void run_iterator ( Iterator sub_iterator,
ParLevLIter  pl_iter 
)
static

Convenience function for invoking an iterator and managing parallelism. This version omits communicator repartitioning. Function must be public due to use by MINLPNode.

This is a convenience function for encapsulating the parallel features (run/serve) of running an iterator. This function omits allocation/deallocation of communicators to provide greater efficiency in approaches that involve multiple iterator executions but only require communicator allocation/deallocation to be performed once.

References Model::finalize_mapping(), Model::initialize_mapping(), Iterator::iterated_model(), Iterator::maximum_evaluation_concurrency(), Iterator::method_name(), Iterator::resize(), Iterator::resize_communicators(), Iterator::run(), Model::serve_finalize_mapping(), Model::serve_init_mapping(), Model::serve_run(), Model::stop_finalize_mapping(), Model::stop_init_mapping(), and Model::stop_servers().

Referenced by NestedModel::derived_evaluate(), Environment::execute(), IteratorScheduler::peer_static_schedule_iterators(), IteratorScheduler::run_iterator(), and IteratorScheduler::serve_iterators().

◆ free_iterator()

void free_iterator ( Iterator sub_iterator,
ParLevLIter  pl_iter 
)
static

◆ configure() [1/3]

IntIntPair configure ( ProblemDescDB problem_db,
Iterator sub_iterator,
Model sub_model 
)

performs sufficient initialization to define partitioning controls (min and max processors per iterator server)

This is a convenience function for computing the minimum and maximum partition size prior to concurrent iterator partitioning.

References ProblemDescDB::get_iterator(), IteratorScheduler::schedPCIter, and ParallelLevel::server_communicator_rank().

Referenced by IteratorScheduler::configure(), ConcurrentMetaIterator::derived_init_communicators(), NestedModel::derived_init_communicators(), MetaIterator::estimate_by_name(), and MetaIterator::estimate_by_pointer().

◆ configure() [2/3]

IntIntPair configure ( ProblemDescDB problem_db,
const String &  method_string,
Iterator sub_iterator,
Model sub_model 
)

performs sufficient initialization to define partitioning controls (min and max processors per iterator server)

This is a convenience function for computing the minimum and maximum partition size prior to concurrent iterator partitioning.

References IteratorScheduler::configure(), ProblemDescDB::get_iterator(), IteratorScheduler::schedPCIter, and ParallelLevel::server_communicator_rank().

◆ configure() [3/3]

IntIntPair configure ( ProblemDescDB problem_db,
Iterator sub_iterator 
)

performs sufficient initialization to define partitioning controls (min and max processors per iterator server)

This is a convenience function for computing the minimum and maximum partition size prior to concurrent iterator partitioning.

References ParallelLibrary::bcast(), Iterator::estimate_partition_bounds(), ProblemDescDB::get_db_method_node(), ProblemDescDB::get_db_model_node(), IteratorScheduler::parallelLib, IteratorScheduler::schedPCIter, ParallelLevel::server_communicator_rank(), ParallelLevel::server_communicator_size(), ProblemDescDB::set_db_method_node(), ProblemDescDB::set_db_model_nodes(), and MPIPackBuffer::size().

◆ partition()

void partition ( int  max_iterator_concurrency,
IntIntPair &  ppi_pr 
)

◆ schedule_iterators()

void schedule_iterators ( MetaType &  meta_object,
Iterator sub_iterator 
)

◆ master_dynamic_schedule_iterators()

void master_dynamic_schedule_iterators ( MetaType &  meta_object)

◆ serve_iterators()

void serve_iterators ( MetaType &  meta_object,
Iterator sub_iterator 
)

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