A parallel MIMCMC method. More...
#include <ParallelFixedSamplesMIMCMC.h>
A parallel MIMCMC method.
This parallelized MIMCMC method begins by assigning tasks to processes according to a StaticLoadBalancer. It then proceeds to collect a pre-defined number of samples per level. The main result is a mean estimate quantity of interest, computed via a telescoping sum across model indices. When applied to one-dimensional multiindices, this is equivalent to a MLMCMC method.
Optionally, more control can be taken: For example, samples can be analyzed on the fly and possibly additional samples requested in order to adaptively ensure high-quality estimates and optimize computational cost. To the same end, dynamic scheduling can be activated in the case of same-size work groups, which optimizes machine utilization by reassigning processes from less busy model indices to ones with higher load.
Definition at line 81 of file ParallelFixedSamplesMIMCMC.h.
Public Member Functions | |
StaticLoadBalancingMIMCMC (pt::ptree pt, std::shared_ptr< ParallelizableMIComponentFactory > componentFactory, std::shared_ptr< StaticLoadBalancer > loadBalancing=std::make_shared< RoundRobinStaticLoadBalancer >(), std::shared_ptr< parcer::Communicator > comm=std::make_shared< parcer::Communicator >(MPI_COMM_WORLD), std::shared_ptr< muq::Utilities::OTF2TracerBase > tracer=std::make_shared< OTF2TracerDummy >()) | |
Eigen::VectorXd | MeanQOI () |
Get mean quantity of interest estimate computed via telescoping sum. More... | |
virtual std::shared_ptr< SampleCollection > | GetSamples () const |
Dummy implementation; required by interface, has no meaning in ML/MI setting. More... | |
virtual std::shared_ptr< SampleCollection > | GetQOIs () const |
Dummy implementation; required by interface, has no meaning in ML/MI setting. More... | |
void | Finalize () |
Cleanup parallel method, wait for all ranks to finish. More... | |
void | RequestSamples (std::shared_ptr< MultiIndex > index, int numSamples) |
Request additional samples to be compute for a given model index. More... | |
void | RequestSamplesAll (int numSamples) |
Request an additional number of samples to be computed on each level. More... | |
void | RunSamples () |
Run the parallel method. More... | |
void | WriteToFile (std::string filename) |
Public Member Functions inherited from muq::SamplingAlgorithms::SamplingAlgorithm | |
SamplingAlgorithm (std::shared_ptr< SampleCollection > const &samples) | |
SamplingAlgorithm (std::shared_ptr< SampleCollection > const &samplesIn, std::shared_ptr< SampleCollection > const &QOIsIn) | |
SamplingAlgorithm (std::shared_ptr< SampleCollection > const &samplesIn, std::shared_ptr< parcer::Communicator > const &comm) | |
virtual | ~SamplingAlgorithm ()=default |
virtual void | SetState (std::vector< Eigen::VectorXd > const &x0) |
virtual std::shared_ptr< SampleCollection > | Run (std::vector< Eigen::VectorXd > const &x0=std::vector< Eigen::VectorXd >()) |
template<typename... Args> | |
std::shared_ptr< SampleCollection > | Run (Args const &... args) |
std::shared_ptr< parcer::Communicator > | GetCommunicator () const |
StaticLoadBalancingMIMCMC::StaticLoadBalancingMIMCMC | ( | pt::ptree | pt, |
std::shared_ptr< ParallelizableMIComponentFactory > | componentFactory, | ||
std::shared_ptr< StaticLoadBalancer > | loadBalancing = std::make_shared<RoundRobinStaticLoadBalancer>() , |
||
std::shared_ptr< parcer::Communicator > | comm = std::make_shared<parcer::Communicator>(MPI_COMM_WORLD) , |
||
std::shared_ptr< muq::Utilities::OTF2TracerBase > | tracer = std::make_shared<OTF2TracerDummy>() |
||
) |
Definition at line 38 of file ParallelFixedSamplesMIMCMC.cpp.
References muq::SamplingAlgorithms::WorkerClient::assignGroup(), collectorClients, comm, componentFactory, muq::SamplingAlgorithms::StaticLoadBalancer::WorkerAssignment::numGroups, muq::SamplingAlgorithms::StaticLoadBalancer::WorkerAssignment::numWorkersPerGroup, phonebookClient, phonebookRank, pt, rootRank, muq::SamplingAlgorithms::PhonebookServer::Run(), and workerClient.
void StaticLoadBalancingMIMCMC::Finalize | ( | ) |
Cleanup parallel method, wait for all ranks to finish.
Definition at line 160 of file ParallelFixedSamplesMIMCMC.cpp.
References collectorClients, comm, muq::SamplingAlgorithms::WorkerClient::Finalize(), phonebookClient, rootRank, muq::SamplingAlgorithms::WorkerClient::UnassignAll(), and workerClient.
Referenced by main().
|
virtual |
Dummy implementation; required by interface, has no meaning in ML/MI setting.
Reimplemented from muq::SamplingAlgorithms::SamplingAlgorithm.
Definition at line 113 of file ParallelFixedSamplesMIMCMC.cpp.
Referenced by main().
|
virtual |
Dummy implementation; required by interface, has no meaning in ML/MI setting.
Reimplemented from muq::SamplingAlgorithms::SamplingAlgorithm.
Definition at line 108 of file ParallelFixedSamplesMIMCMC.cpp.
Eigen::VectorXd StaticLoadBalancingMIMCMC::MeanQOI | ( | ) |
Get mean quantity of interest estimate computed via telescoping sum.
Definition at line 119 of file ParallelFixedSamplesMIMCMC.cpp.
References collectorClients, comm, muq::SamplingAlgorithms::ControlTag, and rootRank.
Referenced by main().
|
private |
Definition at line 276 of file ParallelFixedSamplesMIMCMC.cpp.
Referenced by RunImpl().
void StaticLoadBalancingMIMCMC::RequestSamples | ( | std::shared_ptr< MultiIndex > | index, |
int | numSamples | ||
) |
Request additional samples to be compute for a given model index.
Definition at line 176 of file ParallelFixedSamplesMIMCMC.cpp.
References collectorClients, comm, and rootRank.
void StaticLoadBalancingMIMCMC::RequestSamplesAll | ( | int | numSamples | ) |
Request an additional number of samples to be computed on each level.
Definition at line 191 of file ParallelFixedSamplesMIMCMC.cpp.
References collectorClients, comm, and rootRank.
|
protectedvirtual |
Implements muq::SamplingAlgorithms::SamplingAlgorithm.
Definition at line 265 of file ParallelFixedSamplesMIMCMC.cpp.
References collectorClients, multiindexToConfigString(), pt, and RunSamples().
void StaticLoadBalancingMIMCMC::RunSamples | ( | ) |
Run the parallel method.
Note that this internally also handles reassigning tasks for scheduling purposes. The phonebook cannot be responsible for this, since the phonebook itself needs to be available during the reassignment process.
Definition at line 203 of file ParallelFixedSamplesMIMCMC.cpp.
References muq::SamplingAlgorithms::WorkerClient::assignGroup(), collectorClients, comm, muq::SamplingAlgorithms::ControlTag, phonebookClient, rootRank, muq::SamplingAlgorithms::SCHEDULING_NEEDED, muq::SamplingAlgorithms::WorkerClient::UnassignGroup(), and workerClient.
Referenced by RunImpl().
void StaticLoadBalancingMIMCMC::WriteToFile | ( | std::string | filename | ) |
Definition at line 255 of file ParallelFixedSamplesMIMCMC.cpp.
References collectorClients, comm, and rootRank.
Referenced by main().
|
private |
Definition at line 145 of file ParallelFixedSamplesMIMCMC.h.
Referenced by Finalize(), MeanQOI(), RequestSamples(), RequestSamplesAll(), RunImpl(), RunSamples(), StaticLoadBalancingMIMCMC(), and WriteToFile().
|
private |
Definition at line 142 of file ParallelFixedSamplesMIMCMC.h.
Referenced by Finalize(), MeanQOI(), RequestSamples(), RequestSamplesAll(), RunSamples(), StaticLoadBalancingMIMCMC(), and WriteToFile().
|
private |
Definition at line 143 of file ParallelFixedSamplesMIMCMC.h.
Referenced by StaticLoadBalancingMIMCMC().
|
private |
Definition at line 144 of file ParallelFixedSamplesMIMCMC.h.
Referenced by Finalize(), RunSamples(), and StaticLoadBalancingMIMCMC().
|
private |
Definition at line 140 of file ParallelFixedSamplesMIMCMC.h.
Referenced by StaticLoadBalancingMIMCMC().
|
private |
Definition at line 141 of file ParallelFixedSamplesMIMCMC.h.
Referenced by RunImpl(), and StaticLoadBalancingMIMCMC().
|
private |
Definition at line 139 of file ParallelFixedSamplesMIMCMC.h.
Referenced by Finalize(), MeanQOI(), RequestSamples(), RequestSamplesAll(), RunSamples(), StaticLoadBalancingMIMCMC(), and WriteToFile().
|
private |
Definition at line 146 of file ParallelFixedSamplesMIMCMC.h.
Referenced by Finalize(), RunSamples(), and StaticLoadBalancingMIMCMC().