Skip to content

Conversation

@pcarruscag
Copy link
Member

@pcarruscag pcarruscag commented Jan 11, 2021

Proposed Changes

On the RANS onera m6 case (43k hex grid) the tape for the geometric recording becomes 13% smaller by:

  • Computing element CG's together with their contributions to the dual volumes and edge normal vectors;
  • Using preaccumulation "per element" instead of for each of the individual computations done for each element.

On the hybrid grid for the same geometry we have in TestCases the reduction is 32%.

Some additional memory reduction is achieved by not storing the primal element face CG's and the edge CG's, these are only needed when building dual volumes and they are easy to recompute with the data already accessed where they are currently needed.

Related Work

#594

PR Checklist

  • I am submitting my contribution to the develop branch.
  • My contribution generates no new compiler warnings (try with the '-Wall -Wextra -Wno-unused-parameter -Wno-empty-body' compiler flags, or simply --warnlevel=2 when using meson).
  • My contribution is commented and consistent with SU2 style.
  • I have added a test case that demonstrates my contribution, if necessary.
  • I have updated appropriate documentation (Tutorials, Docs Page, config_template.cpp) , if necessary.

@pcarruscag pcarruscag changed the title [WIP] Reduce discrete adjoint memory usage Reduce discrete adjoint memory usage ~10% Jan 12, 2021
@pcarruscag pcarruscag marked this pull request as ready for review January 12, 2021 17:03
Copy link
Contributor

@WallyMaier WallyMaier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pcarruscag, this looks good to me! The code looks much cleaner, and bloated!

/*--- Access the sub-volume of the element separately in 2D or 3D. ---*/

su2double Volume_i, Volume_j;
switch (nDim) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This may be a dumb question, but what motivates a switch here versus and if/else statement?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True, I'll change it there too.
To me a switch is useful to pick one out of many, it is also a good bug prevention tool for enumerator types as the compiler will warn if you forget to cover all the enum options (we convert our enum types to unsigned short which disables those warnings unfortunately).

@pcarruscag pcarruscag changed the title Reduce discrete adjoint memory usage ~10% Reduce discrete adjoint memory usage ~25% Jan 12, 2021
Comment on lines -135 to -136
/*--- Compute the limiter in case we need it in the turbulence model or to limit the
* viscous terms (check this logic with JST and 2nd order turbulence model) ---*/
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried to do what this comment had been asking (for quite some time), because I think it was possible to make the solver do unnecessary work e.g. compute limiters and reconstruction gradients for centered schemes.
Also there was some mixing between flow and continuous adjoint options, which looking at the adjoint solvers code seemed redundant (it never uses the flow solver limiter for example). The regressions seem to agree.

I tested the main changes of this PR on some 3D problems and all seems fine, so I'll merge this soon for the next release.

@pcarruscag pcarruscag merged commit 05e8574 into develop Jan 17, 2021
@pcarruscag pcarruscag deleted the reduce_disc_adj_mem branch January 17, 2021 09:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants