7
5

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

openmp & openmpi on mac from brew

Last updated at Posted at 2021-09-09

#なんかclangだと上手く行かないのでgccを使いたい

clangのopenmpはなんか上手くいかないので,openmp & open-mpiをgccで使いたい.しかしbrewで入れようとするとデフォのclangが邪魔をする.

世の中には

clangでopenmpを使う方法もあるようだけど,うまく並列できなかったりする.

#brewを使う

brew install gcc はすんで,今だとgcc-11あたりが入っているとする.
brewでopen-mpiがclangで構築されるのは

HOMEBREW_CC: clang
HOMEBREW_CXX: clang++```
となっているからなので,これを
```$export HOMEBREW_CC=gcc-11
$export HOMEBREW_CXX=g++-11
$brew install open-mpi --build-from-source```
と指定してソースからbuildすると,
`$mpicc -v`
(中略)
```Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 11.1.0 (Homebrew GCC 11.2.0)```
とgcc-11で構築される.
あとはmpicc, mpic++でopenmpもopen-mpiも使える.

#clangでopnempを使う?

[Apple ClangでOpenMPを使う](https://qiita.com/ktgw0316/items/23235dd2533f488be7da) 参照.
オプションとか探してmakefileをいじってテストして頑張ればopenmp & open-mpiできるのかも?
7
5
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
7
5

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?