Difference between revisions of "HPC:Boost"
(7 intermediate revisions by one other user not shown) | |||
Line 6: | Line 6: | ||
==== Additional versions of Boost ==== | ==== Additional versions of Boost ==== | ||
− | Boost v1.55.0 and v1.57.0 are both available as modules. The example C++ code below can be used to test Boost v1.55.0 and v1.57.0 functionality on the PMACS cluster | + | Boost v1.55.0 and v1.57.0 are both available as modules. The example C++ code below can be used to test Boost v1.55.0 and v1.57.0 functionality on the PMACS cluster. |
+ | Code below has been adapted from the following sources [http://www.boost.org/doc/libs/1_57_0/doc/html/mpi/getting_started.html 1] and [http://particlephysicsandcode.com/ 2] | ||
<pre> | <pre> | ||
#include <iostream> | #include <iostream> | ||
− | |||
#include "boost/mpi.hpp" | #include "boost/mpi.hpp" | ||
Line 17: | Line 17: | ||
// Allows you to query the MPI environment | // Allows you to query the MPI environment | ||
boost::mpi::environment env( argc, argv ); | boost::mpi::environment env( argc, argv ); | ||
− | std::string | + | std::string node_name( env.processor_name() ); |
// permits communication and synchronization among a set of processes | // permits communication and synchronization among a set of processes | ||
− | boost::mpi::communicator | + | boost::mpi::communicator my_world; |
− | unsigned int rank( | + | unsigned int rank( my_world.rank() ), cpu_num( my_world.size() ); |
if ( rank == 0 ) { | if ( rank == 0 ) { | ||
− | std::cout << " | + | std::cout << "Node name: " << node_name << "\n"; |
− | std::cout << "Master (" << rank << "/" << | + | std::cout << "Master (" << rank << "/" << cpu_num << ")\n"; |
} else { | } else { | ||
− | std::cout << "Slave (" << rank << "/" << | + | std::cout << "Slave (" << rank << "/" << cpu_num << ")\n"; |
} | } | ||
return 0; | return 0; | ||
Line 36: | Line 36: | ||
===== Boost v1.55.0 ===== | ===== Boost v1.55.0 ===== | ||
− | The above code snippet is intended to verify Boost.MPI library functionality. | + | The above code snippet is intended to verify Boost.MPI library functionality. Follow the steps below in an interactive node. Launch an interactive session with -n 2 to ensure that the number of processors used in this Boost.MPI test are accounted for |
Load the appropriate Boost version module: | Load the appropriate Boost version module: | ||
<pre> | <pre> | ||
− | [asrini@consign ~]$ bsub -Is bash | + | [asrini@consign ~]$ bsub -n 2 -Is bash |
[asrini@node062 ~]$ ls boost_test.cpp | [asrini@node062 ~]$ ls boost_test.cpp | ||
Line 54: | Line 54: | ||
<pre> | <pre> | ||
− | [asrini@node062 ~]$ mpic++ | + | [asrini@node062 ~]$ mpic++ -W -Wall -L/opt/software/boost/1.55.0/lib/ -lboost_mpi -lboost_serialization boost_test.cpp -o Boost |
</pre> | </pre> | ||
− | Verify that the executable created was indeed compiled against this version of Boost: | + | Verify that the executable created was indeed compiled against this version of Boost. Notice the path to libboost_mpi.so.1.55.0 in the output below: |
<pre> | <pre> | ||
− | [asrini@node062 ~] | + | [asrini@node062 ~]$ ldd Boost |
− | linux-vdso.so.1 => ( | + | linux-vdso.so.1 => (0x00007fff469bd000) |
− | libboost_mpi.so.1.55.0 => /opt/software/boost/1.55.0/lib/libboost_mpi.so.1.55.0 ( | + | libboost_mpi.so.1.55.0 => /opt/software/boost/1.55.0/lib/libboost_mpi.so.1.55.0 (0x00002b06dbfc6000) |
− | libboost_serialization.so.1.55.0 => /opt/software/boost/1.55.0/lib/libboost_serialization.so.1.55.0 ( | + | libboost_serialization.so.1.55.0 => /opt/software/boost/1.55.0/lib/libboost_serialization.so.1.55.0 (0x00002b06dc1f6000) |
− | + | libmpi_cxx.so.1 => /usr/lib64/openmpi/lib/libmpi_cxx.so.1 (0x00002b06dc470000) | |
− | + | libmpi.so.1 => /usr/lib64/openmpi/lib/libmpi.so.1 (0x00000031d0e00000) | |
− | + | libstdc++.so.6 => /usr/lib64/libstdc++.so.6 (0x00000031cfe00000) | |
− | + | libm.so.6 => /lib64/libm.so.6 (0x00000031ce200000) | |
− | libmpi_cxx.so.1 => /usr/lib64/openmpi/lib/libmpi_cxx.so.1 ( | + | libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00000031d0600000) |
− | libmpi.so.1 => /usr/lib64/openmpi/lib/libmpi.so.1 ( | + | libpthread.so.0 => /lib64/libpthread.so.0 (0x00000031cea00000) |
− | libstdc++.so.6 => /usr/lib64/libstdc++.so.6 ( | + | libc.so.6 => /lib64/libc.so.6 (0x00000031ce600000) |
− | libm.so.6 => /lib64/libm.so.6 ( | + | librt.so.1 => /lib64/librt.so.1 (0x00000031cf600000) |
− | libgcc_s.so.1 => /lib64/libgcc_s.so.1 ( | + | libopen-rte.so.7 => /usr/lib64/openmpi/lib/libopen-rte.so.7 (0x00000031d0a00000) |
− | libpthread.so.0 => /lib64/libpthread.so.0 ( | + | libopen-pal.so.6 => /usr/lib64/openmpi/lib/libopen-pal.so.6 (0x00000031d0200000) |
− | libc.so.6 => /lib64/libc.so.6 ( | + | libdl.so.2 => /lib64/libdl.so.2 (0x00000031cee00000) |
− | librt.so.1 => /lib64/librt.so.1 ( | + | libnsl.so.1 => /lib64/libnsl.so.1 (0x00000031d1600000) |
− | + | libutil.so.1 => /lib64/libutil.so.1 (0x00000031d2200000) | |
− | + | libltdl.so.7 => /usr/lib64/libltdl.so.7 (0x00000031cfa00000) | |
− | libopen-rte.so.7 => /usr/lib64/openmpi/lib/libopen-rte.so.7 ( | + | /lib64/ld-linux-x86-64.so.2 (0x00000031cde00000) |
− | libopen-pal.so.6 => /usr/lib64/openmpi/lib/libopen-pal.so.6 ( | + | |
− | libdl.so.2 => /lib64/libdl.so.2 ( | ||
− | libnsl.so.1 => /lib64/libnsl.so.1 ( | ||
− | libutil.so.1 => /lib64/libutil.so.1 ( | ||
− | libltdl.so.7 => /usr/lib64/libltdl.so.7 ( | ||
− | /lib64/ld-linux-x86-64.so.2 ( | ||
</pre> | </pre> | ||
Line 92: | Line 87: | ||
<pre> | <pre> | ||
− | [asrini@node062 ~]$ /Boost | + | |
− | + | [asrini@node062 ~]$ mpirun -np 2 ./Boost | |
− | Master (0/1) | + | Node name: node061.hpc.local |
+ | Master (0/2) | ||
+ | Slave (1/2) | ||
</pre> | </pre> | ||
===== Boost v1.57.0 ===== | ===== Boost v1.57.0 ===== | ||
− | The above code snippet is intended to verify Boost.MPI library functionality. | + | The above code snippet is intended to verify Boost.MPI library functionality. Follow the steps below in an interactive node. Launch an interactive session with -n 2 to ensure that the number of processors used in this Boost.MPI test are accounted for |
+ | |||
+ | Load the appropriate Boost version module: | ||
<pre> | <pre> | ||
+ | [asrini@consign ~]$ bsub -n 2 -Is bash | ||
+ | |||
+ | [asrini@node062 ~]$ ls boost_test.cpp | ||
+ | boost_test.cpp | ||
+ | |||
+ | [asrini@node061 ~]$ module load openmpi-1.5.4-x86_64 | ||
+ | |||
+ | [asrini@node061 ~]$ module load boost-1.57.0 | ||
+ | |||
</pre> | </pre> | ||
+ | Now compile the code against the version of Boost you are testing. | ||
+ | |||
+ | <pre> | ||
+ | |||
+ | [asrini@node062 ~]$ mpic++ -W -Wall -L/opt/software/boost/1.57.0/lib/ -lboost_mpi -lboost_serialization boost_test.cpp -o Boost | ||
+ | |||
+ | </pre> | ||
+ | |||
+ | Verify that the executable created was indeed compiled against this version of Boost. Notice the path to libboost_mpi.so.1.57.0 in the output below: | ||
+ | |||
+ | <pre> | ||
+ | |||
+ | [asrini@node062 ~]$ ldd Boost | ||
+ | linux-vdso.so.1 => (0x00007fff4e1ff000) | ||
+ | libboost_mpi.so.1.57.0 => /opt/software/boost/1.57.0/lib/libboost_mpi.so.1.57.0 (0x00002b55d5d0c000) | ||
+ | libboost_serialization.so.1.57.0 => /opt/software/boost/1.57.0/lib/libboost_serialization.so.1.57.0 (0x00002b55d5f3c000) | ||
+ | libmpi_cxx.so.1 => /usr/lib64/openmpi/lib/libmpi_cxx.so.1 (0x00002b55d61a6000) | ||
+ | libmpi.so.1 => /usr/lib64/openmpi/lib/libmpi.so.1 (0x00000031d0e00000) | ||
+ | libstdc++.so.6 => /usr/lib64/libstdc++.so.6 (0x00000031cfe00000) | ||
+ | libm.so.6 => /lib64/libm.so.6 (0x00000031ce200000) | ||
+ | libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00000031d0600000) | ||
+ | libpthread.so.0 => /lib64/libpthread.so.0 (0x00000031cea00000) | ||
+ | libc.so.6 => /lib64/libc.so.6 (0x00000031ce600000) | ||
+ | librt.so.1 => /lib64/librt.so.1 (0x00000031cf600000) | ||
+ | libopen-rte.so.7 => /usr/lib64/openmpi/lib/libopen-rte.so.7 (0x00000031d0a00000) | ||
+ | libopen-pal.so.6 => /usr/lib64/openmpi/lib/libopen-pal.so.6 (0x00000031d0200000) | ||
+ | libdl.so.2 => /lib64/libdl.so.2 (0x00000031cee00000) | ||
+ | libnsl.so.1 => /lib64/libnsl.so.1 (0x00000031d1600000) | ||
+ | libutil.so.1 => /lib64/libutil.so.1 (0x00000031d2200000) | ||
+ | libltdl.so.7 => /usr/lib64/libltdl.so.7 (0x00000031cfa00000) | ||
+ | /lib64/ld-linux-x86-64.so.2 (0x00000031cde00000) | ||
+ | </pre> | ||
+ | |||
+ | Test run this program: | ||
+ | |||
+ | <pre> | ||
+ | |||
+ | [asrini@node062 ~]$ mpirun -np 2 ./Boost | ||
+ | Node name: node061.hpc.local | ||
+ | Master (0/2) | ||
+ | Slave (1/2) | ||
+ | |||
+ | </pre> | ||
=== Other Pages === | === Other Pages === | ||
+ | ---- | ||
+ | <div class="mw-collapsible mw-collapsed"> | ||
+ | *[[HPC:FAQ|HPC FAQ ]] | ||
+ | *[[HPC:Login|Connecting to the PMACS cluster]] | ||
+ | *[[HPC:User_Guide|User Guide]] | ||
*[[HPC:Software|Available Software]] | *[[HPC:Software|Available Software]] | ||
− | *[[HPC: | + | *[[HPC:Archive System|PMACS Archive System]] |
− | + | </div> | |
− |
Latest revision as of 15:21, 13 August 2019
Contents
Boost
There are currently three different versions of Boost C++ Libraries installed on all the PMACS cluster nodes.
Boost v1.41.0 is the system default version and can be linked to programs without any additional work.
Note : The default version of Boost may not include all the desired libraries. For example MPI library bindings may not work as expected.
Additional versions of Boost
Boost v1.55.0 and v1.57.0 are both available as modules. The example C++ code below can be used to test Boost v1.55.0 and v1.57.0 functionality on the PMACS cluster.
Code below has been adapted from the following sources 1 and 2
#include <iostream> #include "boost/mpi.hpp" int main(int argc, char* argv[]) { // Allows you to query the MPI environment boost::mpi::environment env( argc, argv ); std::string node_name( env.processor_name() ); // permits communication and synchronization among a set of processes boost::mpi::communicator my_world; unsigned int rank( my_world.rank() ), cpu_num( my_world.size() ); if ( rank == 0 ) { std::cout << "Node name: " << node_name << "\n"; std::cout << "Master (" << rank << "/" << cpu_num << ")\n"; } else { std::cout << "Slave (" << rank << "/" << cpu_num << ")\n"; } return 0; }
Copy the code above into a file called boost_test.cpp
Boost v1.55.0
The above code snippet is intended to verify Boost.MPI library functionality. Follow the steps below in an interactive node. Launch an interactive session with -n 2 to ensure that the number of processors used in this Boost.MPI test are accounted for
Load the appropriate Boost version module:
[asrini@consign ~]$ bsub -n 2 -Is bash [asrini@node062 ~]$ ls boost_test.cpp boost_test.cpp [asrini@node062 ~]$ module load openmpi-1.5.4-x86_64 [asrini@node062 ~]$ module load boost-1.55.0
Now compile the code against the version of Boost you are testing.
[asrini@node062 ~]$ mpic++ -W -Wall -L/opt/software/boost/1.55.0/lib/ -lboost_mpi -lboost_serialization boost_test.cpp -o Boost
Verify that the executable created was indeed compiled against this version of Boost. Notice the path to libboost_mpi.so.1.55.0 in the output below:
[asrini@node062 ~]$ ldd Boost linux-vdso.so.1 => (0x00007fff469bd000) libboost_mpi.so.1.55.0 => /opt/software/boost/1.55.0/lib/libboost_mpi.so.1.55.0 (0x00002b06dbfc6000) libboost_serialization.so.1.55.0 => /opt/software/boost/1.55.0/lib/libboost_serialization.so.1.55.0 (0x00002b06dc1f6000) libmpi_cxx.so.1 => /usr/lib64/openmpi/lib/libmpi_cxx.so.1 (0x00002b06dc470000) libmpi.so.1 => /usr/lib64/openmpi/lib/libmpi.so.1 (0x00000031d0e00000) libstdc++.so.6 => /usr/lib64/libstdc++.so.6 (0x00000031cfe00000) libm.so.6 => /lib64/libm.so.6 (0x00000031ce200000) libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00000031d0600000) libpthread.so.0 => /lib64/libpthread.so.0 (0x00000031cea00000) libc.so.6 => /lib64/libc.so.6 (0x00000031ce600000) librt.so.1 => /lib64/librt.so.1 (0x00000031cf600000) libopen-rte.so.7 => /usr/lib64/openmpi/lib/libopen-rte.so.7 (0x00000031d0a00000) libopen-pal.so.6 => /usr/lib64/openmpi/lib/libopen-pal.so.6 (0x00000031d0200000) libdl.so.2 => /lib64/libdl.so.2 (0x00000031cee00000) libnsl.so.1 => /lib64/libnsl.so.1 (0x00000031d1600000) libutil.so.1 => /lib64/libutil.so.1 (0x00000031d2200000) libltdl.so.7 => /usr/lib64/libltdl.so.7 (0x00000031cfa00000) /lib64/ld-linux-x86-64.so.2 (0x00000031cde00000)
Test run this program:
[asrini@node062 ~]$ mpirun -np 2 ./Boost Node name: node061.hpc.local Master (0/2) Slave (1/2)
Boost v1.57.0
The above code snippet is intended to verify Boost.MPI library functionality. Follow the steps below in an interactive node. Launch an interactive session with -n 2 to ensure that the number of processors used in this Boost.MPI test are accounted for
Load the appropriate Boost version module:
[asrini@consign ~]$ bsub -n 2 -Is bash [asrini@node062 ~]$ ls boost_test.cpp boost_test.cpp [asrini@node061 ~]$ module load openmpi-1.5.4-x86_64 [asrini@node061 ~]$ module load boost-1.57.0
Now compile the code against the version of Boost you are testing.
[asrini@node062 ~]$ mpic++ -W -Wall -L/opt/software/boost/1.57.0/lib/ -lboost_mpi -lboost_serialization boost_test.cpp -o Boost
Verify that the executable created was indeed compiled against this version of Boost. Notice the path to libboost_mpi.so.1.57.0 in the output below:
[asrini@node062 ~]$ ldd Boost linux-vdso.so.1 => (0x00007fff4e1ff000) libboost_mpi.so.1.57.0 => /opt/software/boost/1.57.0/lib/libboost_mpi.so.1.57.0 (0x00002b55d5d0c000) libboost_serialization.so.1.57.0 => /opt/software/boost/1.57.0/lib/libboost_serialization.so.1.57.0 (0x00002b55d5f3c000) libmpi_cxx.so.1 => /usr/lib64/openmpi/lib/libmpi_cxx.so.1 (0x00002b55d61a6000) libmpi.so.1 => /usr/lib64/openmpi/lib/libmpi.so.1 (0x00000031d0e00000) libstdc++.so.6 => /usr/lib64/libstdc++.so.6 (0x00000031cfe00000) libm.so.6 => /lib64/libm.so.6 (0x00000031ce200000) libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00000031d0600000) libpthread.so.0 => /lib64/libpthread.so.0 (0x00000031cea00000) libc.so.6 => /lib64/libc.so.6 (0x00000031ce600000) librt.so.1 => /lib64/librt.so.1 (0x00000031cf600000) libopen-rte.so.7 => /usr/lib64/openmpi/lib/libopen-rte.so.7 (0x00000031d0a00000) libopen-pal.so.6 => /usr/lib64/openmpi/lib/libopen-pal.so.6 (0x00000031d0200000) libdl.so.2 => /lib64/libdl.so.2 (0x00000031cee00000) libnsl.so.1 => /lib64/libnsl.so.1 (0x00000031d1600000) libutil.so.1 => /lib64/libutil.so.1 (0x00000031d2200000) libltdl.so.7 => /usr/lib64/libltdl.so.7 (0x00000031cfa00000) /lib64/ld-linux-x86-64.so.2 (0x00000031cde00000)
Test run this program:
[asrini@node062 ~]$ mpirun -np 2 ./Boost Node name: node061.hpc.local Master (0/2) Slave (1/2)