-
Notifications
You must be signed in to change notification settings - Fork 49
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
OpenMP on Mac OS #172
Comments
Thanks for the report!
But possibly we'd prefer to just install I don't have a Mac, but if you or @manodeep could test that linker arg, it could help us decide on a path for stable OpenMP for clang. |
Thanks Tom! One of the goals of Corrfunc is to ensure that the code compiles on all systems. Supporting OpenMP automatically in a Mac is a complex task, and that's why we only try to do the minimum and leave the responsibility on the user. For reference, I use Corrfunc with OpenMP regularly on my MAC laptop, but I have installed the necessary clang with the OpenMP support. That being said, the section of the @lgarrison The linker on OSX does not support the |
I can compile and run with multiple threads even with Apple clang with the following steps: $ conda install llvm-openmp
Then adding the following to the `common.mk` file
CC :=/usr/bin/clang
#### Add any compiler specific flags you want
CFLAGS ?=-Xpreprocessor -fopenmp -I$(CONDA_PREFIX)/include
#### Add any compiler specific link flags you want
CLINK ?=-L$(CONDA_PREFIX)/lib -lomp -Xlinker -rpath -Xlinker $(CONDA_PREFIX)/lib Of course, we will need to detect apple-clang, and then Noting the solution here for incorporating into the v2.4 |
If we were thinking of supporting cases where |
Significant warnings are issued suggesting that Mac OS openMP does not work with the system
installed clang toc comile Corrfunc.
Following,
https://iscinumpy.gitlab.io/post/omp-on-high-sierra/
explains how to use the existing clang on Mac OS and still use openMP.
I tested this on Mojave 10.4.1 and it works well.
I used home-brew:
brew install libomp
And added in common.mk
Add any compiler specific flags you want
CFLAGS ?= -Xpreprocessor -fopenmp
Add any compiler specific link flags you want
CLINK ?= -lomp
If a kernel crashes it can happen when two openMP libs are installed.
To avoid this you can add this in your python script:
import os
os.environ['KMP_DUPLICATE_LIB_OK']='True'
Or set the variable in your shell environment.
Speed up on MacBook pro is as expected.
Perhaps common.mk could be adjusted to suggest this possibility given how many
astronomers use Macs?
Best,
Tom
The text was updated successfully, but these errors were encountered: