Skip to content

Commit 690b81a

Browse files
authored
Merge pull request #2046 from su2code/hybrid_parallel_ad_fixes
Hybrid Parallel AD Fixes
2 parents 7f36c83 + 3113d70 commit 690b81a

4 files changed

Lines changed: 8 additions & 4 deletions

File tree

Common/include/basic_types/ad_structure.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,9 @@ FORCEINLINE void SetIndex(int& index, const su2double& data) { index = data.getI
381381
// WARNING: For performance reasons, this method does not perform bounds checking.
382382
// When using it, please ensure sufficient adjoint vector size by a call to AD::ResizeAdjoints().
383383
FORCEINLINE void SetDerivative(int index, const double val) {
384+
if (index == 0) // Allow multiple threads to "set the derivative" of passive variables without causing data races.
385+
return;
386+
384387
using BoundsChecking = codi::GradientAccessTapeInterface<su2double::Gradient, su2double::Identifier>::BoundsChecking;
385388
AD::getTape().setGradient(index, val, BoundsChecking::False);
386389
}

SU2_CFD/src/solvers/CSolver.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4045,6 +4045,7 @@ void CSolver::SetVertexTractionsAdjoint(CGeometry *geometry, const CConfig *conf
40454045

40464046
unsigned short iMarker, iDim;
40474047
unsigned long iVertex, iPoint;
4048+
int index;
40484049

40494050
/*--- Loop over all the markers ---*/
40504051
for (iMarker = 0; iMarker < config->GetnMarker_All(); iMarker++) {
@@ -4064,8 +4065,8 @@ void CSolver::SetVertexTractionsAdjoint(CGeometry *geometry, const CConfig *conf
40644065

40654066
/*--- Set the adjoint of the vertex traction from the value received ---*/
40664067
for (iDim = 0; iDim < nDim; iDim++) {
4067-
SU2_TYPE::SetDerivative(VertexTraction[iMarker][iVertex][iDim],
4068-
SU2_TYPE::GetValue(VertexTractionAdjoint[iMarker][iVertex][iDim]));
4068+
AD::SetIndex(index, VertexTraction[iMarker][iVertex][iDim]);
4069+
AD::SetDerivative(index, SU2_TYPE::GetValue(VertexTractionAdjoint[iMarker][iVertex][iDim]));
40694070
}
40704071
}
40714072
END_SU2_OMP_FOR

externals/opdi

meson_scripts/init.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def init_submodules(
5858
github_repo_codi = "https://github.com/scicompkl/CoDiPack"
5959
sha_version_medi = "aafc2d1966ba1233640af737e71c77c1a86183fd"
6060
github_repo_medi = "https://github.com/SciCompKL/MeDiPack"
61-
sha_version_opdi = "3ff7bb16bd70aa8f74277704b5feccaaaf6838bd"
61+
sha_version_opdi = "913535c490989ea9aa654e8c7df41c7e3718a5a2"
6262
github_repo_opdi = "https://github.com/SciCompKL/OpDiLib"
6363
sha_version_meson = "41c650a040d50e0912d268af7a903a9ce1456dfa"
6464
github_repo_meson = "https://github.com/mesonbuild/meson"

0 commit comments

Comments
 (0)