使用自制程序在Mac上使用OpenMP支持安装gcc无效

时间:2017-10-27 16:26:40

标签: gcc installation openmp homebrew

在OSX上使用openMP支持安装gcc的way正在使用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$

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

有人可以帮我在OSX上使用openMP支持安装gcc吗?

1 个答案:

答案 0 :(得分:0)

如果你可以用clang代替gcc我可以很容易地编译OpenMP程序。我构建了最新版本的LLVM / clang并使用自制程序通过brew install libomp安装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