Building From Source — stdgpu Latest documentation (original) (raw)

Contents

Building From Source#

This guide shows you how to build stdgpu from source. Since we use CMake for cross-platform building, the building instructions should work across operating systems and distributions. Furthermore, the prerequisites cover specific instructions to install the build dependencies on Linux (Ubuntu) and Windows.

Prerequisites#

Before building the library, please make sure that all required development tools and dependencies for the respective backend are installed on your system. The following table shows the minimum required versions of each depenency. Newer versions of these tools are supported as well.

Linux (Ubuntu)

CUDA

OpenMP

HIP (experimental)

Windows

CUDA

OpenMP

HIP (experimental)

While the instructions will likely also work for instance for Debian, other Linux distributions (e.g. Arch Linux and derivatives) may use a different naming scheme for the required packages.

Downloading the Source Code#

In order to get the source code needed for building, the most common approach is to clone the upstream GitHub repository.

git clone https://github.com/stotko/stdgpu

Build Instructions#

Since stdgpu is built with CMake, the usual steps for building CMake-based projects can be performed here as well. In the examplary instructions below, we built stdgpu in Release mode and installed it into a local bin directory. Different modes and installation directories works can be used in a similar way.

Configuring#

First, a build directory (usually build/) should be created and the build configuration should be evaluated by CMake and stored into this directory.

Direct Command

mkdir build cmake -B build -S . -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=bin

Provided Script

bash tools/backend/configure_cuda.sh Release

If you leave out CMAKE_INSTALL_PREFIX, CMake will automatically select an appropriate (platform-dependent) system directory for installation instead.

See also

A complete list of options used via -D<option>=<value> to control the build of stdgpu can be found in Configuration Options.

Compiling#

Then, the library itself as well as further components (examples, benchmarks, or tests depending on the configuration) are compiled. To speed-up the compilation, the maximum number of parallel jobs used for building can be specified to override the default number.

Direct Command

cmake --build build --config Release --parallel 8

Provided Script

bash tools/build.sh Release

Testing#

Running the unit tests is optional but recommended to verify that all features of stdgpu work correctly on your system. This requires the CMake option STDGPU_BUILD_TESTS to be set to ON during configuration (already the default if not altered), see Configuration Options for a complete list of options.

Direct Command

cmake -E chdir build ctest -V -C Release

Provided Script

bash tools/run_tests.sh Release

Installing#

As a final optional step, you can install the locally compiled version of stdgpu on your system.

Direct Command

cmake --install build --config Release

Uninstalling

If the build/ directory from which stdgpu has been installed has not been deleted, you can also revert the installation by calling the uninstall target:

cmake --build build --config Release --target uninstall

Provided Script

bash tools/install.sh Release

Uninstalling

If the build/ directory from which stdgpu has been installed is still present, you can revert the installation by running the uninstall script:

bash tools/uninstall.sh Release

Configuration Options#

Building stdgpu from source can be customized in various ways. The following list of CMake options divided into build-related and library-related options can be used for this purpose.