Files
project_6/cccl_upstream/ci/matx/build_matx.sh
muh-bot 2a7ca101d7 feat(cccl): integrate missing CCCL directories — python/, ci/, .agent/, docs/, test/
Sparse-checkout from NVIDIA/cccl main branch to complete cccl_upstream:

Added:
- python/cuda_cccl/ (226 files) — Python bindings for device-level algorithms
  Critical for muh toolchain: cuda.compute.reduce_into, scan, radix_sort, etc.
  Includes 204 .py files with full test coverage for all 27 algorithms
- ci/ (163 files) — Build/test infrastructure
  build_cub.sh, test_cub.sh, build_and_test_targets.sh, matrix.yaml
  Directly maps to our [INFRA-CI] and [INFRA-BUILD] items
- .agent/skills/ (7 files) — NVIDIA's own agent skills for CCCL
  cccl-style/SKILL.md, cccl-test/SKILL.md, sass-diff/SKILL.md
- docs/ (491 files) — Official CCCL documentation
  CI references, CMake guides, Python compute docs, libcudacxx PTX docs
- test/ (12 files) — Top-level integration tests (cuda_smoke, stdpar)
- Root configs: .clang-format, .clang-tidy, CONTRIBUTING.md, pyproject.toml
- CLAUDE.md symlink → AGENTS.md (NVIDIA's standard)

cccl_upstream now mirrors full NVIDIA/cccl structure:
  Before: 42M (cub + thrust + libcudacxx + cudax + c + examples + benchmarks)
  After:  53M (+python +ci +docs +.agent +test +configs)

This completes the CCCL base needed for:
- [muh-bench] items: ci/util/build_and_test_targets.sh for targeted builds
- [CCCL-verify] items: python/cuda_cccl/tests/ as reference implementations
- [CCCL-test] items: ci/test_cub.sh, ci/test_thrust.sh
- Agent workflow: .agent/skills/ for consistent style and test patterns
2026-08-07 02:34:33 +00:00

114 lines
3.1 KiB
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
readonly matx_repo=https://github.com/NVIDIA/MatX.git
readonly matx_branch=main
# Ensure the script is being executed in the root cccl directory:
cd "$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/../..";
log_vars() {
for var in "$@"; do
echo "${var}=${!var}"
done
}
# Take two version strings and return the greater of the two:
version_max() {
local v1="${1}"
local v2="${2}"
if ci/util/version_compare.sh "$v1" ge "$v2"; then
echo "$v1"
else
echo "$v2"
fi
}
# Get the current CCCL info:
readonly cccl_repo="${PWD}"
# Define CCCL_TAG to override the default CCCL SHA. Otherwise the current HEAD of the local checkout is used.
echo "CCCL_TAG (override): ${CCCL_TAG-}";
if test -n "${CCCL_TAG-}"; then
# If CCCL_TAG is defined, fetch it to the local checkout
git -C "${cccl_repo}" fetch origin "${CCCL_TAG}";
cccl_sha="$(git -C "${cccl_repo}" rev-parse FETCH_HEAD)";
else
cccl_sha="$(git -C "${cccl_repo}" rev-parse HEAD)";
fi
cccl_repo_version="$(git -C "${cccl_repo}" describe "${cccl_sha}"| grep -Eo '[0-9]+\.[0-9]+\.[0-9]+')"
readonly cccl_repo_version
# Define CCCL_VERSION to override the version used by rapids-cmake to patch CCCL.
echo "CCCL_VERSION (override): ${CCCL_VERSION-}";
if test -n "${CCCL_VERSION-}"; then
readonly cccl_rapids_cmake_version="${CCCL_VERSION}"
else
cccl_rapids_cmake_version="${cccl_repo_version}"
# shellcheck disable=SC2034
readonly cccl_rapids_cmake_version
fi
# If the current version is less than 2.8.0, use 2.8.0 for the rapids-cmake version.
# This is to allow rapids-cmake to correctly patch the CCCL install rules on current `main`.
cccl_version=$(version_max "${cccl_repo_version}" "2.8.0")
readonly cccl_version
readonly workdir="${cccl_repo}/build/${CCCL_BUILD_INFIX:-}/matx"
readonly version_file="${workdir}/MatX/cmake/versions.json"
readonly version_override_file="${workdir}/versions-override.json"
log_vars \
matx_repo matx_branch \
cccl_repo cccl_sha cccl_repo_version cccl_rapids_cmake_version \
workdir \
version_file version_override_file
mkdir -p "${workdir}"
cd "${workdir}"
# Python deps:
pip install numpy
# Clone MatX
rm -rf MatX
git clone "${matx_repo}" -b "${matx_branch}"
cd MatX
echo "MatX HEAD:"
git log -1 --format=short
cd ..
# Write out version override file
jq -r ".packages.CCCL *=
{
\"git_url\": \"${cccl_repo}\",
\"git_tag\": \"${cccl_sha}\",
\"version\": \"${cccl_version}\",
\"always_download\": true
}" \
"${version_file}" > "${version_override_file}"
echo "Overriding MatX versions.json file:"
cat "$version_override_file"
# Configure and build
rm -rf build
SCCACHE_NO_DIST_COMPILE=1 cmake \
-B build -S MatX -G Ninja \
"-DCMAKE_CUDA_ARCHITECTURES=75;120" \
"-DRAPIDS_CMAKE_CPM_OVERRIDE_VERSION_FILE=${version_override_file}" \
-DMATX_BUILD_TESTS=ON \
-DMATX_BUILD_EXAMPLES=ON \
-DMATX_BUILD_BENCHMARKS=ON \
-DMATX_EN_CUTENSOR=ON
# Disabled because `cmake --build -j ""` is invalid, but so is
# `cmake --build -j8`. CMake expects a space between `-j` and
# the numeric argument, or no argument at all.
# shellcheck disable=SC2086
time cmake --build build -j ${PARALLEL_LEVEL:-}