How to build boost with mpi support on homebrew?
Asked Answered
H

3

5

According to this post (https://github.com/mxcl/homebrew/pull/2953), the flag "--with-mpi" should enable boost_mpi build support for the related homebrew formula, so I am trying to install boost via homebrew like this:

brew install boost --with-mpi

However, the actual boost mpi library is not being build and can not be found. There is currently some work being done around this, according to: https://github.com/mxcl/homebrew/pull/15689

In summary, I can currently build boost, but it seems the "--with-mpi" flag is being ignored. Could someone please check, if I should be able to build boost (with mpi support) on Mac OS X Mountain Lion (10.8)?

The (verbose) output generates these lines:

MPI auto-detection failed: unknown wrapper compiler mpic++
Please report this error to the Boost mailing list: http://www.boost.org
You will need to manually configure MPI support.

warning: skipping optional Message Passing Interface (MPI) library.
note: to enable MPI support, add "using mpi ;" to user-config.jam.
note: to suppress this message, pass "--without-mpi" to bjam.
note: otherwise, you can safely ignore this message.

Not sure how exactly I can fix this and get the mpi stuff to be build - any ideas?

Hook answered 30/10, 2012 at 16:22 Comment(3)
There is some output of the build initialization here: gist.github.com/3981327Hook
Older OS X versions used to ship with Open MPI preinstalled. I believe OMPI was dropped from Lion onwards and you would have to install it manually. The bin directory from the OMPI installation should be in the PATH - it is where mpicc, mpic++, etc. wrappers are located.Ciceronian
Thanks - yes I installed open-mpi, and just tried with mpich2 as well (still the same problem, though). The path is pointing to /usr/local/bin, which is where mpic++, mpicc, mpirun, etc. can be found, when you install with homebrew.Hook
H
4

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

Homeopathist answered 30/10, 2012 at 16:22 Comment(0)
C
3

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

Chiromancy answered 20/2, 2016 at 23:31 Comment(1)
This is helpful information, but I do believe that this should be a comment on the question, as it doesn't necessarily answer the question "how to build."Unorganized
C
0

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!

Centrobaric answered 28/6, 2016 at 23:3 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.