|
| 1 | +#!/bin/bash |
| 2 | +# SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. |
| 3 | +# SPDX-License-Identifier: Apache-2.0 |
| 4 | + |
| 5 | +# Builds libcudf and its gtests from source with CMAKE_BUILD_TYPE=Debug and runs the gtests. |
| 6 | +# Must be run on a GPU node since the build targets the native GPU architecture. |
| 7 | + |
| 8 | +set -euo pipefail |
| 9 | + |
| 10 | +# Support invoking test_cpp_debug.sh outside the script directory |
| 11 | +cd "$(dirname "$(realpath "${BASH_SOURCE[0]}")")"/../ |
| 12 | + |
| 13 | +rapids-logger "Create debug build conda environment" |
| 14 | +. /opt/conda/etc/profile.d/conda.sh |
| 15 | + |
| 16 | +rapids-logger "Configuring conda strict channel priority" |
| 17 | +conda config --set channel_priority strict |
| 18 | + |
| 19 | +ENV_YAML_DIR="$(mktemp -d)" |
| 20 | + |
| 21 | +rapids-dependency-file-generator \ |
| 22 | + --output conda \ |
| 23 | + --file-key test_cpp_debug \ |
| 24 | + --matrix "cuda=${RAPIDS_CUDA_VERSION%.*};arch=$(arch)" | tee "${ENV_YAML_DIR}/env.yaml" |
| 25 | + |
| 26 | +rapids-mamba-retry env create --yes -f "${ENV_YAML_DIR}/env.yaml" -n test_cpp_debug |
| 27 | + |
| 28 | +# Temporarily allow unbound variables for conda activation. |
| 29 | +set +u |
| 30 | +conda activate test_cpp_debug |
| 31 | +set -u |
| 32 | + |
| 33 | +# Keep the preprocessor cache separate from the Release conda builds since the flags never match. |
| 34 | +SCCACHE_S3_PREPROCESSOR_CACHE_KEY_PREFIX="libcudf-$(arch)-cuda${RAPIDS_CUDA_VERSION%%.*}-debug-preprocessor-cache" |
| 35 | +export SCCACHE_S3_PREPROCESSOR_CACHE_KEY_PREFIX |
| 36 | +export SCCACHE_S3_USE_PREPROCESSOR_CACHE_MODE=true |
| 37 | + |
| 38 | +source rapids-configure-sccache |
| 39 | + |
| 40 | +export CMAKE_GENERATOR=Ninja |
| 41 | + |
| 42 | +rapids-print-env |
| 43 | + |
| 44 | +rapids-logger "Check GPU usage" |
| 45 | +nvidia-smi |
| 46 | + |
| 47 | +sccache --stop-server 2>/dev/null || true |
| 48 | + |
| 49 | +rapids-logger "Build libcudf and gtests (Debug)" |
| 50 | +# -g: Debug build, -n: do not install, benchmarks are not built unless requested. |
| 51 | +# The GPU architecture defaults to the native GPU on this node. |
| 52 | +./build.sh -g -n libcudf tests |
| 53 | + |
| 54 | +sccache --show-adv-stats |
| 55 | +sccache --stop-server >/dev/null 2>&1 || true |
| 56 | + |
| 57 | +EXITCODE=0 |
| 58 | +trap "EXITCODE=1" ERR |
| 59 | +set +e |
| 60 | + |
| 61 | +rapids-logger "Run libcudf gtests (Debug)" |
| 62 | +# Debug host code is unoptimized, so allow more time than ci/test_cpp.sh does. |
| 63 | +timeout 2h ctest --test-dir cpp/build --output-on-failure --no-tests=error -j20 |
| 64 | + |
| 65 | +rapids-logger "Test script exiting with value: $EXITCODE" |
| 66 | +exit ${EXITCODE} |
0 commit comments