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
54 lines
1.4 KiB
Python
Executable File
54 lines
1.4 KiB
Python
Executable File
#!/usr/bin/env python3
|
|
# Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. ALL RIGHTS RESERVED.
|
|
#
|
|
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
import re
|
|
import sys
|
|
|
|
|
|
def main() -> int:
|
|
# We pre-compile this regular expression as a micro-optimization for speed. The
|
|
# assumption is that the shebang is correct, so everything in the happy path should be
|
|
# as fast as possible.
|
|
FIRST_LINE_RE = re.compile(r"#!\s*/usr/bin/env.*")
|
|
ret = 0
|
|
for f in sys.argv[1:]:
|
|
with open(f) as fd:
|
|
first_line = fd.readline()
|
|
|
|
if not first_line.startswith("#!"):
|
|
# Not a shebang
|
|
continue
|
|
|
|
if FIRST_LINE_RE.match(first_line):
|
|
# Already correct
|
|
continue
|
|
|
|
ret = 1
|
|
|
|
if not (
|
|
m := re.match(r"#!\s*(?:/bin/(\w+)|/usr/bin/(\w+))\s*(.*)", first_line)
|
|
):
|
|
# Not assert, pre-commit may compile with -O
|
|
raise AssertionError(f"Failed to match shebang for {first_line}")
|
|
|
|
fixed = f"#!/usr/bin/env {m[1] or m[2]}".rstrip()
|
|
if rest := m[3].strip():
|
|
fixed += f" {rest}"
|
|
fixed += "\n"
|
|
|
|
with open(f) as fd:
|
|
# Read the remaining lines, we need them in order to overwrite
|
|
lines = fd.readlines()
|
|
|
|
lines[0] = fixed
|
|
|
|
with open(f, "w") as fd:
|
|
fd.writelines(lines)
|
|
|
|
return ret
|
|
|
|
|
|
if __name__ == "__main__":
|
|
sys.exit(main())
|