...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
Boost.Compute is available in Boost starting with version 1.61. Visit http://www.boost.org/users/download/ for download instructions.
Boost.Compute is a header-only library, so no linking is required. To use the library just add the include directory to the compilation flags and link with the system's OpenCL library. For example, with GCC:
g++ -I/path/to/compute/include main.cpp -lOpenCL
All of the Boost.Compute headers can be included with the following directive:
#include <boost/compute.hpp>
If you only want to include the core OpenCL wrapper headers (which have minimal dependencies on the rest of Boost), use the following directive:
#include <boost/compute/core.hpp>
All of the classes and functions in Boost.Compute live in the boost::compute
namespace and can be brought into
global scope with:
using namespace boost::compute;
Boost.Compute provides a number of optional features which can be configured with the following macros.
Macro |
Description |
---|---|
|
When defined, if program::build() fails, the program source and build log will be written to stdout. |
|
Enables the use of C++11 |
|
Builds Boost.Compute in a thread-safe mode. This requires either
support for C++11 thread-local storage (via defining the |
|
Enables the offline-cache which stores compiled binaries on disk. This option requires linking with Boost.Filesystem and Boost.System. |
Bugs and issues can be reported to the issue tracker.
There is also a mailing list for users and developers at https://groups.google.com/forum/#!forum/boost-compute.
Look through the FAQ to see if you're encountering a known or common issue.