Difference between revisions of "HPC:Boost"

From HPC wiki
(Created page with "=== 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 c...")
 
Line 5: Line 5:
 
'''Note''' : The default version of Boost may not include all the desired libraries. For example MPI library bindings may not work as expected.   
 
'''Note''' : The default version of Boost may not include all the desired libraries. For example MPI library bindings may not work as expected.   
  
Boost v1.55.0 and v1.57.0 are both available as modules.
+
==== 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.
 +
 
 +
<pre>
 +
#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;
 +
}
 +
</pre>
 +
 
 +
Copy the code above into a file called boost_test.cpp
 +
 
 +
===== Boost v1.55.0 =====
 +
The above code snippet verifies Boost.MPI library functionality. 
 +
<pre>
 +
 
 +
 
 +
</pre>
 +
 
 +
 
 +
===== Boost v1.57.0 =====
 +
The above code snippet verifies Boost.MPI library functionality.
 +
<pre>
 +
</pre>
 +
 
 +
 
 +
=== Other Pages ===
 +
*[[HPC:Software|Available Software]]
 +
*[[HPC:User_Guide|User Guide]]
 +
*[[HPC:Main_Page|HPC Main Page]]
 +
*[[HPC:Login|Connecting to the PMACS cluster]]

Revision as of 14:52, 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 verifies Boost.MPI library functionality.




Boost v1.57.0

The above code snippet verifies Boost.MPI library functionality.



Other Pages