==> Summary 🍺 /usr/local/Cellar/llvm/8.0.0_1: 6,807 files, 3.3GB Error: libomp 7.0.0 is already installed To upgrade to 8.0.0, run `brew upgrade libomp`. ==> Caveats ==> llvm To use the bundled libc++ please add the following LDFLAGS: LDFLAGS="-L/usr/local/opt/llvm/lib -Wl,-rpath,/usr/local/opt/llvm/lib"
llvm is keg-only, which means it was not symlinked into /usr/local, because macOS already provides this software and installing another version in parallel can cause all kinds of trouble.
If you need to have llvm first in your PATH run: echo 'export PATH="/usr/local/opt/llvm/bin:$PATH"' >> ~/.bash_profile
For compilers to find llvm you may need to set: export LDFLAGS="-L/usr/local/opt/llvm/lib" export CPPFLAGS="-I/usr/local/opt/llvm/include"
openMP程序编译执行方法
1 2 3 4 5 6 7 8 9 10 11
localhost:OpenMP czh$ /usr/local/opt/llvm/bin/clang -fopenmp test.c localhost:OpenMP czh$ ls a.out test.c localhost:OpenMP czh$ a.out -bash: a.out: command not found localhost:OpenMP czh$ ./a.out Hello World from thread = 0 Number of threads = 4 Hello World from thread = 2 Hello World from thread = 3 Hello World from thread = 1
~/.bash_profile的配置,简化编译指令alias
1 2 3
#llvm OpenMP export PATH="/usr/local/opt/llvm/bin:$PATH" alias openmp_bin='/usr/local/opt/llvm/bin/clang -fopenmp'
1 2 3
localhost:OpenMP czh$ openmp_bin test.c localhost:OpenMP czh$ ls a.out test.c