Commit be4b3508 authored by Steffen Schotthöfer's avatar Steffen Schotthöfer
Browse files

Data generator parallelized

parent 732856ab
Pipeline #135449 passed with stage
in 17 minutes and 58 seconds
......@@ -7,7 +7,7 @@
%
% ---- Global settings ----
DATA_GENERATOR_MODE = YES
TRAINING_SET_SIZE = 1000
TRAINING_SET_SIZE = 500
MAX_VALUE_FIRST_MOMENT = 20
REALIZABLE_SET_EPSILON_U0 = 0.05
REALIZABLE_SET_EPSILON_U1 = 0.97
......
......@@ -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;
......
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