Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Mpp
MLUQ
Commits
fbb65fa2
Commit
fbb65fa2
authored
Jan 28, 2021
by
niklas.baumgarten
Browse files
first parallel mc methods are running
parent
a64346c0
Changes
2
Hide whitespace changes
Inline
Side-by-side
mlmc/src/montecarlo/MonteCarlo.cpp
View file @
fbb65fa2
...
@@ -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
);
...
...
mlmc/src/montecarlo/MonteCarlo.hpp
View file @
fbb65fa2
...
@@ -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
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment