I tried to run Boost MPI with mpich2 3.1.4 (compiled from source). But, I believe the problem is that Boost MPI's dependency on OpenMPI is messing up with mpich2 3.1.4.
I get the following prompt upon compiling my code.
$ mpic++ -std=c++11 boost_mpi.cpp -lboost_system -lboost_mpi -lboost_serialization
/usr/bin/ld: warning: libmpi.so.1, needed by /usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/libboost_mpi.so, may conflict with libmpi.so.12
This is my code
#include <iostream>
#include <string>
#include <queue>
#include "mpi.h"
#include <boost/algorithm/string.hpp>
#include <unordered_map>
#include "tf.cpp"
#include <boost/mpi.hpp>
#include <boost/serialization/string.hpp>
namespace mpi = boost::mpi;
int main(int argc, char* argv[]){
mpi::environment env(argc, argv);
mpi::communicator boost_world;
if (boost_world.rank() == 0) {
boost_world.send(1, 0, std::string("Hello"));
std::string msg;
boost_world.recv(1, 1, msg);
std::cout << msg << "!" << std::endl;
} else {
std::string msg;
boost_world.recv(0, 0, msg);
std::cout << msg << ", ";
std::cout.flush();
boost_world.send(0, 1, std::string("world"));
}
return 0;
}
I see that help has been given here for setting up alternatives for mpi in Ubuntu. But, I am unable to set them as I have compiled my code manually.
I am using Ubuntu 14.04, on a 64 bit machine.
Thanks in advance.