Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
KiT-RT
KiT-RT
Commits
be4b3508
Commit
be4b3508
authored
Feb 16, 2021
by
Steffen Schotthöfer
Browse files
Data generator parallelized
parent
732856ab
Pipeline
#135449
passed with stage
in 17 minutes and 58 seconds
Changes
2
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
code/input/exampleDataGen.cfg
View file @
be4b3508
...
...
@@ -7,7 +7,7 @@
%
% ---- Global settings ----
DATA_GENERATOR_MODE = YES
TRAINING_SET_SIZE =
10
00
TRAINING_SET_SIZE =
5
00
MAX_VALUE_FIRST_MOMENT = 20
REALIZABLE_SET_EPSILON_U0 = 0.05
REALIZABLE_SET_EPSILON_U1 = 0.97
...
...
code/src/toolboxes/datagenerator.cpp
View file @
be4b3508
...
...
@@ -153,9 +153,8 @@ void nnDataGenerator::SampleSolutionU() {
// --- sample u in order 0 ---
// u_0 = <1*psi>
//
#pragma omp parallel for schedule( guided )
#pragma omp parallel for schedule( guided )
for
(
unsigned
long
idx_set
=
0
;
idx_set
<
_gridSize
;
idx_set
++
)
{
Vector
u1
=
{
0
,
0
,
0
};
unsigned
long
outerIdx
=
(
idx_set
-
1
)
*
(
idx_set
)
/
2
;
// sum over all radii up to current
outerIdx
*=
nq
;
// in each radius step, use all quad points
...
...
@@ -221,16 +220,16 @@ void nnDataGenerator::SampleSolutionU() {
}
void
nnDataGenerator
::
ComputeEntropyH_dual
()
{
#pragma omp parallel for schedule( guided )
for
(
unsigned
idx_set
=
0
;
idx_set
<
_setSize
;
idx_set
++
)
{
_hEntropy
[
idx_set
]
=
_optimizer
->
ComputeObjFunc
(
_alpha
[
idx_set
],
_uSol
[
idx_set
],
_moments
);
}
}
void
nnDataGenerator
::
ComputeEntropyH_primal
()
{
double
result
=
0.0
;
#pragma omp parallel for schedule( guided )
for
(
unsigned
idx_set
=
0
;
idx_set
<
_setSize
;
idx_set
++
)
{
result
=
0.0
;
double
result
=
0.0
;
// Integrate (eta(eta'_*(alpha*m))
for
(
unsigned
idx_quad
=
0
;
idx_quad
<
_nq
;
idx_quad
++
)
{
result
+=
_entropy
->
Entropy
(
_entropy
->
EntropyPrimeDual
(
dot
(
_alpha
[
idx_set
],
_moments
[
idx_quad
]
)
)
)
*
_weights
[
idx_quad
];
...
...
@@ -268,9 +267,10 @@ void nnDataGenerator::PrintTrainingData() {
void
nnDataGenerator
::
CheckRealizability
()
{
double
epsilon
=
_settings
->
GetRealizableSetEpsilonU0
();
if
(
_LMaxDegree
==
1
)
{
double
normU1
=
0.0
;
Vector
u1
(
3
,
0.0
);
#pragma omp parallel for schedule( guided )
for
(
unsigned
idx_set
=
0
;
idx_set
<
_setSize
;
idx_set
++
)
{
double
normU1
=
0.0
;
Vector
u1
(
3
,
0.0
);
if
(
_uSol
[
idx_set
][
0
]
<
epsilon
)
{
if
(
std
::
abs
(
_uSol
[
idx_set
][
1
]
)
>
0
||
std
::
abs
(
_uSol
[
idx_set
][
2
]
)
>
0
||
std
::
abs
(
_uSol
[
idx_set
][
3
]
)
>
0
)
{
ErrorMessages
::
Error
(
"Moment not realizable [code 0]. Values: ("
+
std
::
to_string
(
_uSol
[
idx_set
][
0
]
)
+
"|"
+
...
...
@@ -303,6 +303,7 @@ void nnDataGenerator::CheckRealizability() {
}
void
nnDataGenerator
::
ComputeRealizableSolution
()
{
#pragma omp parallel for schedule( guided )
for
(
unsigned
idx_sol
=
0
;
idx_sol
<
_setSize
;
idx_sol
++
)
{
double
entropyReconstruction
=
0.0
;
_uSol
[
idx_sol
]
=
0
;
...
...
jannick.wolters
@jm2154
mentioned in commit
394af8a5
·
Apr 30, 2021
mentioned in commit
394af8a5
mentioned in commit 394af8a5da5fb7a95f004c4f3f019f8ce788fcba
Toggle commit list
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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