Boost.Python

Note

SCARF is migrating to the SLURM batch system, instructions on this page which refer to LSF commands, parameters or configuration do not apply to SLURM. Please see our SLURM page for more information.

RHEL7 Modules:

Description for page_under_construction:

Source: https://wiki.python.org/moin/boost.python/GettingStarted

Boost.Python is a library within the Boost C++ Libraries that simplifies the integration of C++ code with Python. It facilitates the creation of Python bindings for C++ classes, making it easier to extend Python functionalities with C++ modules.

Using page_under_construction:

module load boost.python

An example of how to use Boost.Python can be seen in the Hello World tutorial (source: http://boostorg.github.io/python/doc/html/tutorial/index.html#tutorial.quickstart)

First, a C++ function is created:

char const* greet()
{
return "hello, world";
}

This is then exposed to Python by writing a Boost.Python wrapper:

#include <boost/python.hpp>

BOOST_PYTHON_MODULE(hello_ext)
{
    using namespace boost::python;
    def("greet", greet);
}

This can then be built as a shared library. The resulting DLL will then be visible to Python. Here’s a sample Python session:

>>> import hello_ext
>>> print hello_ext.greet()
hello, world

There are many ways in which a module can be built. The documentation uses bjam, as shown on this page: http://boostorg.github.io/python/doc/html/tutorial/tutorial/hello.html

Documentation for page_under_construction:

Documentation can be found here:

https://www.boost.org/doc/libs/1_84_0/libs/python/doc/html/index.html

Tutorials can be found online:

http://boostorg.github.io/python/doc/html/tutorial/index.html

GitHub:

https://github.com/boostorg/python

We don’t yet provide any specific documentation for this software, if you need assistance please contact the helpdesk.