gpt4 book ai didi

gcc - 使用 Homebrew 软件在 Mac 上安装支持 OpenMP 的 gcc 没有效果

转载 作者:行者123 更新时间:2023-12-04 15:51:38 24 4
gpt4 key购买 nike

way在 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$

包括 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

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

最佳答案

如果你可以用 clang 代替 gcc,我就可以很容易地让 clang 编译 OpenMP 程序。我构建了最新版本的 LLVM/clang 并使用 Homebrew 软件通过 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

关于gcc - 使用 Homebrew 软件在 Mac 上安装支持 OpenMP 的 gcc 没有效果,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46979608/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com