Difference between revisions of "HPC:Boost"

From HPC wiki
Line 36: Line 36:
  
 
===== Boost v1.55.0 =====  
 
===== Boost v1.55.0 =====  
The above code snippet verifies Boost.MPI library functionality.  
+
The above code snippet is intended to verify Boost.MPI library functionality. Follow the steps below in an interactive node:
 +
 
 +
Load the appropriate Boost version module:
 +
<pre>
 +
[asrini@consign ~]$ bsub -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
 +
</pre>
 +
 
 +
Now compile the code against the version of Boost you are testing.
 +
 
 
<pre>
 
<pre>
  
 +
[asrini@node062 ~]$ mpic++  -W -Wall -L/opt/software/boost/1.55.0/lib/ -lboost_mpi -lboost_serialization -lboost_system -lboost_filesystem -lboost_graph_parallel -lboost_iostreams boost_test.cpp -o Boost
 +
 +
</pre>
 +
 +
Verify that the executable created was indeed compiled against this version of Boost:
 +
 +
<pre>
  
 +
[asrini@node062 ~]$ $ ldd Boost
 +
linux-vdso.so.1 =>  (0x00007fffebbff000)
 +
libboost_mpi.so.1.55.0 => /opt/software/boost/1.55.0/lib/libboost_mpi.so.1.55.0 (0x00002b69ecb97000)
 +
libboost_serialization.so.1.55.0 => /opt/software/boost/1.55.0/lib/libboost_serialization.so.1.55.0 (0x00002b69ecdc7000)
 +
libboost_system.so.1.55.0 => /opt/software/boost/1.55.0/lib/libboost_system.so.1.55.0 (0x00002b69ed041000)
 +
libboost_filesystem.so.1.55.0 => /opt/software/boost/1.55.0/lib/libboost_filesystem.so.1.55.0 (0x00002b69ed244000)
 +
libboost_graph_parallel.so.1.55.0 => /opt/software/boost/1.55.0/lib/libboost_graph_parallel.so.1.55.0 (0x00002b69ed45b000)
 +
libboost_iostreams.so.1.55.0 => /opt/software/boost/1.55.0/lib/libboost_iostreams.so.1.55.0 (0x00002b69ed6a3000)
 +
libmpi_cxx.so.1 => /usr/lib64/openmpi/lib/libmpi_cxx.so.1 (0x00002b69ed8bc000)
 +
libmpi.so.1 => /usr/lib64/openmpi/lib/libmpi.so.1 (0x00000030d6800000)
 +
libstdc++.so.6 => /usr/lib64/libstdc++.so.6 (0x00000030d5400000)
 +
libm.so.6 => /lib64/libm.so.6 (0x00000030d3800000)
 +
libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00000030d5c00000)
 +
libpthread.so.0 => /lib64/libpthread.so.0 (0x00000030d4000000)
 +
libc.so.6 => /lib64/libc.so.6 (0x00000030d3c00000)
 +
librt.so.1 => /lib64/librt.so.1 (0x00000030d4c00000)
 +
libz.so.1 => /lib64/libz.so.1 (0x00000030d4800000)
 +
libbz2.so.1 => /lib64/libbz2.so.1 (0x00000030d8c00000)
 +
libopen-rte.so.7 => /usr/lib64/openmpi/lib/libopen-rte.so.7 (0x00000030d6000000)
 +
libopen-pal.so.6 => /usr/lib64/openmpi/lib/libopen-pal.so.6 (0x00000030d6400000)
 +
libdl.so.2 => /lib64/libdl.so.2 (0x00000030d4400000)
 +
libnsl.so.1 => /lib64/libnsl.so.1 (0x00000030d6c00000)
 +
libutil.so.1 => /lib64/libutil.so.1 (0x00000030d7800000)
 +
libltdl.so.7 => /usr/lib64/libltdl.so.7 (0x00000030d5000000)
 +
/lib64/ld-linux-x86-64.so.2 (0x00000030d3400000)
 
</pre>
 
</pre>
  
 +
Test run this program:
 +
 +
<pre>
 +
[asrini@node062 ~]$ /Boost
 +
Processor name: node062.hpc.local
 +
Master (0/1)
 +
</pre>
  
 
===== Boost v1.57.0 =====  
 
===== Boost v1.57.0 =====  
The above code snippet verifies Boost.MPI library functionality.  
+
The above code snippet is intended to verify Boost.MPI library functionality. Follow the steps below
 
<pre>
 
<pre>
 
</pre>
 
</pre>

Revision as of 14:59, 19 March 2015

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 but not the system default version.

#include <iostream>
// The boost headers
#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 processor_name( env.processor_name() );

  // permits communication and synchronization among a set of processes
  boost::mpi::communicator world;
  unsigned int rank( world.rank() ), numprocessors( world.size() );

  if ( rank == 0 ) {
	std::cout << "Processor name: " << processor_name << "\n";
	std::cout << "Master (" << rank << "/" << numprocessors << ")\n";
  } else {
	std::cout << "Slave  (" << rank << "/" << numprocessors << ")\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:

Load the appropriate Boost version module:

[asrini@consign ~]$ bsub -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 -lboost_system -lboost_filesystem -lboost_graph_parallel -lboost_iostreams boost_test.cpp -o Boost

Verify that the executable created was indeed compiled against this version of Boost:


[asrini@node062 ~]$ $ ldd Boost
	linux-vdso.so.1 =>  (0x00007fffebbff000)
	libboost_mpi.so.1.55.0 => /opt/software/boost/1.55.0/lib/libboost_mpi.so.1.55.0 (0x00002b69ecb97000)
	libboost_serialization.so.1.55.0 => /opt/software/boost/1.55.0/lib/libboost_serialization.so.1.55.0 (0x00002b69ecdc7000)
	libboost_system.so.1.55.0 => /opt/software/boost/1.55.0/lib/libboost_system.so.1.55.0 (0x00002b69ed041000)
	libboost_filesystem.so.1.55.0 => /opt/software/boost/1.55.0/lib/libboost_filesystem.so.1.55.0 (0x00002b69ed244000)
	libboost_graph_parallel.so.1.55.0 => /opt/software/boost/1.55.0/lib/libboost_graph_parallel.so.1.55.0 (0x00002b69ed45b000)
	libboost_iostreams.so.1.55.0 => /opt/software/boost/1.55.0/lib/libboost_iostreams.so.1.55.0 (0x00002b69ed6a3000)
	libmpi_cxx.so.1 => /usr/lib64/openmpi/lib/libmpi_cxx.so.1 (0x00002b69ed8bc000)
	libmpi.so.1 => /usr/lib64/openmpi/lib/libmpi.so.1 (0x00000030d6800000)
	libstdc++.so.6 => /usr/lib64/libstdc++.so.6 (0x00000030d5400000)
	libm.so.6 => /lib64/libm.so.6 (0x00000030d3800000)
	libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00000030d5c00000)
	libpthread.so.0 => /lib64/libpthread.so.0 (0x00000030d4000000)
	libc.so.6 => /lib64/libc.so.6 (0x00000030d3c00000)
	librt.so.1 => /lib64/librt.so.1 (0x00000030d4c00000)
	libz.so.1 => /lib64/libz.so.1 (0x00000030d4800000)
	libbz2.so.1 => /lib64/libbz2.so.1 (0x00000030d8c00000)
	libopen-rte.so.7 => /usr/lib64/openmpi/lib/libopen-rte.so.7 (0x00000030d6000000)
	libopen-pal.so.6 => /usr/lib64/openmpi/lib/libopen-pal.so.6 (0x00000030d6400000)
	libdl.so.2 => /lib64/libdl.so.2 (0x00000030d4400000)
	libnsl.so.1 => /lib64/libnsl.so.1 (0x00000030d6c00000)
	libutil.so.1 => /lib64/libutil.so.1 (0x00000030d7800000)
	libltdl.so.7 => /usr/lib64/libltdl.so.7 (0x00000030d5000000)
	/lib64/ld-linux-x86-64.so.2 (0x00000030d3400000)

Test run this program:

[asrini@node062 ~]$ /Boost
Processor name: node062.hpc.local
Master (0/1)
Boost v1.57.0

The above code snippet is intended to verify Boost.MPI library functionality. Follow the steps below



Other Pages