Skip to content

Guard #pragma omp simd with OpenMP version check #2585

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

Open
ggorman opened this issue Apr 16, 2025 · 0 comments
Open

Guard #pragma omp simd with OpenMP version check #2585

ggorman opened this issue Apr 16, 2025 · 0 comments
Assignees

Comments

@ggorman
Copy link
Contributor

ggorman commented Apr 16, 2025

Description:

When targeting OpenMP with Devito, we're seeing compilation-time warnings on some older systems:
ignoring #pragma omp simd

This is expected behavior when compiling with an OpenMP version < 4.0, as #pragma omp simd was only introduced in OpenMP 4.0 (released July 2013). In particular, the macro _OPENMP is not sufficient for this use case unless its value is ≥ 201307.

Option 1:
We should add a check in the Devito compiler pipeline to conditionally emit #pragma omp simd only if _OPENMP >= 201307.

Option 2:
We update the writing out pragma omp simd to include preprocessor guards in the generated code, e.g.:

#if defined(_OPENMP) && _OPENMP >= 201307
#pragma omp simd
#endif

The disadvantage is that this will reduce the readability of the generated code.

Option 3:
Alternative considered: Adding -Wno-unknown-pragmas to the compiler flags to silence the warning. However, this is fragile and may suppress legitimate warnings from other unintended or misspelled pragmas.

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

No branches or pull requests

2 participants