Skip to content

Commit 028d1e0

Browse files
committed
Further shared reading optimizations.
1 parent fcc39ce commit 028d1e0

5 files changed

Lines changed: 38 additions & 0 deletions

File tree

SU2_CFD/include/solvers/CFVMFlowSolverBase.inl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1621,6 +1621,8 @@ void CFVMFlowSolverBase<V, FlowRegime>::SetResidual_DualTime(CGeometry *geometry
16211621

16221622
/*--- Loop over all nodes (excluding halos) ---*/
16231623

1624+
AD::StartNoSharedReading();
1625+
16241626
SU2_OMP_FOR_STAT(omp_chunk_size)
16251627
for (iPoint = 0; iPoint < nPointDomain; iPoint++) {
16261628

@@ -1656,6 +1658,8 @@ void CFVMFlowSolverBase<V, FlowRegime>::SetResidual_DualTime(CGeometry *geometry
16561658
}
16571659
END_SU2_OMP_FOR
16581660

1661+
AD::EndNoSharedReading();
1662+
16591663
}
16601664

16611665
else {
@@ -1733,6 +1737,8 @@ void CFVMFlowSolverBase<V, FlowRegime>::SetResidual_DualTime(CGeometry *geometry
17331737
/*--- Loop over all nodes (excluding halos) to compute the remainder
17341738
of the dual time-stepping source term. ---*/
17351739

1740+
AD::StartNoSharedReading();
1741+
17361742
SU2_OMP_FOR_STAT(omp_chunk_size)
17371743
for (iPoint = 0; iPoint < nPointDomain; iPoint++) {
17381744

@@ -1770,6 +1776,8 @@ void CFVMFlowSolverBase<V, FlowRegime>::SetResidual_DualTime(CGeometry *geometry
17701776
}
17711777
}
17721778
END_SU2_OMP_FOR
1779+
1780+
AD::EndNoSharedReading();
17731781
}
17741782

17751783
}

SU2_CFD/src/integration/CMultiGridIntegration.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -547,10 +547,12 @@ void CMultiGridIntegration::SetForcing_Term(CSolver *sol_fine, CSolver *sol_coar
547547

548548
void CMultiGridIntegration::SetResidual_Term(CGeometry *geometry, CSolver *solver) {
549549

550+
AD::StartNoSharedReading();
550551
SU2_OMP_FOR_STAT(roundUpDiv(geometry->GetnPointDomain(), omp_get_num_threads()))
551552
for (unsigned long iPoint = 0; iPoint < geometry->GetnPointDomain(); iPoint++)
552553
solver->LinSysRes.AddBlock(iPoint, solver->GetNodes()->GetResTruncError(iPoint));
553554
END_SU2_OMP_FOR
555+
AD::EndNoSharedReading();
554556

555557
}
556558

SU2_CFD/src/solvers/CIncEulerSolver.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2555,6 +2555,8 @@ void CIncEulerSolver::SetResidual_DualTime(CGeometry *geometry, CSolver **solver
25552555

25562556
/*--- Loop over all nodes (excluding halos) ---*/
25572557

2558+
AD::StartNoSharedReading();
2559+
25582560
SU2_OMP_FOR_STAT(omp_chunk_size)
25592561
for (iPoint = 0; iPoint < nPointDomain; iPoint++) {
25602562

@@ -2607,6 +2609,8 @@ void CIncEulerSolver::SetResidual_DualTime(CGeometry *geometry, CSolver **solver
26072609
}
26082610
}
26092611
END_SU2_OMP_FOR
2612+
2613+
AD::EndNoSharedReading();
26102614
}
26112615

26122616
else {
@@ -2694,6 +2698,8 @@ void CIncEulerSolver::SetResidual_DualTime(CGeometry *geometry, CSolver **solver
26942698
/*--- Loop over all nodes (excluding halos) to compute the remainder
26952699
of the dual time-stepping source term. ---*/
26962700

2701+
AD::StartNoSharedReading();
2702+
26972703
SU2_OMP_FOR_STAT(omp_chunk_size)
26982704
for (iPoint = 0; iPoint < nPointDomain; iPoint++) {
26992705

@@ -2749,6 +2755,8 @@ void CIncEulerSolver::SetResidual_DualTime(CGeometry *geometry, CSolver **solver
27492755
}
27502756
}
27512757
END_SU2_OMP_FOR
2758+
2759+
AD::EndNoSharedReading();
27522760
}
27532761

27542762
}

SU2_CFD/src/solvers/CSolver.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1929,6 +1929,8 @@ void CSolver::SetResidual_RMS(const CGeometry *geometry, const CConfig *config)
19291929

19301930
if (geometry->GetMGLevel() != MESH_0) return;
19311931

1932+
AD::StartNoSharedReading();
1933+
19321934
SU2_OMP_MASTER {
19331935

19341936
/*--- Set the L2 Norm residual in all the processors. ---*/
@@ -1985,12 +1987,16 @@ void CSolver::SetResidual_RMS(const CGeometry *geometry, const CConfig *config)
19851987
}
19861988
END_SU2_OMP_MASTER
19871989
SU2_OMP_BARRIER
1990+
1991+
AD::EndNoSharedReading();
19881992
}
19891993

19901994
void CSolver::SetResidual_BGS(const CGeometry *geometry, const CConfig *config) {
19911995

19921996
if (geometry->GetMGLevel() != MESH_0) return;
19931997

1998+
AD::StartNoSharedReading();
1999+
19942000
SU2_OMP_MASTER {
19952001

19962002
/*--- Set the L2 Norm residual in all the processors. ---*/
@@ -2028,6 +2034,8 @@ void CSolver::SetResidual_BGS(const CGeometry *geometry, const CConfig *config)
20282034
}
20292035
END_SU2_OMP_MASTER
20302036
SU2_OMP_BARRIER
2037+
2038+
AD::EndNoSharedReading();
20312039
}
20322040

20332041
void CSolver::SetRotatingFrame_GCL(CGeometry *geometry, const CConfig *config) {
@@ -4111,6 +4119,8 @@ void CSolver::ComputeResidual_Multizone(const CGeometry *geometry, const CConfig
41114119

41124120
SU2_OMP_PARALLEL {
41134121

4122+
AD::StartNoSharedReading();
4123+
41144124
/*--- Set Residuals to zero ---*/
41154125
SU2_OMP_MASTER
41164126
for (unsigned short iVar = 0; iVar < nVar; iVar++){
@@ -4152,6 +4162,8 @@ void CSolver::ComputeResidual_Multizone(const CGeometry *geometry, const CConfig
41524162
END_SU2_OMP_CRITICAL
41534163
SU2_OMP_BARRIER
41544164

4165+
AD::EndNoSharedReading();
4166+
41554167
SetResidual_BGS(geometry, config);
41564168

41574169
}

SU2_CFD/src/solvers/CTurbSolver.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -789,6 +789,8 @@ void CTurbSolver::SetResidual_DualTime(CGeometry *geometry, CSolver **solver_con
789789

790790
/*--- Loop over all nodes (excluding halos) ---*/
791791

792+
AD::StartNoSharedReading();
793+
792794
SU2_OMP_FOR_STAT(omp_chunk_size)
793795
for (iPoint = 0; iPoint < nPointDomain; iPoint++) {
794796

@@ -855,6 +857,8 @@ void CTurbSolver::SetResidual_DualTime(CGeometry *geometry, CSolver **solver_con
855857
}
856858
END_SU2_OMP_FOR
857859

860+
AD::EndNoSharedReading();
861+
858862
} else {
859863

860864
/*--- For unsteady flows on dynamic meshes (rigidly transforming or
@@ -955,6 +959,8 @@ void CTurbSolver::SetResidual_DualTime(CGeometry *geometry, CSolver **solver_con
955959
/*--- Loop over all nodes (excluding halos) to compute the remainder
956960
of the dual time-stepping source term. ---*/
957961

962+
AD::StartNoSharedReading();
963+
958964
SU2_OMP_FOR_STAT(omp_chunk_size)
959965
for (iPoint = 0; iPoint < nPointDomain; iPoint++) {
960966

@@ -1023,6 +1029,8 @@ void CTurbSolver::SetResidual_DualTime(CGeometry *geometry, CSolver **solver_con
10231029
}
10241030
END_SU2_OMP_FOR
10251031

1032+
AD::EndNoSharedReading();
1033+
10261034
} // end dynamic grid
10271035

10281036
}

0 commit comments

Comments
 (0)