@@ -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.
2426source /etc/cccl.bashrc
2527
@@ -34,62 +36,122 @@ cd ${WORKSPACE}
3436mkdir -p build
3537cd 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
5359else
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"
7162fi
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=" -- ${@ } "
77127fi
78128
79129CTEST_FLAGS=" "
80130
81- if [ " ${BUILD_TYPE} " == " cpu" ]; then
131+ if [[ " ${BUILD_TYPE} " == " cpu" ] ]; then
82132 CTEST_FLAGS=" ${CTEST_FLAGS} -E ^cub|^thrust.*cuda"
83133fi
84134
85- if [ ! -z " ${@ } " ]; then
135+ if [[ ! -z " ${@ } " ] ]; then
86136 CTEST_FLAGS=" ${CTEST_FLAGS} -R ^${@ } $"
87137fi
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+
93155logger " Get environment..."
94156env
95157
@@ -102,15 +164,18 @@ ${CUDACXX} --version
102164# ###############################################################################
103165
104166logger " Configure Thrust and CUB..."
167+ echo cmake .. ${CMAKE_FLAGS}
105168cmake .. ${CMAKE_FLAGS}
106169
107170logger " 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
114178logger " Test Thrust and CUB..."
179+ echo ctest ${CTEST_FLAGS}
115180ctest ${CTEST_FLAGS}
116181
0 commit comments