Reputation: 412
One way of installing gcc with openMP support on OSX is using Homebrew. However, when I follow the usual instruction of
brew reinstall gcc --without-multilib
It gives me a warning that there is no formula corresponding to the --without-multilib
option and hence this will have no effect. Consequently, I do not have openMP support after this reinstallation process. Here is the detailed terminal output.
poulin8:02-prange-parallel-loops poulingroup$ brew --version
Homebrew 1.3.6
Homebrew/homebrew-core (git revision b5afc; last commit 2017-10-27)
poulin8:02-prange-parallel-loops poulingroup$ brew reinstall gcc --without-multilib
==> Reinstalling gcc
Warning: gcc: this formula has no --without-multilib option so it will be ignored!
==> Downloading https://homebrew.bintray.com/bottles/gcc-7.2.0.el_capitan.bottle
Already downloaded: /Users/poulingroup/Library/Caches/Homebrew/gcc-7.2.0.el_capitan.bottle.tar.gz
==> Pouring gcc-7.2.0.el_capitan.bottle.tar.gz
🍺 /usr/local/Cellar/gcc/7.2.0: 1,486 files, 289.8MB
poulin8:02-prange-parallel-loops poulingroup$
Upon including omp.h
in a file and compiling, I get the error
julia.c:447:10: fatal error: 'omp.h' file not found
#include <omp.h>
^
1 error generated.
error: command 'cc' failed with exit status 1
Could someone please help me with installing gcc on OSX with openMP support?
Upvotes: 6
Views: 1207
Reputation:
If you can substitute clang for gcc I was able to get clang to compile OpenMP programs quite easily. I built the latest version of LLVM/clang and used homebrew to install libomp via brew install libomp
.
Full steps were something like:
mkdir omp_clang && cd omp_clang
git clone https://github.com/llvm-mirror/llvm.git -b release_60
git clone https://github.com/llvm-mirror/clang.git llvm/tools/clang -b release_60
mkdir build && cd build
cmake ../llvm
make
brew install libomp
./bin/clang -fopenmp=libomp ~/openmp_program.c
Upvotes: 1