Skip to content

Commit

Permalink
Merge pull request #2092 from su2code/preacc_performance
Browse files Browse the repository at this point in the history
Improve parallel preacc performance
  • Loading branch information
pcarruscag authored Jul 26, 2023
2 parents 7d0cd31 + a9a7ad8 commit 53563d9
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 8 deletions.
6 changes: 2 additions & 4 deletions Common/include/basic_types/ad_structure.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -384,16 +384,14 @@ 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);
AD::getTape().setGradient(index, val, codi::AdjointsManagement::Manual);
}

// WARNING: For performance reasons, this method does not perform bounds checking.
// If called after tape evaluations, the adjoints should exist.
// Otherwise, please ensure sufficient adjoint vector size by a call to AD::ResizeAdjoints().
FORCEINLINE double GetDerivative(int index) {
using BoundsChecking = codi::GradientAccessTapeInterface<su2double::Gradient, su2double::Identifier>::BoundsChecking;
return AD::getTape().getGradient(index, BoundsChecking::False);
return AD::getTape().getGradient(index, codi::AdjointsManagement::Manual);
}

FORCEINLINE bool IsIdentifierActive(su2double const& value) {
Expand Down
2 changes: 1 addition & 1 deletion externals/codi
Submodule codi updated 40 files
+7 −1 Makefile
+9 −0 documentation/Changelog.md
+1 −0 documentation/CoDiLayout.xml
+6 −6 documentation/developer/simpleTape.cpp
+62 −0 documentation/examples/Example_24_Enzyme_external_function_helper.cpp
+12 −0 documentation/examples/Example_24_Enzyme_external_function_helper.md
+1 −0 documentation/user/Tutorials.md
+3 −0 documentation/user/TutorialsGraph.dot
+4 −0 include/codi.hpp
+8 −0 include/codi/config.h
+21 −21 include/codi/tapes/commonTapeImplementation.hpp
+22 −6 include/codi/tapes/forwardEvaluation.hpp
+4 −1 include/codi/tapes/interfaces/customAdjointVectorEvaluationTapeInterface.hpp
+10 −2 include/codi/tapes/interfaces/dataManagementTapeInterface.hpp
+16 −4 include/codi/tapes/interfaces/forwardEvaluationTapeInterface.hpp
+14 −24 include/codi/tapes/interfaces/gradientAccessTapeInterface.hpp
+24 −5 include/codi/tapes/interfaces/positionalEvaluationTapeInterface.hpp
+19 −6 include/codi/tapes/interfaces/preaccumulationEvaluationTapeInterface.hpp
+23 −5 include/codi/tapes/interfaces/reverseTapeInterface.hpp
+51 −27 include/codi/tapes/jacobianBaseTape.hpp
+10 −1 include/codi/tapes/jacobianLinearTape.hpp
+9 −3 include/codi/tapes/jacobianReuseTape.hpp
+5 −8 include/codi/tapes/misc/internalAdjointsInterface.hpp
+31 −0 include/codi/tapes/misc/tapeParameters.hpp
+0 −1 include/codi/tapes/misc/threadSafeGlobalAdjoints.hpp
+58 −25 include/codi/tapes/primalValueBaseTape.hpp
+6 −1 include/codi/tapes/primalValueLinearTape.hpp
+6 −1 include/codi/tapes/primalValueReuseTape.hpp
+36 −38 include/codi/tools/algorithms.hpp
+3 −1 include/codi/tools/helpers/customAdjointVectorHelper.hpp
+166 −0 include/codi/tools/helpers/enzymeExternalFunctionHelper.hpp
+145 −61 include/codi/tools/helpers/externalFunctionHelper.hpp
+9 −2 include/codi/tools/helpers/preaccumulationHelper.hpp
+17 −5 tests/general/Makefile
+65 −63 tests/general/Makefile.drivers
+1 −0 tests/general/include/tests/allTests.hpp
+80 −0 tests/general/include/tests/tools/helpers/testEnzymeExternalFunctionHelper.hpp
+2 −0 tests/general/results/deriv0th/EnzymeExternalFunctionHelper.out
+3 −0 tests/general/results/deriv1st/EnzymeExternalFunctionHelper.out
+5 −0 tests/general/results/deriv2nd/EnzymeExternalFunctionHelper.out
2 changes: 1 addition & 1 deletion externals/opdi
Submodule opdi updated 126 files
4 changes: 2 additions & 2 deletions meson_scripts/init.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,11 @@ def init_submodules(

# This information of the modules is used if projects was not cloned using git
# The sha tag must be maintained manually to point to the correct commit
sha_version_codi = "4237fe38c90b83541f699bd84e00c656099b7d18"
sha_version_codi = "17232fed05245dbb8f04a31e274a02d53458c75c"
github_repo_codi = "https://github.com/scicompkl/CoDiPack"
sha_version_medi = "aafc2d1966ba1233640af737e71c77c1a86183fd"
github_repo_medi = "https://github.com/SciCompKL/MeDiPack"
sha_version_opdi = "913535c490989ea9aa654e8c7df41c7e3718a5a2"
sha_version_opdi = "c42cca71a3d0b44fb482e268ecd40b623e71776b"
github_repo_opdi = "https://github.com/SciCompKL/OpDiLib"
sha_version_meson = "41c650a040d50e0912d268af7a903a9ce1456dfa"
github_repo_meson = "https://github.com/mesonbuild/meson"
Expand Down

0 comments on commit 53563d9

Please sign in to comment.