devito icon indicating copy to clipboard operation
devito copied to clipboard

Add compiler version check in Devito to guard against unsupported toolchains

Open ggorman opened this issue 8 months ago • 2 comments

Description:

Currently, Devito does not explicitly verify the compiler version used during code generation or JIT compilation. This can lead to confusing or silent failures when using outdated, non-conforming, or otherwise unsupported compilers—particularly with features like OpenMP 4.0+ pragmas, vectorization support, and more aggressive optimization behaviors.

Proposal:

Introduce explicit compiler version checks within the Devito compilation pipeline to ensure compatibility and provide clear feedback to users.

Implementation Details:

  • Compiler Detection: Extend the existing compiler detection logic to retrieve both the compiler name and its version.

  • Minimum Supported Versions: Define and document the minimum supported compiler versions. For instance:

    • GCC: ≥ 7.0
    • Clang: ≥ 6.0
    • Intel oneAPI: >=2024.0.2
  • Version Verification: During the compilation setup, verify that the detected compiler version meets the minimum requirements.

  • User Feedback:

    • If the compiler version is below the minimum supported version, terminate the compilation process and display an informative error message.
    • [optional] If the compiler version is above the minimum but not among the versions tested in CI, emit a warning indicating that the compiler is untested and may lead to unexpected behavior.

Benefits:

  • Prevents cryptic or misleading compiler errors, such as silently ignored pragmas or miscompiled kernels.
  • Provides clear guidance to users regarding supported compiler versions.
  • Encourages the use of modern, standards-compliant toolchains, enhancing overall code reliability.

**Additional Notes:

  • Consider integrating these checks into the CI pipeline to ensure that any updates to supported compiler versions are consistently tested.
  • Update the Devito documentation to reflect these changes and guide users on configuring their environments accordingly.

ggorman avatar Apr 16 '25 09:04 ggorman

imho the warning makes sense because it suggests they should update their backend compiler instead

FabioLuporini avatar Apr 16 '25 10:04 FabioLuporini

we could intercept it and turn it into our own warning though

FabioLuporini avatar Apr 16 '25 10:04 FabioLuporini