Commit fbb65fa2 authored by niklas.baumgarten's avatar niklas.baumgarten
Browse files

first parallel mc methods are running

parent a64346c0
...@@ -7,6 +7,7 @@ void MonteCarlo::Method() { ...@@ -7,6 +7,7 @@ void MonteCarlo::Method() {
vout(1) << "M=" << ctr.M << " dM=" << ctr.dM << " dMComm=" << ctr.dMComm << endl; vout(1) << "M=" << ctr.M << " dM=" << ctr.dM << " dMComm=" << ctr.dMComm << endl;
method(); method();
ctr.Update(); ctr.Update();
sums.UpdateParallel(ctr);
avgs.Update(sums, ctr.M); avgs.Update(sums, ctr.M);
vars.Update(avgs); vars.Update(avgs);
kurtosis.Update(avgs, vars); kurtosis.Update(avgs, vars);
...@@ -19,9 +20,8 @@ void MonteCarlo::Method() { ...@@ -19,9 +20,8 @@ void MonteCarlo::Method() {
void MonteCarlo::method() { void MonteCarlo::method() {
SampleSolution coarseSolution(pdeSolver->MGraphs(), coarseId); SampleSolution coarseSolution(pdeSolver->MGraphs(), coarseId);
SampleSolution fineSolution(pdeSolver->MGraphs(), fineId); SampleSolution fineSolution(pdeSolver->MGraphs(), fineId);
// int m = ctr.M + ctr.dMComm * PPM->Proc(0); int m = ctr.M + ctr.dMComm * PPM->Proc(0);
// for (; m < ctr.M + ctr.dMComm * PPM->Proc(0) + ctr.dMComm; m++) { for (; m < ctr.M + ctr.dMComm * PPM->Proc(0) + ctr.dMComm; m++) {
for (int m = ctr.M; m < ctr.M + ctr.dMComm; m++) {
computeSampleSolution(m, fineId, fineSolution); computeSampleSolution(m, fineId, fineSolution);
if (onlyFine) coarseSolution.Init(); if (onlyFine) coarseSolution.Init();
else computeSampleSolution(m, coarseId, coarseSolution); else computeSampleSolution(m, coarseId, coarseSolution);
......
...@@ -15,6 +15,8 @@ protected: ...@@ -15,6 +15,8 @@ protected:
bool onlyFine = false; bool onlyFine = false;
bool parallel = true;
Level level; Level level;
Meshes *meshes; Meshes *meshes;
...@@ -43,7 +45,7 @@ public: ...@@ -43,7 +45,7 @@ public:
MonteCarlo(Level level, int dM, bool onlyFine) : MonteCarlo(Level level, int dM, bool onlyFine) :
level(level), level(level),
onlyFine(onlyFine), onlyFine(onlyFine),
ctr(SampleCounter(dM)), ctr(SampleCounter(dM, parallel)),
pdeSolverCreator(PDESolverCreator()), pdeSolverCreator(PDESolverCreator()),
meshesCreator(MeshesCreator(pdeSolverCreator.GetMeshName()). meshesCreator(MeshesCreator(pdeSolverCreator.GetMeshName()).
WithCommSplit(ctr.commSplit). WithCommSplit(ctr.commSplit).
...@@ -55,7 +57,7 @@ public: ...@@ -55,7 +57,7 @@ public:
MonteCarlo(Level level, int dM, bool onlyFine, MonteCarlo(Level level, int dM, bool onlyFine,
MeshesCreator meshesCreator, PDESolverCreator pdeCreator) : MeshesCreator meshesCreator, PDESolverCreator pdeCreator) :
level(level), level(level),
ctr(SampleCounter(dM)), ctr(SampleCounter(dM, parallel)),
onlyFine(onlyFine), onlyFine(onlyFine),
pdeSolverCreator(pdeCreator), pdeSolverCreator(pdeCreator),
meshesCreator(meshesCreator) { meshesCreator(meshesCreator) {
...@@ -65,6 +67,7 @@ public: ...@@ -65,6 +67,7 @@ public:
void Init() { void Init() {
config.get("MCPlotting", plotting); config.get("MCPlotting", plotting);
config.get("MCVerbose", verbose); config.get("MCVerbose", verbose);
config.get("MCParallel", parallel);
meshes = meshesCreator.Create(); meshes = meshesCreator.Create();
pdeSolver = pdeSolverCreator.Create(*meshes); pdeSolver = pdeSolverCreator.Create(*meshes);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment