Fix SU2 initialization when using the python wrapper by jblueh · Pull Request #1966 · su2code/SU2 · GitHub
Skip to content

Fix SU2 initialization when using the python wrapper#1966

Merged
jblueh merged 16 commits into
developfrom
fix_init_functions
Mar 17, 2023
Merged

Fix SU2 initialization when using the python wrapper#1966
jblueh merged 16 commits into
developfrom
fix_init_functions

Conversation

@jblueh

@jblueh jblueh commented Mar 15, 2023

Copy link
Copy Markdown
Contributor

Proposed Changes

The python wrapper instantiates drivers directly. To ensure that SU2 is initialized properly, also if used from python, some initialization code is already placed in the driver constructor. This PR moves additional initialization code to the driver constructor.

Related Work

This came up during #1903.

PR Checklist

  • I am submitting my contribution to the develop branch.
  • My contribution generates no new compiler warnings (try with --warnlevel=3 when using meson).
  • My contribution is commented and consistent with SU2 style (https://su2code.github.io/docs_v7/Style-Guide/).
  • 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.

@jblueh

jblueh commented Mar 15, 2023

Copy link
Copy Markdown
Contributor Author

@pcarruscag pcarruscag changed the title [WIP] Fix SU2 initialization when using the python wrapper Fix SU2 initialization when using the python wrapper Mar 15, 2023

@pcarruscag pcarruscag left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks 👍 LGTM

@jblueh

jblueh commented Mar 15, 2023

Copy link
Copy Markdown
Contributor Author

Thanks for your approval @pcarruscag. Could I have your opinion on the questions? E.g., I could add 2. as part of this PR, now that I already looked into it.

@pcarruscag

Copy link
Copy Markdown
Member

Ah sorry,
SU2_DOT mostly only uses OpenMP in the passive linear system, I'm not sure if @thomasdick Sobolev smoother has some recorded part that involves OpenMP.
For the python wrapper I usually set the number of threads with env var OMP_NUM_THREADS It may be a bit confusing for most users having to specify the number of threads when instantiating the driver 🤔
I think disc_adj_flow would be the easiest to adapt. Those tests print a sensitivity at a particular vertex of a marker to be checked by the regression script, so you would have to make sure that's only printed on one rank (for parallel AD).
disc_adj_fea should also be fine for hybrid AD.

@jblueh

jblueh commented Mar 16, 2023

Copy link
Copy Markdown
Contributor Author

Comment thread TestCases/py_wrapper/disc_adj_fea/flow_load_sens/run_adjoint.py
Comment thread TestCases/hybrid_regression_AD.py
@jblueh jblueh merged commit 316ef59 into develop Mar 17, 2023
@jblueh jblueh deleted the fix_init_functions branch March 17, 2023 14:15
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