Skip to content

OpenMP SIMD compiler support detection in CMake #1334

@svenweb

Description

@svenweb

Detect if the compiler supports OpenMP and #pragma omp simd then set an HAVE_OPEN_SIMD=1 flag accordingly. The HAVE_OPEN_SIMD flag could be used in #1331 and later on for any SIMD vectorization in the project.

The basic CMake for this would look something like:

  • Check if compiler/toolchain supports basic OpenMP with FindOpenMP
  • If supported, set CMake OpenMP compiler flags

However detecting support for #pragma omp simd specifically could require more checks as different compilers support the SIMD subset of OpenMP unevenly, see clang has limited support for vectorization.

Using a try_compile method could be a good option, I will update this issue as I try out some solutions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions