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 </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; } -------------------------------------------------------------------------- mpic++ -o testp2p test_p2p.cpp I/home/myname/boost_2010_6_8/boost_1_43_0 g++: I/home/myname/boost_2010_6_8/boost_1_43_0: No such file or directory test_p2p.cpp:7:38: error: /boost/mpi/environment.hpp: No such file or directory test_p2p.cpp:11:38: error: boost/mpi/communicator.hpp: No such file or directory Actually, I have installed these header files in the directory. I find a possible reason: When I built the package, it tells me that : ----------------------------------------------------------------- -bash-3.2$ ./bjam Building the Boost C++ Libraries. warning: Building Boost.Regex with the optional Unicode/ICU support disabled. note: Please refer to the Boost.Regex documentation for more information note: this is a strictly optional feature. warning: Graph library does not contain MPI-based parallel components. note: to enable them, add "using mpi ;" to your user-config.jam 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. Component configuration: - date_time : building - filesystem : building - graph : building - graph_parallel : building - iostreams : building - math : building - mpi : building - program_options : building - python : building - random : building - regex : building - serialization : building - signals : building - system : building - test : building - thread : building - wave : building ...patience... ...patience... ...patience... ...found 6754 targets... The Boost C++ Libraries were successfully built! 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 ------------------------------------------------------------------------------------------ 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 ? Any help is appreciated. Jack June 13 2010 _________________________________________________________________ The New Busy is not the too busy. Combine all your e-mail accounts with Hotmail. http://www.windowslive.com/campaign/thenewbusy?tile=multiaccount&ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_4
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 <dtustudy68@hotmail.com> 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)
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 <dtustudy68@hotmail.com> 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