Skip to content

Developer's Guide

Kyle Lutz edited this page Mar 8, 2016 · 6 revisions

Getting Started

Before beginning development ensure you can build the library and run the test-suite. The following steps show how to download, configure, compile and test.

# clone the repository
git clone https://github.com/boostorg/compute.git

# go to the compute directory
cd compute

# create a build directory
mkdir build

# go to the build directory
cd build

# run cmake, setup options for your system, enable BOOST_COMPUTE_BUILD_TESTS, and
# then click "Generate" (see below for more information on the cmake variables)
cmake-gui ..

# compile
make

# run the tests
ctest

Also be sure to read through the getting started guide and the tutorial.

Please send me an email ([email protected]) if you encounter any issues or have any questions.

Coding Style

  • Indentation is four-spaces (not tabs)
  • Try to keep line-length under 80 characters
  • Follow the STL/Boost naming conventions (lower case with underscores)
  • When in doubt, match the style of existing code
  • Otherwise, do whatever you want

Commit Messages

  • First line is a subject (no period at the end)
  • Second line is blank
  • Follow with one more paragraphs describing the change

Please make special note if a change requires existing code to be updated (e.g. for non-backwards compatible changes).

Submitting Patches

  • Patches can be submitted through the pull-request system on GitHub or through email.
  • Please try to rebase your changes on the current master branch before submitting.
  • Base your commits on the stable master branch but submit pull-requests against the develop branch (all commits are tested in develop before being merged to master).

Also read through the "How to write the perfect pull request" guide for some general advice on submitting pull-requests through GitHub.

CMake Flags

The following cmake flags are used to identify the OpenCL implementation on a system.

  • OPENCL_INCLUDE_DIRS
    • Should be set to the include path in order for the compiler to find the CL/cl.h header.
    • Example for NVIDIA on Linux: /usr/include/nvidia-current
  • OPENCL_LIBRARIES
    • Should be set to the libOpenCL.so file for the OpenCL implementation.
    • Example for NVIDIA on Linux: /usr/lib/nvidia-current/libOpenCL.so
    • Example for AMD on Linux: /usr/lib/fglrx/libOpenCL.so

The following cmake flags control building the Boost.Compute benchmarks, examples, and tests. Enable them to build those components.

  • BOOST_COMPUTE_BUILD_BENCHMARKS: enables the benchmarks in the perf/ directory
  • BOOST_COMPUTE_BUILD_EXAMPLES: enables the examples in the example/ directory
  • BOOST_COMPUTE_BUILD_TESTS: enables the tests in the test/ directory

Building and Running Tests

To build the tests you must enable the BOOST_COMPUTE_BUILD_TESTS option in cmake. The tests can be run by executing the ctest command from the build directory.

Please report any tests failures to the issue tracker along with the test's output and information on your system and compute device.

Environment Variables

There are a few environment variables which, when set, affect how Boost.Compute interacts with the system. The following variables will influence the default compute device returned from system::default_device().

  • BOOST_COMPUTE_DEFAULT_DEVICE: name of a compute device (e.g. "GTX TITAN")
  • BOOST_COMPUTE_DEFAULT_PLATFORM: name of a platform (e.g. "NVIDIA CUDA")
  • BOOST_COMPUTE_DEFAULT_VENDOR: name of a device vendor (e.g. "NVIDIA")

Open Projects

See the issues labeled task for a list of good projects to get started on.

Also, more tests are always helpful and a good way to get familiar with the code and development work-flow.