Reduce the tapeing overhead in CFVMFlowSolverBase.inl. #2528
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Proposed Changes
The current solution to fix the problem in SU2_CFD/include/solvers/CFVMFlowSolverBase.inl for preaccumulation is not optimal.
The
AD::GetValuecalls will disable the dependency onomegaMaxbut the computation of the norm will be taped. Making the tape passive will remove this overhead.Analysis of the previous error (before the tape recording debug mode)
The code:
In line 48 and 49
strainMaxandomegaMaxare assigned. They get a CoDiPack id and foromegaMaxsome statements are recorded. In line 51 the preaccumulation is finished. This removes the statements for the computation ofomegaMax. Nevertheless, the ids for these variables are still there. They have now an invalid id and this id will be given to a completely random other variable. If these variables are not used, then this would not be a problem. After the loop in line 57 and 58 they are used, which creates a random link in the tape, which can have arbitrary consequences. So we have a real bug here in SU2_CFD_AD.In the new Version this bug does no longer exist but the overhead of the computation of the norm is now recorded.
Analysis of the fluctuation in test disc_adj_fsi
I wanted to analyze what is going wrong. On my machine, I get a good result with optimized binaries. I get a wrong result with debug binaries. So there seems something else going on in this test case.
PR Checklist
Put an X by all that apply. You can fill this out after submitting the PR. If you have any questions, don't hesitate to ask! We want to help. These are a guide for you to know what the reviewers will be looking for in your contribution.
pre-commit run --allto format old commits.