MUQ  0.4.3
muq::SamplingAlgorithms::StaticLoadBalancingMIMCMC Class Reference

A parallel MIMCMC method. More...

#include <ParallelFixedSamplesMIMCMC.h>

Inheritance diagram for muq::SamplingAlgorithms::StaticLoadBalancingMIMCMC:

Detailed Description

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< SampleCollectionGetSamples () const
 Dummy implementation; required by interface, has no meaning in ML/MI setting. More...
 
virtual std::shared_ptr< SampleCollectionGetQOIs () 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< SampleCollectionRun (std::vector< Eigen::VectorXd > const &x0=std::vector< Eigen::VectorXd >())
 
template<typename... Args>
std::shared_ptr< SampleCollectionRun (Args const &... args)
 
std::shared_ptr< parcer::Communicator > GetCommunicator () const
 

Constructor & Destructor Documentation

◆ StaticLoadBalancingMIMCMC()

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

Member Function Documentation

◆ Finalize()

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

◆ GetQOIs()

std::shared_ptr< SampleCollection > StaticLoadBalancingMIMCMC::GetQOIs ( ) const
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().

◆ GetSamples()

std::shared_ptr< SampleCollection > StaticLoadBalancingMIMCMC::GetSamples ( ) const
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.

◆ MeanQOI()

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

◆ multiindexToConfigString()

std::string StaticLoadBalancingMIMCMC::multiindexToConfigString ( std::shared_ptr< MultiIndex >  index)
private

Definition at line 276 of file ParallelFixedSamplesMIMCMC.cpp.

Referenced by RunImpl().

◆ RequestSamples()

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.

◆ RequestSamplesAll()

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.

◆ RunImpl()

std::shared_ptr< SampleCollection > StaticLoadBalancingMIMCMC::RunImpl ( std::vector< Eigen::VectorXd > const &  x0)
protectedvirtual

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

◆ WriteToFile()

void StaticLoadBalancingMIMCMC::WriteToFile ( std::string  filename)

Definition at line 255 of file ParallelFixedSamplesMIMCMC.cpp.

References collectorClients, comm, and rootRank.

Referenced by main().

Member Data Documentation

◆ collectorClients

std::vector<CollectorClient> muq::SamplingAlgorithms::StaticLoadBalancingMIMCMC::collectorClients
private

◆ comm

std::shared_ptr<parcer::Communicator> muq::SamplingAlgorithms::StaticLoadBalancingMIMCMC::comm
private

◆ componentFactory

std::shared_ptr<ParallelizableMIComponentFactory> muq::SamplingAlgorithms::StaticLoadBalancingMIMCMC::componentFactory
private

Definition at line 143 of file ParallelFixedSamplesMIMCMC.h.

Referenced by StaticLoadBalancingMIMCMC().

◆ phonebookClient

std::shared_ptr<PhonebookClient> muq::SamplingAlgorithms::StaticLoadBalancingMIMCMC::phonebookClient
private

Definition at line 144 of file ParallelFixedSamplesMIMCMC.h.

Referenced by Finalize(), RunSamples(), and StaticLoadBalancingMIMCMC().

◆ phonebookRank

const int muq::SamplingAlgorithms::StaticLoadBalancingMIMCMC::phonebookRank = 1
private

Definition at line 140 of file ParallelFixedSamplesMIMCMC.h.

Referenced by StaticLoadBalancingMIMCMC().

◆ pt

pt::ptree muq::SamplingAlgorithms::StaticLoadBalancingMIMCMC::pt
private

Definition at line 141 of file ParallelFixedSamplesMIMCMC.h.

Referenced by RunImpl(), and StaticLoadBalancingMIMCMC().

◆ rootRank

const int muq::SamplingAlgorithms::StaticLoadBalancingMIMCMC::rootRank = 0
private

◆ workerClient

WorkerClient muq::SamplingAlgorithms::StaticLoadBalancingMIMCMC::workerClient
private

Definition at line 146 of file ParallelFixedSamplesMIMCMC.h.

Referenced by Finalize(), RunSamples(), and StaticLoadBalancingMIMCMC().


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