Dakota
Version
Explore and Predict with Confidence
|
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 ¶llel_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 | |
ParallelLibrary & | parallelLib |
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) | |
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.
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().
|
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_model(), ProblemDescDB::get_ushort(), Model::init_comms_bcast_flag(), Iterator::init_communicators(), Iterator::is_null(), Model::is_null(), Iterator::iterated_model(), Iterator::maximum_evaluation_concurrency(), Iterator::method_name(), Model::serve_init_communicators(), and Model::stop_init_communicators().
Referenced by MetaIterator::allocate_by_name(), MetaIterator::allocate_by_pointer(), Environment::construct(), ConcurrentMetaIterator::derived_init_communicators(), NestedModel::derived_init_communicators(), and IteratorScheduler::init_iterator().
|
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().
|
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().
|
static |
convenience function for setting comms prior to running an iterator
This is a convenience function for encapsulating the deallocation of communicators after running an iterator.
References Iterator::derived_set_communicators(), and Iterator::set_communicators().
Referenced by CollabHybridMetaIterator::derived_set_communicators(), ConcurrentMetaIterator::derived_set_communicators(), EmbedHybridMetaIterator::derived_set_communicators(), SeqHybridMetaIterator::derived_set_communicators(), NestedModel::derived_set_communicators(), and IteratorScheduler::set_iterator().
|
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().
|
static |
convenience function for deallocating comms after running an iterator
This is a convenience function for encapsulating the deallocation of communicators after running an iterator.
References Iterator::derived_free_communicators(), Iterator::free_communicators(), and Iterator::method_name().
Referenced by CollabHybridMetaIterator::derived_free_communicators(), ConcurrentMetaIterator::derived_free_communicators(), EmbedHybridMetaIterator::derived_free_communicators(), SeqHybridMetaIterator::derived_free_communicators(), NestedModel::derived_free_communicators(), Environment::destruct(), and IteratorScheduler::free_iterator().
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().
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().
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().
void partition | ( | int | max_iterator_concurrency, |
IntIntPair & | ppi_pr | ||
) |
convenience function for initializing iterator communicators, setting parallel configuration attributes, and managing outputs and restart.
Called from derived class constructors once maxIteratorConcurrency is defined but prior to instantiating Iterators and Models.
References ParallelLibrary::init_iterator_communicators(), IteratorScheduler::iteratorScheduling, IteratorScheduler::numIteratorServers, ParallelLibrary::parallel_configuration_iterator(), IteratorScheduler::parallelLib, IteratorScheduler::procsPerIterator, ParallelLibrary::push_output_tag(), and IteratorScheduler::update().
Referenced by CollabHybridMetaIterator::derived_init_communicators(), ConcurrentMetaIterator::derived_init_communicators(), EmbedHybridMetaIterator::derived_init_communicators(), SeqHybridMetaIterator::derived_init_communicators(), and NestedModel::derived_init_communicators().
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()
This implementation supports the scheduling of multiple jobs using a single iterator/model pair. Additional future (overloaded) implementations could involve independent iterator instances.
References IteratorScheduler::iteratorScheduling, IteratorScheduler::iteratorServerId, IteratorScheduler::lead_rank(), IteratorScheduler::master_dynamic_schedule_iterators(), IteratorScheduler::numIteratorServers, ParallelLibrary::parallel_configuration_iterator(), IteratorScheduler::parallelLib, IteratorScheduler::peer_static_schedule_iterators(), IteratorScheduler::serve_iterators(), and IteratorScheduler::stop_iterator_servers().
Referenced by CollabHybridMetaIterator::core_run(), ConcurrentMetaIterator::core_run(), EmbedHybridMetaIterator::core_run(), NestedModel::derived_synchronize(), SeqHybridMetaIterator::run_sequential(), and NestedModel::serve_run().
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
This function is adapted from ApplicationInterface::master_dynamic_schedule_evaluations().
References ParallelLibrary::free(), ParallelLibrary::irecv_mi(), ParallelLibrary::isend_mi(), IteratorScheduler::miPLIndex, IteratorScheduler::numIteratorJobs, IteratorScheduler::numIteratorServers, IteratorScheduler::parallelLib, MPIPackBuffer::reset(), MPIUnpackBuffer::resize(), IteratorScheduler::resultsMsgLen, ParallelLibrary::waitall(), and ParallelLibrary::waitsome().
Referenced by IteratorScheduler::schedule_iterators().
void serve_iterators | ( | MetaType & | meta_object, |
Iterator & | sub_iterator | ||
) |
executed on the slave iterator servers to perform iterator jobs assigned by the scheduler master
This function is similar in structure to ApplicationInterface::serve_evaluations_synch().
References ParallelLibrary::bcast_i(), IteratorScheduler::iteratorCommRank, IteratorScheduler::iteratorCommSize, IteratorScheduler::miPLIndex, ParallelLibrary::parallel_time(), IteratorScheduler::parallelLib, IteratorScheduler::paramsMsgLen, ParallelLibrary::recv_mi(), IteratorScheduler::resultsMsgLen, IteratorScheduler::run_iterator(), and ParallelLibrary::send_mi().
Referenced by IteratorScheduler::schedule_iterators().