-
Notifications
You must be signed in to change notification settings - Fork 49
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
feat[cartesian]: Specify compiler optimization level and flags via env variables #1491
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a test that illustrates using the feature. Not sure if removing debug_mode
is a good idea.
Adding @egparedes and @FlorianDeconinck for more opinions. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
|
||
mode_flags = ["-O0", "-ggdb"] if debug_mode else ["-O3", "-DNDEBUG"] | ||
mode_flags = [f"-O{opt_level}", "-DNDEBUG", *extra_opt_flags.split()] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@havogt On (my) mac, the flag -DNDEBUG
is required to make compilation works with any optimization level, so I hardcoded it into mode_flags
for the sake of convenience. If you prefer, we could be more flexible:
mode_flags = [f"-O{opt_level}", "-DNDEBUG", *extra_opt_flags.split()] | |
mode_flags = [f"-O{opt_level}"] | |
if extra_opt_flags != "": | |
mode_flags += [*extra_opt_flags.split()] | |
elif opt_level == "0": | |
mode_flags.append("-ggdb") | |
else: | |
mode_flags.append("-DNDEBUG") |
cscs-ci run |
Description
This PR allows downstream applications to specify compiler optimization level and flags on a stencil basis.
Requirements
If this PR contains code authored by new contributors please make sure:
AUTHORS.md
file adding the names of all the new contributors.