Pav*_*yer 6 installation homebrew gcc openmp
在OSX上使用openMP支持安装gcc的一种方法是使用Homebrew.但是,当我遵循通常的指示
brew reinstall gcc --without-multilib
它给了我一个警告,说明没有与该--without-multilib选项相对应的公式,因此这将没有任何效果.因此,在重新安装过程之后,我没有openMP支持.这是详细的终端输出.
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$
Run Code Online (Sandbox Code Playgroud)
在包含omp.h在文件和编译中,我得到错误
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
Run Code Online (Sandbox Code Playgroud)
有人可以帮我在OSX上使用openMP支持安装gcc吗?
小智 1
如果你能用 clang 代替 gcc,我就能很容易地用 clang 编译 OpenMP 程序。我构建了最新版本的 LLVM/clang 并使用 homebrew 通过brew install libomp.
完整的步骤是这样的:
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
Run Code Online (Sandbox Code Playgroud)