1 #ifndef PARALLELFIXEDSAMPLESMIMCMC_H_
2 #define PARALLELFIXEDSAMPLESMIMCMC_H_
12 #include "spdlog/spdlog.h"
13 #include <boost/property_tree/ptree.hpp>
20 namespace SamplingAlgorithms {
34 virtual void setup(std::shared_ptr<ParallelizableMIComponentFactory> componentFactory, uint availableRanks) = 0;
57 void setup(std::shared_ptr<ParallelizableMIComponentFactory> componentFactory, uint availableRanks)
override;
59 int numCollectors(std::shared_ptr<MultiIndex> modelIndex)
override;
85 std::shared_ptr<StaticLoadBalancer> loadBalancing = std::make_shared<RoundRobinStaticLoadBalancer>(),
86 std::shared_ptr<parcer::Communicator>
comm = std::make_shared<parcer::Communicator>(MPI_COMM_WORLD),
87 std::shared_ptr<muq::Utilities::OTF2TracerBase> tracer = std::make_shared<OTF2TracerDummy>());
97 virtual std::shared_ptr<SampleCollection>
GetSamples()
const;
102 virtual std::shared_ptr<SampleCollection>
GetQOIs()
const;
113 void RequestSamples(std::shared_ptr<MultiIndex> index,
int numSamples);
133 virtual std::shared_ptr<SampleCollection>
RunImpl(std::vector<Eigen::VectorXd>
const& x0);
142 std::shared_ptr<parcer::Communicator>
comm;
Simple default static load balancing strategy suitable for many cases.
WorkerAssignment numWorkers(std::shared_ptr< MultiIndex > modelIndex) override
Number of worker groups and number of workers per group for a given model index.
int numCollectors(std::shared_ptr< MultiIndex > modelIndex) override
Number of collector processes assigned to a model index.
void setup(std::shared_ptr< ParallelizableMIComponentFactory > componentFactory, uint availableRanks) override
Base class handling the static load balancing of parallel MIMCMC.
virtual void setup(std::shared_ptr< ParallelizableMIComponentFactory > componentFactory, uint availableRanks)=0
virtual WorkerAssignment numWorkers(std::shared_ptr< MultiIndex > modelIndex)=0
Number of worker groups and number of workers per group for a given model index.
virtual int numCollectors(std::shared_ptr< MultiIndex > modelIndex)=0
Number of collector processes assigned to a model index.
A parallel MIMCMC method.
void RunSamples()
Run the parallel method.
virtual std::shared_ptr< SampleCollection > RunImpl(std::vector< Eigen::VectorXd > const &x0)
WorkerClient workerClient
void Finalize()
Cleanup parallel method, wait for all ranks to finish.
std::shared_ptr< ParallelizableMIComponentFactory > componentFactory
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 >())
std::shared_ptr< PhonebookClient > phonebookClient
std::string multiindexToConfigString(std::shared_ptr< MultiIndex > index)
std::shared_ptr< parcer::Communicator > comm
void RequestSamplesAll(int numSamples)
Request an additional number of samples to be computed on each level.
virtual std::shared_ptr< SampleCollection > GetSamples() const
Dummy implementation; required by interface, has no meaning in ML/MI setting.
void WriteToFile(std::string filename)
std::vector< CollectorClient > collectorClients
Eigen::VectorXd MeanQOI()
Get mean quantity of interest estimate computed via telescoping sum.
void RequestSamples(std::shared_ptr< MultiIndex > index, int numSamples)
Request additional samples to be compute for a given model index.
virtual std::shared_ptr< SampleCollection > GetQOIs() const
Dummy implementation; required by interface, has no meaning in ML/MI setting.
High-level communication wrapper for controlling worker processes.