feat[cartesian]: Introduce default compiler flags#2520
feat[cartesian]: Introduce default compiler flags#2520FlorianDeconinck merged 4 commits intoGridTools:mainfrom
Conversation
…fig env variable read
src/gt4py/cartesian/config.py
Outdated
There was a problem hiding this comment.
Writing the ADR, I came across this default. I think we should we change the default to False for apple-clang now that we can detect compilers because we won't compile with the necessary OpenMP flags.
There was a problem hiding this comment.
Good catch - done.
There was a problem hiding this comment.
The new dataclass member still needs to be assigned as default, or am I missing something here?
_enable_open_mp = os.environ.get("GT4PY_CARTESIAN_ENABLE_OPENMP", _compiler_infos.enable_openmp)Freeze dataclass and centralize defaults
src/gt4py/cartesian/config.py
Outdated
There was a problem hiding this comment.
The new dataclass member still needs to be assigned as default, or am I missing something here?
_enable_open_mp = os.environ.get("GT4PY_CARTESIAN_ENABLE_OPENMP", _compiler_infos.enable_openmp)|
You are not missing something, I quite literally did not write half the code -_- |
romanc
left a comment
There was a problem hiding this comment.
Looking good now. The only question that popped up is if we should notify the user which compiler we detected (and how to possibly set another one, e.g. by setting the CXX / CC env variables).
I thought about it - but we are already pretty verbose with NDSL and I was careful not to bury more verbosity... Arguably, it would be good to have a way to dump the entire "config" of GT4Py, including defaults flags |
Sounds good - I agree, we can pick this up later in a bigger context. |
…onfiguration out of `config.py` (#2524) ## 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` :warning: 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` --------- Co-authored-by: Roman Cattaneo <romanc@users.noreply.github.com>
Description
Continuing an ongoing effort to support a wider range of in-use compilers (clang/icx) we introduce a system to detect the C++ compiler and adapt the openmp and compilation flags loaded by default.
We use
setuptoolsto detect the compiler which is future-proofed (3.14) as well as a solution for older python (3.8+).In order to get a closer match with default Fortran numerics at
-O0we drop all FMA at this optimization level.Configuration still listens to the
GT4PY_*environment variable in priority.Requirements
If this PR contains code authored by new contributors please make sure:
AUTHORS.mdfile adding the names of all the new contributors.