
Hi, all:
I need to install boost library (/home/myname/boost_2010_6_8/boost_1_43_0).
http://www.boost.org/doc/libs/1_43_0/more/getting_started/index.html
It has MPI library :
http://www.boost.org/doc/libs/1_42_0/doc/html/mpi.html
After installing it, I compile some c++ program with calling for boost.MPI class, the compiler cannot find the header files in the program even though I have included the boost path in the compile command.
example:
------------------------------------------------------------------------
#include
#include

Hi Jack, On Jun 13, 2010, at 12:25 PM, Jack Bryan wrote:
mpic++ -o testp2p test_p2p.cpp I/home/myname/boost_2010_6_8/ boost_1_43_0
[ snip ]
g++: I/home/myname/boost_2010_6_8/boost_1_43_0: No such file or directory
Run mpic++ -show and copy the g++ command into a script and make the code compile by running the script so you can figure out what's broken. This will remove the mpic++ script as the source of the problem. -- Noel

Hi Jack,
actually bjam is giving you a hint about what you should add to your
compiler command line:
On Sun, Jun 13, 2010 at 8:25 PM, Jack Bryan
The following directory should be added to compiler include paths:
/lustre/jxding/boost_2010_6_8/boost_1_43_0
The following directory should be added to linker library paths:
/lustre/jxding/boost_2010_6_8/boost_1_43_0/stage/lib
g++ option "-I" adds a directory to the include path and option "-L" adds a directory to the linker library path; in addition to that, to produce the actual executable file, you'll need to link against the "boost_mpi" and "boost_serialization" libraries: libraries are specified using the compiler's "-l" option. So, I'd guess that you need to invoke the mpic++ compiler this way:: mpic++ -o testp2p test_p2p.cpp \ -I/lustre/jxding/boost_2010_6_8/boost_1_43_0 \ -L/lustre/jxding/boost_2010_6_8/boost_1_43_0/stage/lib \ -lboost_mpi -lboost_serialization
It seems that I need to specify I need to use mpi for the bjam builder.
But, I have added "using mpi ;" and "using mpi : /opt/openmpi-gnu/bin/mpic++ ;" in the file /home/myname/boost_2010_6_8/boost_1_43_0/user-config.jam.
I have also added it in the file /home/myname/boost_2010_6_8/boost_1_43_0/tools/build/v2/user-config.jam.
But, I still got the same error. It seems that there is something wrong with the package ? or the compiler cannot understand the "using mpi ;" in the user-config.jam ?
I had to add the "using mpi ;" line to the file "project-config.jam"; creating a "user-config.jam" did not work for me (but I didn't really look into the issue, so likely I did something wrong). Anyway, there is a simple check to see if the Boost.MPI library has been built: search for a file named "libboost_mpi.a" into /lustre/jxding/boost_2010_6_8/boost_1_43_0/stage/lib (or whatever directory "bjam" suggests that you add to the linker library path). If the file is there, MPI support has been built. Best regards, Riccardo -- Riccardo Murri, Hadlaubstr. 150, 8006 Zürich (CH)

Hi : Thanks for all your replies. I fixed the problem by : adding the "-" before I. (1) removing "/" from the include header file "/boost/mpi/communicator.hpp". (2) compile it by : mpic++ -o testp2p test_p2p.cpp -I/lustre/jxding/boost_2010_6_8/boost_1_43_0 -L/lustre/jxding/boost_2010_6_8/boost_1_43_0/stage/lib -lboost_mpi -lboost_serialization (3) The libboost_mpi.a is really in the stage/lib . How to avoid this kind of simple problem happen again ? Actually, I have tried to search for answer online in the past 4 days without finding any hints. I really appreciate all of your help. Jack June 13 2010
Date: Sun, 13 Jun 2010 21:38:40 +0200 From: riccardo.murri@gmail.com To: boost-users@lists.boost.org Subject: Re: [Boost-users] boost MPI error
Hi Jack,
actually bjam is giving you a hint about what you should add to your compiler command line:
On Sun, Jun 13, 2010 at 8:25 PM, Jack Bryan
wrote: The following directory should be added to compiler include paths:
/lustre/jxding/boost_2010_6_8/boost_1_43_0
The following directory should be added to linker library paths:
/lustre/jxding/boost_2010_6_8/boost_1_43_0/stage/lib
g++ option "-I" adds a directory to the include path and option "-L" adds a directory to the linker library path; in addition to that, to produce the actual executable file, you'll need to link against the "boost_mpi" and "boost_serialization" libraries: libraries are specified using the compiler's "-l" option.
So, I'd guess that you need to invoke the mpic++ compiler this way::
mpic++ -o testp2p test_p2p.cpp \ -I/lustre/jxding/boost_2010_6_8/boost_1_43_0 \ -L/lustre/jxding/boost_2010_6_8/boost_1_43_0/stage/lib \ -lboost_mpi -lboost_serialization
It seems that I need to specify I need to use mpi for the bjam builder.
But, I have added "using mpi ;" and "using mpi : /opt/openmpi-gnu/bin/mpic++ ;" in the file /home/myname/boost_2010_6_8/boost_1_43_0/user-config.jam.
I have also added it in the file /home/myname/boost_2010_6_8/boost_1_43_0/tools/build/v2/user-config.jam.
But, I still got the same error. It seems that there is something wrong with the package ? or the compiler cannot understand the "using mpi ;" in the user-config.jam ?
I had to add the "using mpi ;" line to the file "project-config.jam"; creating a "user-config.jam" did not work for me (but I didn't really look into the issue, so likely I did something wrong).
Anyway, there is a simple check to see if the Boost.MPI library has been built: search for a file named "libboost_mpi.a" into /lustre/jxding/boost_2010_6_8/boost_1_43_0/stage/lib (or whatever directory "bjam" suggests that you add to the linker library path). If the file is there, MPI support has been built.
Best regards, Riccardo
-- Riccardo Murri, Hadlaubstr. 150, 8006 Zürich (CH) _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
_________________________________________________________________ Hotmail is redefining busy with tools for the New Busy. Get more from your inbox. http://www.windowslive.com/campaign/thenewbusy?ocid=PID28326::T:WLMTAGL:ON:W...
participants (3)
-
Belcourt, Kenneth
-
Jack Bryan
-
Riccardo Murri