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
78 lines
3.0 KiB
Bash
78 lines
3.0 KiB
Bash
setup_python_env() {
|
|
local py_version=$1
|
|
|
|
# Source pretty_printing.sh for begin_group/end_group helpers
|
|
local script_dir
|
|
script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
|
# shellcheck source=ci/pretty_printing.sh
|
|
source "${script_dir}/pretty_printing.sh"
|
|
|
|
begin_group "🐍 Setting up Python ${py_version} (uv)"
|
|
|
|
# Install uv if not present
|
|
if ! command -v uv &> /dev/null; then
|
|
curl -LsSf https://astral.sh/uv/install.sh | sh
|
|
export PATH="$HOME/.local/bin:$PATH"
|
|
fi
|
|
|
|
# Create a venv with the requested Python version.
|
|
# uv downloads a pre-built CPython binary automatically — no compilation needed.
|
|
uv venv --seed --python "${py_version}" "${HOME}/.cccl-venv"
|
|
|
|
# Windows venvs use Scripts/, Linux/macOS use bin/
|
|
if [[ -f "${HOME}/.cccl-venv/Scripts/activate" ]]; then
|
|
#shellcheck disable=SC1091
|
|
source "${HOME}/.cccl-venv/Scripts/activate"
|
|
else
|
|
#shellcheck disable=SC1091
|
|
source "${HOME}/.cccl-venv/bin/activate"
|
|
fi
|
|
|
|
end_group "🐍 Setting up Python ${py_version} (uv)"
|
|
}
|
|
|
|
# Pin the cuda-toolkit wheels to the container's CTK major.minor (read from nvcc)
|
|
# via PIP_CONSTRAINT when the mode ($1) is "pinned" (the default; empty also means
|
|
# pinned). "latest" and "sysctk" leave it unpinned; any other value is a hard
|
|
# error. This is the lane's mode gate -- it runs before ctk_extra_flavor in every
|
|
# script, so ctk_extra_flavor can assume the mode is already valid. Also sets and
|
|
# exports cuda_version / cuda_major_version; the caller uses cuda_major_version in
|
|
# the pip-extra name (e.g. minimal-cu${cuda_major_version}).
|
|
pin_cuda_toolkit() {
|
|
cuda_version=$(nvcc --version | grep release | awk '{print $6}' | tr -d ',' | cut -d '.' -f 1-2 | cut -d 'V' -f 2)
|
|
cuda_major_version=$(echo "$cuda_version" | cut -d '.' -f 1)
|
|
export cuda_version cuda_major_version
|
|
|
|
local mode="${1:-pinned}"
|
|
case "${mode,,}" in
|
|
pinned)
|
|
export PIP_CONSTRAINT="${TMPDIR:-/tmp}/ctk-constraint.txt"
|
|
echo "cuda-toolkit==${cuda_version}.*" > "${PIP_CONSTRAINT}"
|
|
;;
|
|
latest | sysctk)
|
|
# No pin. Clear any inherited constraint so it cannot affect the
|
|
# resolve (latest tests the newest minor; sysctk installs no
|
|
# cuda-toolkit wheel at all).
|
|
unset PIP_CONSTRAINT
|
|
;;
|
|
*)
|
|
echo "ERROR: invalid ctk mode '${mode}' (expected pinned|latest|sysctk)" >&2
|
|
return 1
|
|
;;
|
|
esac
|
|
}
|
|
|
|
# Echoes the pip-extra toolkit "flavor" for the mode ($1): "sysctk" when the mode
|
|
# is sysctk (rely on the system-provided CUDA toolkit) or "cu" otherwise
|
|
# (pip-installed toolkit). The mode is validated by pin_cuda_toolkit, which every
|
|
# lane calls first. Combine with the CUDA major, e.g.
|
|
# "minimal-$(ctk_extra_flavor "${ctk_mode}")${cuda_major_version}" -> minimal-sysctk12.
|
|
ctk_extra_flavor() {
|
|
local mode="${1:-}"
|
|
if [[ "${mode,,}" == "sysctk" ]]; then
|
|
echo "sysctk"
|
|
else
|
|
echo "cu"
|
|
fi
|
|
}
|