MPI make build fails with cmdstan

Hello all,

In order to use MPI, I added the following lines to the make/local file:

STAN_MPI=true
CXX=mpicxx
TBB_CXX_TYPE=gcc

after I do make clean-all and make build, I get the following error:

...failed updating 45 targets...
...skipped 23 targets...
...updated 159 targets...
make: *** [stan/lib/stan_math/lib/boost_1.72.0/stage/lib/mpi.so] Error 1

and my models fail to compile.

system - centOS7
gcc version - 9.3.0
openmpi version 4.0.2
stan - cmdstan 2.24.0

Everything compiles fine with the regular configurations. What am I missing something here?

One of @wds15 or @yizhang may be able to help you with this.

Thanks! I get errors that relate to pyconfig.h file, like this one:

...failed gcc.compile.c++ bin.v2/libs/python/build/gcc-9.2.0/release/cxxstd-11-iso/python-3.7/threading-multi/visibility-hidden/numpy/ndarray.o...
gcc.compile.c++ bin.v2/libs/python/build/gcc-9.2.0/release/cxxstd-11-iso/python-3.7/threading-multi/visibility-hidden/numpy/numpy.o
In file included from ./boost/python/detail/prefix.hpp:13,
                 from ./boost/python/args.hpp:8,
                 from ./boost/python.hpp:11,
                 from ./boost/python/numpy/internal.hpp:17,
                 from libs/python/src/numpy/numpy.cpp:8:
./boost/python/detail/wrap_python.hpp:57:11: fatal error: pyconfig.h: No such file or directory
   57 | # include <pyconfig.h>
      |           ^~~~~~~~~~~~
compilation terminated.

I read previous threads about it, but the solution was unclear. I checked that my hardware is MPI compatible, so any help will be highly appreciated.

You need python-dev.

On Ubuntu its
sudo apt install python-dev

I believe on Centos its

sudo yum install python-dev

1 Like

Thanks! I asked my system admins to get python-dev for python 3.7.0 (I don’t have sudo permissions). In the meanwhile, I’ve build the mpi binaries using the default cluster python2.7 and it seemed to work (not without warnings, but at least without fatal errors). Would this be wrong to run the stan code with python 3.7.0?

Either are fine. Python is used here to build the Boost MPI lib, so make build works, its good to go.

1 Like

Sweet! Thanks.

1 Like