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() {
vout(1) << "M=" << ctr.M << " dM=" << ctr.dM << " dMComm=" << ctr.dMComm << endl;
method();
ctr.Update();
sums.UpdateParallel(ctr);
avgs.Update(sums, ctr.M);
vars.Update(avgs);
kurtosis.Update(avgs, vars);
......@@ -19,9 +20,8 @@ void MonteCarlo::Method() {
void MonteCarlo::method() {
SampleSolution coarseSolution(pdeSolver->MGraphs(), coarseId);
SampleSolution fineSolution(pdeSolver->MGraphs(), fineId);
// int m = ctr.M + ctr.dMComm * PPM->Proc(0);
// for (; m < ctr.M + ctr.dMComm * PPM->Proc(0) + ctr.dMComm; m++) {
for (int m = ctr.M; m < ctr.M + ctr.dMComm; m++) {
int m = ctr.M + ctr.dMComm * PPM->Proc(0);
for (; m < ctr.M + ctr.dMComm * PPM->Proc(0) + ctr.dMComm; m++) {
computeSampleSolution(m, fineId, fineSolution);
if (onlyFine) coarseSolution.Init();
else computeSampleSolution(m, coarseId, coarseSolution);
......
......@@ -15,6 +15,8 @@ protected:
bool onlyFine = false;
bool parallel = true;
Level level;
Meshes *meshes;
......@@ -43,7 +45,7 @@ public:
MonteCarlo(Level level, int dM, bool onlyFine) :
level(level),
onlyFine(onlyFine),
ctr(SampleCounter(dM)),
ctr(SampleCounter(dM, parallel)),
pdeSolverCreator(PDESolverCreator()),
meshesCreator(MeshesCreator(pdeSolverCreator.GetMeshName()).
WithCommSplit(ctr.commSplit).
......@@ -55,7 +57,7 @@ public:
MonteCarlo(Level level, int dM, bool onlyFine,
MeshesCreator meshesCreator, PDESolverCreator pdeCreator) :
level(level),
ctr(SampleCounter(dM)),
ctr(SampleCounter(dM, parallel)),
onlyFine(onlyFine),
pdeSolverCreator(pdeCreator),
meshesCreator(meshesCreator) {
......@@ -65,6 +67,7 @@ public:
void Init() {
config.get("MCPlotting", plotting);
config.get("MCVerbose", verbose);
config.get("MCParallel", parallel);
meshes = meshesCreator.Create();
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