16 #include <boost/property_tree/ptree.hpp>
18 namespace pt = boost::property_tree;
26 #include "ParallelProblem.h"
30 int main(
int argc,
char **argv){
31 spdlog::set_level(spdlog::level::debug);
33 MPI_Init(&argc, &argv);
34 auto comm = std::make_shared<parcer::Communicator>(MPI_COMM_WORLD);
37 std::time_t result = std::time(
nullptr);
38 std::string timestamp = std::asctime(std::localtime(&result));
39 comm->Bcast(timestamp, 0);
40 auto tracer = std::make_shared<OTF2Tracer>(
"trace", timestamp);
43 pt.put(
"NumSamples_0", 10);
44 pt.put(
"NumSamples_1", 1);
45 pt.put(
"NumSamples_2", 1e2);
46 pt.put(
"NumSamples_3", 2e1);
47 pt.put(
"MCMC.BurnIn", 0);
48 pt.put(
"MLMCMC.Scheduling",
false);
49 pt.put(
"MLMCMC.Subsampling_0", 10);
50 pt.put(
"MLMCMC.Subsampling_1", 1);
51 pt.put(
"MLMCMC.Subsampling_2", 3);
52 pt.put(
"MLMCMC.Subsampling_3", 0);
55 auto componentFactory = std::make_shared<MyMIComponentFactory>(pt);
56 StaticLoadBalancingMIMCMC parallelMIMCMC (pt, componentFactory, std::make_shared<RoundRobinStaticLoadBalancer>(), comm, tracer);
58 if (comm->GetRank() == 0) {
60 Eigen::VectorXd meanQOI = parallelMIMCMC.
GetQOIs()->Mean();
61 std::cout <<
"mean QOI: " << meanQOI.transpose() << std::endl;
63 parallelMIMCMC.
WriteToFile(
"FullParallelGaussianSampling.h5");
int main(int argc, char **argv)
virtual std::shared_ptr< SampleCollection > Run(std::vector< Eigen::VectorXd > const &x0=std::vector< Eigen::VectorXd >())
A parallel MIMCMC method.
void Finalize()
Cleanup parallel method, wait for all ranks to finish.
void WriteToFile(std::string filename)
virtual std::shared_ptr< SampleCollection > GetQOIs() const
Dummy implementation; required by interface, has no meaning in ML/MI setting.