Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hybrid Parallel AD Fixes #2046

Merged
merged 3 commits into from
May 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Common/include/basic_types/ad_structure.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,9 @@ FORCEINLINE void SetIndex(int& index, const su2double& data) { index = data.getI
// WARNING: For performance reasons, this method does not perform bounds checking.
// When using it, please ensure sufficient adjoint vector size by a call to AD::ResizeAdjoints().
FORCEINLINE void SetDerivative(int index, const double val) {
if (index == 0) // Allow multiple threads to "set the derivative" of passive variables without causing data races.
return;

using BoundsChecking = codi::GradientAccessTapeInterface<su2double::Gradient, su2double::Identifier>::BoundsChecking;
AD::getTape().setGradient(index, val, BoundsChecking::False);
}
Expand Down
5 changes: 3 additions & 2 deletions SU2_CFD/src/solvers/CSolver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4045,6 +4045,7 @@ void CSolver::SetVertexTractionsAdjoint(CGeometry *geometry, const CConfig *conf

unsigned short iMarker, iDim;
unsigned long iVertex, iPoint;
int index;

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

/*--- Set the adjoint of the vertex traction from the value received ---*/
for (iDim = 0; iDim < nDim; iDim++) {
SU2_TYPE::SetDerivative(VertexTraction[iMarker][iVertex][iDim],
SU2_TYPE::GetValue(VertexTractionAdjoint[iMarker][iVertex][iDim]));
AD::SetIndex(index, VertexTraction[iMarker][iVertex][iDim]);
AD::SetDerivative(index, SU2_TYPE::GetValue(VertexTractionAdjoint[iMarker][iVertex][iDim]));
}
}
END_SU2_OMP_FOR
Expand Down
2 changes: 1 addition & 1 deletion externals/opdi
2 changes: 1 addition & 1 deletion meson_scripts/init.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def init_submodules(
github_repo_codi = "/~https://github.com/scicompkl/CoDiPack"
sha_version_medi = "aafc2d1966ba1233640af737e71c77c1a86183fd"
github_repo_medi = "/~https://github.com/SciCompKL/MeDiPack"
sha_version_opdi = "3ff7bb16bd70aa8f74277704b5feccaaaf6838bd"
sha_version_opdi = "913535c490989ea9aa654e8c7df41c7e3718a5a2"
github_repo_opdi = "/~https://github.com/SciCompKL/OpDiLib"
sha_version_meson = "41c650a040d50e0912d268af7a903a9ce1456dfa"
github_repo_meson = "/~https://github.com/mesonbuild/meson"
Expand Down