Skip to content

Commit 19e200e

Browse files
committed
avoid some weirdness with "parallel if"
1 parent a37a609 commit 19e200e

1 file changed

Lines changed: 14 additions & 7 deletions

File tree

Common/src/linear_algebra/CSysSolve.cpp

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -467,9 +467,14 @@ unsigned long CSysSolve<ScalarType>::FGMRES_LinSolver(const CSysVector<ScalarTyp
467467

468468
/*--- Modified Gram-Schmidt orthogonalization ---*/
469469

470-
SU2_OMP_PARALLEL_(if (nestedParallel))
471-
ModGramSchmidt(nestedParallel, i, H, W);
472-
END_SU2_OMP_PARALLEL
470+
if (nestedParallel) {
471+
/*--- "omp parallel if" does not work well here ---*/
472+
SU2_OMP_PARALLEL
473+
ModGramSchmidt(true, i, H, W);
474+
END_SU2_OMP_PARALLEL
475+
} else {
476+
ModGramSchmidt(false, i, H, W);
477+
}
473478

474479
/*--- Apply old Givens rotations to new column of the Hessenberg matrix then generate the
475480
new Givens rotation matrix and apply it to the last two elements of H[:][i] and g ---*/
@@ -497,11 +502,13 @@ unsigned long CSysSolve<ScalarType>::FGMRES_LinSolver(const CSysVector<ScalarTyp
497502

498503
const auto& basis = flexible ? Z : W;
499504

500-
SU2_OMP_PARALLEL_(if (nestedParallel))
501-
for (unsigned long k = 0; k < i; k++) {
502-
x += y[k] * basis[k];
505+
if (nestedParallel) {
506+
SU2_OMP_PARALLEL
507+
for (unsigned long k = 0; k < i; k++) x += y[k] * basis[k];
508+
END_SU2_OMP_PARALLEL
509+
} else {
510+
for (unsigned long k = 0; k < i; k++) x += y[k] * basis[k];
503511
}
504-
END_SU2_OMP_PARALLEL
505512

506513
/*--- Recalculate final (neg.) residual (this should be optional) ---*/
507514

0 commit comments

Comments
 (0)