-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Add OpenMP support on clang / macOS #7435
Comments
I added a small reproducer for this in https://github.com/lesteve/meson-openmp-osx. cc @eli-schwartz that mentioned that this behaviour was unexpected in scikit-learn/scikit-learn#28710 (comment). We are hitting this in scikit-learn: meson does not find OpenMP but the compilation with OpenMP actually works fine if the right compilation flags are set, see scikit-learn/scikit-learn#28710 for more details. Looking around I have seen some work-arounds for this behaviour, in a few places for example dipy which has some brew-specific tweaks: Note that this does not only happen with OpenMP installed with brew but also when downloading OpenMP lib and include folder and setting compilation flags accordingly. This is what we are currently doing in the scikit-learn CI where we download OpenMP lib and include from conda-forge, see scikit-learn/scikit-learn#28710 (comment). |
Is the |
Not an expert, but I believe Just to check, I did a quick test on https://github.com/lesteve/meson-openmp-osx with clang on Linux and Meson finds OpenMP (without setting any environment variable), compiles the test program and running the test program shows that OpenMP is indeed used. Here is the meson setup output for completeness:
|
Okay, that article is very helpful. I've opened 13079 as a starting point, which adds the How exactly to handle the rest of it is more complicated. We could inject user supplied arguments into the dependencies, although that seems fragile and is going to be a big project to make sure we're doing that consistently. |
Which requires injecting some extra paths and the `-Xpreprocess` flag. Fixes: mesonbuild#7435
Which requires injecting some extra paths and the `-Xpreprocess` flag. Fixes: mesonbuild#7435
Which requires injecting some extra paths and the `-Xpreprocess` flag, as well as extra search paths for libomp and the headers. Fixes: mesonbuild#7435
Note that there is an exception: clang from MacPorts supports OpenMP, even without the |
This is particular to the Clang shipped by Apple as part of XCode, this abstraction should not get used for Clang from MacPorts or Homebrew or Nix. |
At this moment there is no way to detect OpenMP dependency on clang / macOS using Meson Build.
However OpenMP can be used with clang on macOS with
brew install libomp
and-Xpreprocess
compiler option.The text was updated successfully, but these errors were encountered: