How to build boost with mpi support on homebrew?

有些话、适合烂在心里 提交于 2019-12-01 06:10:19

Just in case this helps anyone else along the line, here's how I fixed this. The main error is MPI auto-detection failed: unknown wrapper compiler mpic++, any typing mpic++ at the command line verified that it was not working properly for me. I used brew to install open-mpi, but the same error was showing in the verbose output for installing boost. A run of brew doctor showed that openmpi was not linked properly, so I fixed those errors and reran brew -v install boost --with-mpi --without-single and it finally built and installed all of the libraries without a problem

To anyone that comes across this, the package migrated to boost-python and boost-mpi separate from boost. Use brew install boost-mpi

Ken H

Just get it worked on OSX 10.11.5. I've tried brew, but with no luck.

Suppose you already have gcc installed. Here are what I've done:

1. Find and disable (but do not remove) clang

clang alway cause headaches. There would be a lot of warnings when building Boost.

which clang, which should give you /usr/bin/clang

Rename it: sudo mv clang clang_mac_remove, also for clang++: sudo mv clang++ clang++_mac_remove. You can change the names back if you need them in future.

2. Install OpenMPI

If you already installed using brew, uninstall first. Becasue it would have used clang as the compiler wrapper by default. You need to change the wrapper to gcc.

Download the package.

Specify the wrapper compiler to gcc and g++:

./configure CC=gcc CXX=g++ F77=ifort FC=ifort --prefix=/usr/local

Below may take a long time.

make all

sudo make install

Reference: https://wiki.helsinki.fi/display/HUGG/Open+MPI+install+on+Mac+OS+X

3. Install Boost MPI

Download the package.

Run ./bootstrap.sh (can open it first and specify the toolset to gcc, otherwise, the default option is darwin for mac).

Add using mpi ; in project-config.jam file. Then ./b2 —with-mpi will only build the mpi library.

Then, all built libraries can be found in the folder ~/Downloads/boost_1_61_0/stage/lib.

Copy or move them to /usr/local/lib or any other commonly used library path.

Reference: http://www.boost.org/doc/libs/1_61_0/doc/html/mpi/getting_started.html

4. Compile with Boost MPI

LIBRARY DIR = -L/usr/local/lib

INCLUDE = -I/usr/local/include/

LINKER = -lboost_mpi -lboost_serialization

e.g.

mpic++ -std=c++11 -I/usr/local/include/ -c boost_test.cpp -L/usr/local/lib -lboost_mpi -lboost_serialization

Good luck!

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!