Boost.MPI problem

I am working on HPC. And this HPC had an old version of Boost installed and this acceleration library has no Boost.MPI. I asked the admins to install it on HPC. But they asked me to install it in my home directory. So I installed both boost and boost.mpi in my home directory. The Boost library is working correctly. But when I try to run the following code with the below command, I got errors.

Test code:

#include <boost/mpi/environment.hpp>
#include <boost/mpi/communicator.hpp>
#include <iostream>
namespace mpi = boost::mpi;

int main(int argc, char* argv[]) 
{
  mpi::environment env(argc, argv);
  mpi::communicator world;
  std::cout << "I am process " << world.rank() << " of " << world.size()
        << "." << std::endl;
  return 0;
}

      

Build command:

 mpiCC -I/home1/username/boost/include 
-I/usr/mpi/gcc/openmpi-1.2.8/include/
-L/home1/username/boost/lib 
-L/usr/mpi/gcc/openmpi-1.2.8/lib64/openmpi 
-lboost_mpi-gcc-mt-1_35  testboostmpi2.cpp

      

I got the following screams:

testboostmpi2.o: In function `main':
testboostmpi2.cpp:(.text+0x59): undefined reference to     
`boost::mpi::environment::environment(int&, char**&, bool)'
testboostmpi2.cpp:(.text+0x63): undefined reference to 
`boost::mpi::communicator::communicator()'
 testboostmpi2.cpp:(.text+0x86): undefined reference to 
`boost::mpi::environment::~environment()'
testboostmpi2.cpp:(.text+0xb9): undefined reference to 
`boost::mpi::environment::~environment()'

      

I would really appreciate if any of you can help.

+2


source to share


2 answers


Assuming you are using g ++ you can try using the option -Wl,--rpath

.

mpiCC testboostmpi2.cpp -I/home1/username/boost/include-I/usr/mpi/gcc/openmpi-1.2.8/include/ \
    -L/home1/username/boost/lib -L/usr/mpi/gcc/openmpi-1.2.8/lib64/openmpi \
    -lboost_mpi-gcc-mt-1_35 -Wl,-rpath -Wl,/home1/username/boost/lib \
    -Wl,-rpath -Wl,/usr/mpi/gcc/openmpi-1.2.8/lib64/openmpi

      



Also to link in the correct order, you need to put the source file as the first argument, not the last.

+3


source


Unfortunately I am using boost 1.41, so an exact comparison is not possible. However, I got the exact same errors when I didn't include -lboost_mpi

(new library naming convention). So, I would check your directories are correct and contain what they think they should contain.



+2


source







All Articles