MUQ  0.4.3
FullParallelMultiindexGaussianSampling.cpp
Go to the documentation of this file.
4 
7 
13 
15 
16 #include <boost/property_tree/ptree.hpp>
17 
18 namespace pt = boost::property_tree;
19 using namespace muq::Modeling;
20 using namespace muq::SamplingAlgorithms;
21 using namespace muq::Utilities;
22 
25 
26 #include "ParallelProblem.h"
27 
28 
29 int main(int argc, char **argv){
30 
31  spdlog::set_level(spdlog::level::debug);
32 
33  MPI_Init(&argc, &argv);
34 
35  pt::ptree pt;
36  pt.put("NumSamples_0_0", 1e3);
37  pt.put("NumSamples_0_1", 5e2);
38  pt.put("NumSamples_0_2", 1e2);
39  pt.put("NumSamples_1_0", 5e2);
40  pt.put("NumSamples_1_1", 5e2);
41  pt.put("NumSamples_1_2", 1e2);
42  pt.put("NumSamples_2_0", 1e2);
43  pt.put("NumSamples_2_1", 1e2);
44  pt.put("NumSamples_2_2", 1e2);
45  pt.put("MCMC.BurnIn", 1e1);
46  pt.put("MLMCMC.Subsampling_0_0", 5);
47  pt.put("MLMCMC.Subsampling_0_1", 5);
48  pt.put("MLMCMC.Subsampling_0_2", 5);
49  pt.put("MLMCMC.Subsampling_1_0", 5);
50  pt.put("MLMCMC.Subsampling_1_1", 5);
51  pt.put("MLMCMC.Subsampling_1_2", 5);
52  pt.put("MLMCMC.Subsampling_2_0", 5);
53  pt.put("MLMCMC.Subsampling_2_1", 5);
54  pt.put("MLMCMC.Subsampling_2_2", 5);
55  pt.put("MLMCMC.Scheduling", true);
56 
57  auto comm = std::make_shared<parcer::Communicator>(MPI_COMM_WORLD);
58 
59 
60  auto componentFactory = std::make_shared<MyMIComponentFactory>(pt);
61  StaticLoadBalancingMIMCMC parallelMIMCMC (pt, componentFactory);
62 
63  // if (comm->GetRank() == 0) {
64  // spdlog::info("Starting parallel run");
65  // parallelMIMCMC.Run();
66  // spdlog::info("Parallel run finished");
67  // Eigen::VectorXd meanQOI = parallelMIMCMC.GetQOIs()->Mean();
68  // std::cout << "mean QOI: " << meanQOI.transpose() << std::endl;
69  // }
70  parallelMIMCMC.Finalize();
71 
72  MPI_Finalize();
73 }
int main(int argc, char **argv)
void Finalize()
Cleanup parallel method, wait for all ranks to finish.