Skip to content

fix|build[cartesian]: Fix NVCC default flags for -O0 and refactor configuration out of config.py#2524

Merged
romanc merged 2 commits intoGridTools:mainfrom
FlorianDeconinck:fix/gpu_compilation
Mar 12, 2026
Merged

fix|build[cartesian]: Fix NVCC default flags for -O0 and refactor configuration out of config.py#2524
romanc merged 2 commits intoGridTools:mainfrom
FlorianDeconinck:fix/gpu_compilation

Conversation

@FlorianDeconinck
Copy link
Contributor

Description

We introduced a bad behavior by forcing FMA deactivation in -O0 in #2520 by passing a flag to nvcc that isn't readable.

While fixing the above we also moved the entire configuration of GPU device code & execution to the compiler.py flag to centralize and clean up the central config.py.

Everything remains functionally the same: environment variable have precedence on defaults and the entire GPU stack is setup out of CUDA_ROOT & cupy device.

E.g.:

  • Split environment variables for GPU source code compile flags off CXX flags
  • Move GPU compiler configuration out in compiler.py
  • Force FMA (-fmad=false) off for -O0

⚠️ I didn't had a unit test because the real system test would require a "fresh" load of gt4py with a different env (-O0 in GT4PY_COMPILE_OPT_LEVEL) - which is beyond the scope of pytest

Move GPU compiler configuration out in `compiler.py`
Force FMA (`fmad`) off for `-O0`
@romanc
Copy link
Contributor

romanc commented Mar 11, 2026

cscs-ci run

1 similar comment
@romanc
Copy link
Contributor

romanc commented Mar 12, 2026

cscs-ci run

Use separate `GT4PY_CARTESIAN_EXTRA_CUDA_COMPILE_ARGS` environment
variable and not `GT4PY_EXTRA_COMPILE_ARGS` (same as CPU) because GPU
compilers don't always follow the flag names of the CPU compilers.

Adds a bit of (semi-related) cleanup:

- names of enums are usually singular (e.g. *Name not *Names)
- rely on type inference where possible
@romanc romanc merged commit 2d2511a into GridTools:main Mar 12, 2026
19 checks passed
@romanc romanc deleted the fix/gpu_compilation branch March 12, 2026 10:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants