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

Commit d4065fd

Browse files
committed
Add gpuCI GPU testing, automatic GPU detection, and support for more compilers:
* CMake: Add support for detecting the compute archs of the GPUs in your system at configure time. * gpuCI: Add a GPU node configuration that builds and tests as little as possible. * gpuCI: Cleanup logic for different build and test configurations. * gpuCI: Fix an unfortunate typo in `determine_build_parallelism.bash` which led to the parallelism level not being set. * gpuCI: Add support for NVC++. * gpuCI: Update to CUDA 11.1 and Ubuntu 20.04. * gpuCI: Add NVC++ and ICC configurations to the CPU axis file. * gpuCI: Add a GPU axis file. * gpuCI: Increase the desired memory per build thread to 4GB. * gpuCI: Add a -j switch which controls build parallelism to `ci/local/build.bash`. * gpuCI: Add support for CMake build types.
1 parent 1af8ccb commit d4065fd

7 files changed

Lines changed: 390 additions & 102 deletions

File tree

ci/axis/cpu.yml

Lines changed: 69 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,27 @@
1+
# Copyright (c) 2018-2020 NVIDIA Corporation
2+
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
3+
# Released under the Apache License v2.0 with LLVM Exceptions.
4+
# See https://llvm.org/LICENSE.txt for license information.
5+
6+
SDK_TYPE:
7+
- nvcr.io/nvidia/cuda
8+
- nvcr.io/nvidia/nvhpc
9+
10+
SDK_VER:
11+
- 11.1-devel
12+
- 20.9-devel
13+
14+
OS_TYPE:
15+
- ubuntu
16+
117
OS_VER:
2-
- ubuntu18.04
18+
- 20.04-devel
319

420
CXX_TYPE:
5-
- gcc
21+
- nvcxx
622
- clang
23+
- gcc
24+
- icc
725

826
CXX_VER:
927
- 5
@@ -12,17 +30,61 @@ CXX_VER:
1230
- 8
1331
- 9
1432
- 10
33+
- 20.9
34+
- latest
1535

1636
exclude:
17-
# Unsupported compiler version
37+
# Excludes by `SDK_TYPE`.
38+
- CXX_TYPE: clang
39+
SDK_TYPE: nvcr.io/nvidia/nvhpc
40+
- CXX_TYPE: icc
41+
SDK_TYPE: nvcr.io/nvidia/nvhpc
42+
# Excludes by `SDK_VER`.
43+
- SDK_TYPE: nvcr.io/nvidia/cuda
44+
SDK_VER: 20.9-devel
45+
- SDK_TYPE: nvcr.io/nvidia/nvhpc
46+
SDK_VER: 11.1-devel
47+
# Excludes by `CXX_VER`.
48+
- CXX_TYPE: nvcxx
49+
CXX_VER: 5
50+
- CXX_TYPE: nvcxx
51+
CXX_VER: 6
52+
- CXX_TYPE: nvcxx
53+
CXX_VER: 7
54+
- CXX_TYPE: nvcxx
55+
CXX_VER: 8
56+
- CXX_TYPE: nvcxx
57+
CXX_VER: 9
58+
- CXX_TYPE: nvcxx
59+
CXX_VER: 10
60+
- CXX_TYPE: nvcxx
61+
CXX_VER: latest
62+
- CXX_TYPE: gcc
63+
CXX_VER: 20.9
64+
- CXX_TYPE: gcc
65+
CXX_VER: latest
1866
- CXX_TYPE: clang
1967
CXX_VER: 5
20-
# This config is broken in the docker image: https://github.com/NVIDIA/cccl/issues/6
2168
- CXX_TYPE: clang
2269
CXX_VER: 6
23-
# Needs newer nvcc in image, https://github.com/NVIDIA/cccl/issues/7
2470
- CXX_TYPE: clang
2571
CXX_VER: 10
26-
# Config broken in image: https://github.com/NVIDIA/cccl/issues/8
27-
- CXX_TYPE: gcc
72+
- CXX_TYPE: clang
73+
CXX_VER: 20.9
74+
- CXX_TYPE: clang
75+
CXX_VER: latest
76+
- CXX_TYPE: icc
77+
CXX_VER: 5
78+
- CXX_TYPE: icc
79+
CXX_VER: 6
80+
- CXX_TYPE: icc
81+
CXX_VER: 7
82+
- CXX_TYPE: icc
83+
CXX_VER: 8
84+
- CXX_TYPE: icc
85+
CXX_VER: 9
86+
- CXX_TYPE: icc
2887
CXX_VER: 10
88+
- CXX_TYPE: icc
89+
CXX_VER: 20.9
90+

ci/axis/gpu.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Copyright (c) 2018-2020 NVIDIA Corporation
2+
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
3+
# Released under the Apache License v2.0 with LLVM Exceptions.
4+
# See https://llvm.org/LICENSE.txt for license information.
5+
6+
SDK_TYPE:
7+
- nvcr.io/nvidia/cuda
8+
9+
SDK_VER:
10+
- 11.1-devel
11+
12+
OS_TYPE:
13+
- ubuntu
14+
15+
OS_VER:
16+
- 20.04-devel
17+
18+
CXX_TYPE:
19+
- gcc
20+
21+
CXX_VER:
22+
- 7
23+

ci/common/build.bash

Lines changed: 103 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ function logger() {
2020
# VARIABLES - Set up bash and environmental variables.
2121
################################################################################
2222

23+
SCRIPT_PATH=$(cd $(dirname ${0}); pwd -P)
24+
2325
# Get the variables the Docker container set up for us: ${CXX}, ${CUDACXX}, etc.
2426
source /etc/cccl.bashrc
2527

@@ -34,62 +36,122 @@ cd ${WORKSPACE}
3436
mkdir -p build
3537
cd build
3638

39+
if [[ ! -z "${PARALLEL_LEVEL}" ]]; then
40+
DETERMINE_PARALLELISM_FLAGS="-j ${PARALLEL_LEVEL}"
41+
fi
42+
43+
if [[ ! -z "${CMAKE_BUILD_TYPE}" ]]; then
44+
CMAKE_BUILD_TYPE="Release"
45+
fi
46+
3747
# The Docker image sets up `${CXX}` and `${CUDACXX}`.
38-
CMAKE_FLAGS="-G Ninja -DCMAKE_CXX_COMPILER='${CXX}' -DCMAKE_CUDA_COMPILER='${CUDACXX}'"
39-
40-
if [ "${BUILD_MODE}" == "branch" ]; then
41-
# Post-commit build.
42-
CMAKE_FLAGS="${CMAKE_FLAGS} -DTHRUST_INCLUDE_CUB_CMAKE=ON"
43-
CMAKE_FLAGS="${CMAKE_FLAGS} -DTHRUST_ENABLE_MULTICONFIG=ON"
44-
CMAKE_FLAGS="${CMAKE_FLAGS} -DTHRUST_MULTICONFIG_ENABLE_DIALECT_CPP11=ON"
45-
CMAKE_FLAGS="${CMAKE_FLAGS} -DTHRUST_IGNORE_DEPRECATED_CPP_11=ON"
46-
CMAKE_FLAGS="${CMAKE_FLAGS} -DTHRUST_MULTICONFIG_ENABLE_DIALECT_CPP14=ON"
47-
CMAKE_FLAGS="${CMAKE_FLAGS} -DTHRUST_MULTICONFIG_ENABLE_DIALECT_CPP17=OFF"
48-
CMAKE_FLAGS="${CMAKE_FLAGS} -DTHRUST_MULTICONFIG_ENABLE_SYSTEM_CPP=ON"
49-
CMAKE_FLAGS="${CMAKE_FLAGS} -DTHRUST_MULTICONFIG_ENABLE_SYSTEM_TBB=ON"
50-
CMAKE_FLAGS="${CMAKE_FLAGS} -DTHRUST_MULTICONFIG_ENABLE_SYSTEM_OMP=ON"
51-
CMAKE_FLAGS="${CMAKE_FLAGS} -DTHRUST_MULTICONFIG_ENABLE_SYSTEM_CUDA=ON"
52-
CMAKE_FLAGS="${CMAKE_FLAGS} -DTHRUST_MULTICONFIG_WORKLOAD=LARGE"
48+
CMAKE_FLAGS="-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DCMAKE_CUDA_COMPILER='${CUDACXX}'"
49+
50+
# NVC++ requires special configuration; if we're using the NVHPC SDK, we assume
51+
# we're using NVC++.
52+
if [[ ! -z "${HPCSDK_VERSION}" ]]; then
53+
# NVC++ isn't properly detected by CMake, so we have to tell CMake to ignore
54+
# detection and explicit provide the compiler ID. Ninja currently isn't
55+
# supported, so we just use makefiles.
56+
CMAKE_FLAGS="${CMAKE_FLAGS} -DCMAKE_CUDA_COMPILER_FORCED=ON -DCMAKE_CUDA_COMPILER_ID='NVCXX'"
57+
# NVC++ currently uses a lot of memory.
58+
PARALLEL_LEVEL=1
5359
else
54-
# Pre-commit build.
55-
CMAKE_FLAGS="${CMAKE_FLAGS} -DTHRUST_DISABLE_ARCH_BY_DEFAULT=ON"
56-
CMAKE_FLAGS="${CMAKE_FLAGS} -DTHRUST_ENABLE_COMPUTE_50=ON"
57-
CMAKE_FLAGS="${CMAKE_FLAGS} -DTHRUST_ENABLE_COMPUTE_60=ON"
58-
CMAKE_FLAGS="${CMAKE_FLAGS} -DTHRUST_ENABLE_COMPUTE_70=ON"
59-
CMAKE_FLAGS="${CMAKE_FLAGS} -DTHRUST_ENABLE_COMPUTE_80=ON"
60-
CMAKE_FLAGS="${CMAKE_FLAGS} -DTHRUST_INCLUDE_CUB_CMAKE=ON"
61-
CMAKE_FLAGS="${CMAKE_FLAGS} -DTHRUST_ENABLE_MULTICONFIG=ON"
62-
CMAKE_FLAGS="${CMAKE_FLAGS} -DTHRUST_MULTICONFIG_ENABLE_DIALECT_CPP11=ON"
63-
CMAKE_FLAGS="${CMAKE_FLAGS} -DTHRUST_IGNORE_DEPRECATED_CPP_11=ON"
64-
CMAKE_FLAGS="${CMAKE_FLAGS} -DTHRUST_MULTICONFIG_ENABLE_DIALECT_CPP14=ON"
65-
CMAKE_FLAGS="${CMAKE_FLAGS} -DTHRUST_MULTICONFIG_ENABLE_DIALECT_CPP17=OFF"
66-
CMAKE_FLAGS="${CMAKE_FLAGS} -DTHRUST_MULTICONFIG_ENABLE_SYSTEM_CPP=ON"
67-
CMAKE_FLAGS="${CMAKE_FLAGS} -DTHRUST_MULTICONFIG_ENABLE_SYSTEM_TBB=ON"
68-
CMAKE_FLAGS="${CMAKE_FLAGS} -DTHRUST_MULTICONFIG_ENABLE_SYSTEM_OMP=ON"
69-
CMAKE_FLAGS="${CMAKE_FLAGS} -DTHRUST_MULTICONFIG_ENABLE_SYSTEM_CUDA=ON"
70-
CMAKE_FLAGS="${CMAKE_FLAGS} -DTHRUST_MULTICONFIG_WORKLOAD=SMALL"
60+
# If we're using NVCC, we need to set the host compiler.
61+
CMAKE_FLAGS="${CMAKE_FLAGS} -DCMAKE_CXX_COMPILER='${CXX}' -G Ninja"
7162
fi
7263

73-
CMAKE_BUILD_FLAGS="-j${PARALLEL_LEVEL}"
64+
# COVERAGE_PLAN options:
65+
# * Exhaustive
66+
# * Thorough
67+
# * Minimal
68+
if [[ ! -z "${COVERAGE_PLAN}" ]]; then
69+
if [[ "${BUILD_TYPE}" == "cpu" ]] && [[ "${BUILD_MODE}" == "branch" ]]; then
70+
# Post-commit CPU CI builds.
71+
COVERAGE_PLAN="Exhaustive"
72+
elif [[ "${BUILD_TYPE}" == "cpu" ]]; then
73+
# Pre-commit CPU CI builds.
74+
COVERAGE_PLAN="Thorough"
75+
elif [[ "${BUILD_TYPE}" == "gpu" ]]; then
76+
# Pre- and post-commit GPU CI builds.
77+
COVERAGE_PLAN="Minimal"
78+
fi
79+
fi
7480

75-
if [ ! -z "${@}" ]; then
76-
CMAKE_BUILD_FLAGS="${CMAKE_BUILD_FLAGS} -- ${@}"
81+
case "${COVERAGE_PLAN}" in
82+
EXHAUSTIVE)
83+
CMAKE_FLAGS="${CMAKE_FLAGS} -DTHRUST_INCLUDE_CUB_CMAKE=ON"
84+
CMAKE_FLAGS="${CMAKE_FLAGS} -DTHRUST_ENABLE_MULTICONFIG=ON"
85+
CMAKE_FLAGS="${CMAKE_FLAGS} -DTHRUST_MULTICONFIG_ENABLE_DIALECT_CPP11=ON"
86+
CMAKE_FLAGS="${CMAKE_FLAGS} -DTHRUST_IGNORE_DEPRECATED_CPP_11=ON"
87+
CMAKE_FLAGS="${CMAKE_FLAGS} -DTHRUST_MULTICONFIG_ENABLE_DIALECT_CPP14=ON"
88+
CMAKE_FLAGS="${CMAKE_FLAGS} -DTHRUST_MULTICONFIG_ENABLE_DIALECT_CPP17=OFF"
89+
CMAKE_FLAGS="${CMAKE_FLAGS} -DTHRUST_MULTICONFIG_ENABLE_SYSTEM_CPP=ON"
90+
CMAKE_FLAGS="${CMAKE_FLAGS} -DTHRUST_MULTICONFIG_ENABLE_SYSTEM_TBB=ON"
91+
CMAKE_FLAGS="${CMAKE_FLAGS} -DTHRUST_MULTICONFIG_ENABLE_SYSTEM_OMP=ON"
92+
CMAKE_FLAGS="${CMAKE_FLAGS} -DTHRUST_MULTICONFIG_ENABLE_SYSTEM_CUDA=ON"
93+
CMAKE_FLAGS="${CMAKE_FLAGS} -DTHRUST_MULTICONFIG_WORKLOAD=LARGE"
94+
;;
95+
THOROUGH)
96+
CMAKE_FLAGS="${CMAKE_FLAGS} -DTHRUST_INCLUDE_CUB_CMAKE=ON"
97+
CMAKE_FLAGS="${CMAKE_FLAGS} -DTHRUST_ENABLE_MULTICONFIG=ON"
98+
CMAKE_FLAGS="${CMAKE_FLAGS} -DTHRUST_MULTICONFIG_ENABLE_DIALECT_CPP11=ON"
99+
CMAKE_FLAGS="${CMAKE_FLAGS} -DTHRUST_IGNORE_DEPRECATED_CPP_11=ON"
100+
CMAKE_FLAGS="${CMAKE_FLAGS} -DTHRUST_MULTICONFIG_ENABLE_DIALECT_CPP14=ON"
101+
CMAKE_FLAGS="${CMAKE_FLAGS} -DTHRUST_MULTICONFIG_ENABLE_DIALECT_CPP17=OFF"
102+
CMAKE_FLAGS="${CMAKE_FLAGS} -DTHRUST_MULTICONFIG_ENABLE_SYSTEM_CPP=ON"
103+
CMAKE_FLAGS="${CMAKE_FLAGS} -DTHRUST_MULTICONFIG_ENABLE_SYSTEM_TBB=ON"
104+
CMAKE_FLAGS="${CMAKE_FLAGS} -DTHRUST_MULTICONFIG_ENABLE_SYSTEM_OMP=ON"
105+
CMAKE_FLAGS="${CMAKE_FLAGS} -DTHRUST_MULTICONFIG_ENABLE_SYSTEM_CUDA=ON"
106+
CMAKE_FLAGS="${CMAKE_FLAGS} -DTHRUST_MULTICONFIG_WORKLOAD=SMALL"
107+
CMAKE_FLAGS="${CMAKE_FLAGS} -DTHRUST_AUTO_DETECT_COMPUTE_ARCHS=ON"
108+
CMAKE_FLAGS="${CMAKE_FLAGS} -DTHRUST_ENABLE_COMPUTE_50=ON"
109+
CMAKE_FLAGS="${CMAKE_FLAGS} -DTHRUST_ENABLE_COMPUTE_60=ON"
110+
CMAKE_FLAGS="${CMAKE_FLAGS} -DTHRUST_ENABLE_COMPUTE_70=ON"
111+
CMAKE_FLAGS="${CMAKE_FLAGS} -DTHRUST_ENABLE_COMPUTE_80=ON"
112+
;;
113+
MINIMAL)
114+
CMAKE_FLAGS="${CMAKE_FLAGS} -DTHRUST_INCLUDE_CUB_CMAKE=ON"
115+
CMAKE_FLAGS="${CMAKE_FLAGS} -DCUB_ENABLE_THOROUGH_TESTING=OFF"
116+
CMAKE_FLAGS="${CMAKE_FLAGS} -DCUB_ENABLE_BENCHMARK_TESTING=OFF"
117+
CMAKE_FLAGS="${CMAKE_FLAGS} -DCUB_ENABLE_MINIMAL_TESTING=ON"
118+
CMAKE_FLAGS="${CMAKE_FLAGS} -DTHRUST_HOST_SYSTEM=CPP"
119+
CMAKE_FLAGS="${CMAKE_FLAGS} -DTHRUST_DEVICE_SYSTEM=CUDA"
120+
CMAKE_FLAGS="${CMAKE_FLAGS} -DTHRUST_CPP_DIALECT=14"
121+
CMAKE_FLAGS="${CMAKE_FLAGS} -DTHRUST_AUTO_DETECT_COMPUTE_ARCHS=ON"
122+
;;
123+
esac
124+
125+
if [[ ! -z "${@}" ]]; then
126+
CMAKE_BUILD_FLAGS="-- ${@}"
77127
fi
78128

79129
CTEST_FLAGS=""
80130

81-
if [ "${BUILD_TYPE}" == "cpu" ]; then
131+
if [[ "${BUILD_TYPE}" == "cpu" ]]; then
82132
CTEST_FLAGS="${CTEST_FLAGS} -E ^cub|^thrust.*cuda"
83133
fi
84134

85-
if [ ! -z "${@}" ]; then
135+
if [[ ! -z "${@}" ]]; then
86136
CTEST_FLAGS="${CTEST_FLAGS} -R ^${@}$"
87137
fi
88138

139+
# Export variables so they'll show up in the logs when we report the environment.
140+
export COVERAGE_PLAN
141+
export CMAKE_FLAGS
142+
export CMAKE_BUILD_FLAGS
143+
export CTEST_FLAGS
144+
89145
################################################################################
90146
# ENVIRONMENT - Configure and print out information about the environment.
91147
################################################################################
92148

149+
logger "Determine system topology..."
150+
151+
# Set `${PARALLEL_LEVEL}` if it is unset; otherwise, this just reports the
152+
# system topology.
153+
source ${SCRIPT_PATH}/determine_build_parallelism.bash ${DETERMINE_PARALLELISM_FLAGS}
154+
93155
logger "Get environment..."
94156
env
95157

@@ -102,15 +164,18 @@ ${CUDACXX} --version
102164
################################################################################
103165

104166
logger "Configure Thrust and CUB..."
167+
echo cmake .. ${CMAKE_FLAGS}
105168
cmake .. ${CMAKE_FLAGS}
106169

107170
logger "Build Thrust and CUB..."
108-
cmake --build . ${CMAKE_BUILD_FLAGS}
171+
echo cmake --build . ${CMAKE_BUILD_FLAGS} -j ${PARALLEL_LEVEL}
172+
cmake --build . ${CMAKE_BUILD_FLAGS} -j ${PARALLEL_LEVEL}
109173

110174
################################################################################
111175
# TEST - Run Thrust and CUB examples and tests.
112176
################################################################################
113177

114178
logger "Test Thrust and CUB..."
179+
echo ctest ${CTEST_FLAGS}
115180
ctest ${CTEST_FLAGS}
116181

0 commit comments

Comments
 (0)