Skip to content
This repository was archived by the owner on Mar 21, 2024. It is now read-only.
This repository was archived by the owner on Mar 21, 2024. It is now read-only.

Enable multiconfig builds for testing / validation #1159

@alliepiper

Description

@alliepiper

Problem

Currently, a Thrust build must be reconfigured and rebuilt to test and validate various host/device system combinations. This quickly gets tedious when testing whether a change will break any of the backends.

Being an NVIDIA product, the core Thrust developers tend to focus on the HOST=CPP DEVICE=CUDA configuration, and bugs sometimes slip into the other backends that go unnoticed until a user reports them.

By simplifying the process of testing other configurations, we can provide a more stable and reliable product to users that rely on the OpenMP and TBB backends. This will also be useful as our CI improves, as we can have a single CI build generate multiple configurations.

Overview

I propose adding a THRUST_ENABLE_MULTICONFIG cmake option. By default, this will be off and everything will work as it does now. But when enabled, this will:

  • Hide and ignore the THRUST_HOST_SYSTEM / THRUST_DEVICE_SYSTEM cache options.
  • Create new THRUST_MULTICONFIG_WORKLOAD option with settings FULL, LARGE, MEDIUM, SMALL (Default MEDIUM).
  • Create new THRUST_MULTICONFIG_ENABLE_${system} boolean options (Default ON).
  • Create new THRUST_MULTICONFIG_ENABLE_CPPXX boolean options for C++11, C++14, and C++17. Default is just C++14.
  • Generate tests, examples, and header-tests for a variety of host/device configuration.

Configurations

The THRUST_MULTICONFIG_ENABLE_${system} options are used to specify the expected systems that a particular build should use. Dependencies of disabled systems will not be searched for, and any configurations that use a disabled system will not be tested. If a system is requested but an associated dependency is not found, a configuration error will occur.

The THRUST_MULTICONFIG_ENABLE_CPP11, THRUST_MULTICONFIG_ENABLE_CPP14, and THRUST_MULTICONFIG_ENABLE_CPP17 options will produce configurations for each of the indicated C++ dialects. By default, only C++14 is enabled.

The THRUST_MULTICONFIG_WORKLOAD option controls how much of the configuration space is tested. The full cross product of HOST={CPP, TBB, OMP} and DEVICE={CUDA, TBB, OMP, CPP} is quite expensive to build, so the workload may be adapted to suite available resources.

The full configuration space is divided into groups that maximize coverage while eliminating redundant or unusual configurations and minimizing expense. This provides a convenient way to balance the amount of coverage needed for a particular usecase (local pre-CI testing, CI, pre-release testing, etc) with the amount of computational resources.

  • SMALL: [3 configs] Minimal coverage and validation of each device system against the CPP host.
  • MEDIUM: [6 configs] Cheap extended coverage.
  • LARGE: [8 configs] Expensive extended coverage. Include all useful build configurations.
  • FULL: [12 configs] The complete cross product of all possible build configurations.
Config FULL LARGE MEDIUM SMALL Value Expense Note
CPP/CUDA X X X X Essential Expensive Validates CUDA against CPP
CPP/OMP X X X X Essential Cheap Validates OMP against CPP
CPP/TBB X X X X Essential Cheap Validates TBB against CPP
CPP/CPP X X X Important Cheap Tests CPP as device
OMP/OMP X X X Important Cheap Tests OMP as host
TBB/TBB X X X Important Cheap Tests TBB as host
TBB/CUDA X X Important Expensive Validates TBB/CUDA interop
OMP/CUDA X X Important Expensive Validates OMP/CUDA interop
TBB/OMP X Not useful Cheap Mixes CPU-parallel systems
OMP/TBB X Not useful Cheap Mixes CPU-parallel systems
TBB/CPP X Not Useful Cheap Parallel host, serial device
OMP/CPP X Not Useful Cheap Parallel host, serial device

Target Naming

The test/example names will need to be modified to reflect which configuration the executable belongs to. For instance:

thrust.[test|example].name --> thrust.[cpp|omp|tbb].[cuda|cpp|omp|tbb].cpp[11|14|17].[test|example].yyy

For non-multiconfig builds, the names will stay the same as they currently are.

Meta-targets

Custom CMake targets will be added to make it easier to build subsets of a single configuration.

Target Description
thrust.<host>.<device>.<dialect>.all All targets associated with the configuration
thrust.<host>.<device>.<dialect>.headers All header tests associated with the configuration
thrust.<host>.<device>.<dialect>.tests All tests associated with the configuration
thrust.<host>.<device>.<dialect>.examples All examples associated with the configuration
`thrust.meta.[test example].{name}`

Testing

Tests can be filtered by configuration by using -R <regex> when invoking CTest, e.g.:

ctest -R tbb.cuda.cpp17

Build Time Considerations

A detailed exploration of the compile time requirements of each configuration is in this comment. An overview of the relative build times for each workload and dialect is shown below.

Build time per workload

Metadata

Metadata

Assignees

Labels

only: cmakeCMake changes only. Doesn't need internal NVIDIA CI.

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions