Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
994 views
in Technique[技术] by (71.8m points)

macos - Is OpenMP available in High Sierra LLVM?

In the default LLVM provided by Apple in macOS 10.13, High Sierra, is OpenMP finally available? It has been available in main LLVM for more than a year now.

(another way to ask the question might be what version of LLVM is the new Apple LLVM based on)

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Standard Apple's clang supports OpenMP. They just disabled the driver option. But you can use the frontend option instead this way: clang -Xclang -fopenmp <you_program> -I <path to omp.h> -L <path to libomp.dylib> -lomp

Also, you need to set DYLD_LIBRARY_PATH environmental variable: export DYLD_LIBRARY_PATH=<path to libomp.dylib>

How to get/build libomp.

$ cd
$ svn co http://llvm.org/svn/llvm-project/openmp/trunk libomp
$ cd libomp
$ mkdir build && cd build
$ cmake -DCMAKE_INSTALL_PREFIX=~/libomp/openmp
$ make && make install

After this directory ~/libomp/openmp will have 2 subdirs: include and lib, which should be used as the path to omp.h and the path to libomp.dylib correspondingly.

See also my answer to Is C++ compilable with OpenMP and boost on MacOS?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...