cuda-python / cuda_bindings_13
AGENTS.md3.4k starsChanged 3 months agoApache-2.0View on GitHub
This file describes cudabindings13, the low-level CUDA host API bindings subpackage in the cuda-python monorepo. - Role: provide low-level, close-to-CUDA interfaces under cuda.bindings.* with broad API coverage. - Style: prioritize correctness and API compatibility over convenience wrappers. High-level ergonomics belong in cuda_core, not here. - Cross-platform: preserve Linux and Windows behavior unless a change is intentionally platform-specific. - Public module layer: Cython modules under cuda/bindings/ expose user APIs (driver, runtime, nvrtc, nvjitlink, nvvm, cufile, etc.). - Internal binding layer: cuda/bindings/_bindings/…
We split this AGENTS.md into the rules it gives an agent
5 rules. About 0 are common, 2 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 38
Platform split files: keep _linux.pyx and _windows.pyx variants aligned when behavior should be equivalent.
- Very specific: line 47
Samples: run pytest-based sample coverage in tests/example_tests/.
- Distinctive: line 82
Keep CUDA return/error semantics explicit and avoid broad fallback behavior.
- Very specific: line 85
If you add or change exported APIs, update relevant docs under docs/source/module/ and tests in tests/.
- Distinctive: line 87
Prefer changes that are easy to regenerate/rebuild rather than patching generated output directly.
≈ “Common” is an estimate: at least 1 in 5 of the 36,368 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
This file describes cuda_bindings_13, the low-level CUDA host API bindings
subpackage in the cuda-python monorepo.
Scope and principles
- Role: provide low-level, close-to-CUDA interfaces under
cuda.bindings.*with broad API coverage. - Style: prioritize correctness and API compatibility over convenience
wrappers. High-level ergonomics belong in
cuda_core, not here. - Cross-platform: preserve Linux and Windows behavior unless a change is intentionally platform-specific.
Package architecture
- Public module layer: Cython modules under
cuda/bindings/expose user APIs (driver,runtime,nvrtc,nvjitlink,nvvm,cufile, etc.). - Internal binding layer:
cuda/bindings/_bindings/provides lower-level glue and loader helpers used by public modules. - Platform internals:
cuda/bindings/_internal/contains platform-specific implementation files and support code. - Build backend:
build_hooks.pydrives extension configuration and Cythonization. Logic shared withcuda_coreandcuda_pathfinder(toolchain selection, the compiler flag set, the Cython cache helpers, the rebuild stamps and the release-tag pinning of README links) lives in_build_shared.py.cuda_bindings_13/_build_shared.pyis canonical; thecuda_coreandcuda_pathfindercopies must each be either a symlink to it or a byte-for-byte identical copy.
Generated-source workflow
- Do not hand-edit generated binding files: many files under
cuda/bindings/(including*.pyxand*.pxd) are generated artifacts. - Generated files are synchronized from another repository: changes to these files in this repo are expected to be overwritten by the next sync.
- If generated output must change: make the change at the generation source and sync the updated artifacts back here, rather than patching generated files directly in this repo.
- Platform split files: keep
_linux.pyxand_windows.pyxvariants aligned when behavior should be equivalent.
Testing expectations
- Primary tests:
pytest tests/ - Cython tests:
- build:
tests/cython/build_tests.sh(or platform equivalent) - run:
pytest tests/cython/
- build:
- Samples: run pytest-based sample coverage in
tests/example_tests/; sample sources and instructions live in../samples/cuda_bindings/. - Benchmarks: see the benchmark README for the Pixi tasks that run the Python and C++ benchmarks.
The tests/legacy_api subdirectory tests the old pre-v2 APIs of driver, runtime
and nvrtc. These test files should not be added to, only updated when
necessary to fix test failures. The canonical set of tests are those outside of
the tests/legacy_api subdirectory.
Tests that create memory pools must cap them: set max_size (v2 types) or
maxSize (other types) on the pool properties object to POOL_SIZE from
cuda_python_test_helpers.memory. A pool created with a size of 0 reserves
virtual address space of about twice the device memory, which fails on systems
with a limited virtual address space. ci/tools/check_mempool_hygiene.py
(a pre-commit hook) enforces this for .py tests. It cannot parse Cython, so
cap pools in tests/cython/*.pyx by hand. The same module holds the shared
supports_memory_pools, supports_managed_memory, and
xfail_graph_mempool_oom helpers; reuse them rather than defining copies.
Build and environment notes
CUDA_HOMEorCUDA_PATHmust point to a valid CUDA Toolkit for source builds.- The toolkit's
cuda.hmust have the same major.minor as the generated sources,CUDA_VERSIONincuda/bindings/cydriver.pxd.build_hooks.pychecks this before cythonize and fails with a message that names both versions. CUDA_PYTHON_PARALLEL_LEVELcontrols build parallelism.- Runtime behavior is affected by
CUDA_PYTHON_CUDA_PER_THREAD_DEFAULT_STREAMandCUDA_PYTHON_DISABLE_MAJOR_VERSION_WARNING.
Editing guidance
- Keep CUDA return/error semantics explicit and avoid broad fallback behavior.
- Reuse existing helper layers (
_bindings,_internal,_lib) before adding new one-off utilities. - If you add or change exported APIs, update relevant docs under
docs/source/module/and tests intests/. - Prefer changes that are easy to regenerate/rebuild rather than patching generated output directly.
Trending
More talk lately.about the whole repository
Who's talking about NVIDIA/cuda-python
- rapidsai/rmm“Replace use of custom CUDA bindings with CUDA-Python”GitHub · Dec 3, 2021 · 12 reactions
- jungwoo-ha/WeeklyArxivTalk“[20210815] Weekly AI ArXiv 만담”GitHub · Aug 14, 2021 · 12 reactions
- A Hacker News story“CUDA Python Low-Level Bindings”Hacker News · Aug 21, 2021 · 4 points
- pytorch/pytorch“RFC: The State of Custom CUDA extensions in PyTorch”GitHub · Apr 23, 2025 · 3 reactions
- NVIDIA/cccl“Refactor and expose publicly the Driver API layer in CCCL”GitHub · Oct 6, 2026 · 2 reactions
The biggest 5 of 30 mentions linking to the repository that our crawl found. Each line is their own headline.
See all 30
Talked about on GitHub, Stack Overflow, Hacker News and Bluesky (30 times).
On GitHub · 26
- Dec 3, 2021Replace use of custom CUDA bindings with CUDA-Python — rapidsai/rmm12 reactions · 16 comments
- Aug 14, 2021[20210815] Weekly AI ArXiv 만담 — jungwoo-ha/WeeklyArxivTalk12 reactions · 3 comments
- Apr 23, 2025RFC: The State of Custom CUDA extensions in PyTorch — pytorch/pytorch3 reactions · 29 comments
- Oct 6, 2026Refactor and expose publicly the Driver API layer in CCCL — NVIDIA/cccl2 reactions
- Oct 1, 2026POC: [Python] try out stubgen-pyx for auto-generated typing stubs — apache/arrow2 reactions · 20 comments
21 more on GitHub
- Apr 11, 2026Allow getting `AtenTensorHandle` from the tensor object via AOTI stable C API — pytorch/pytorch2 reactions · 7 comments
- Oct 5, 2026deps: bump the python-minor group with 8 updates — pcalnon/juniper-cascor1 reaction · 1 comment
- Sep 4, 2026DiskKernelCacheBackend.load() lacks the PermissionError tolerance that save() has, causing crashes under concurrent access on Windows — cupy/cupy1 reaction · 2 comments
- Aug 10, 2026Bump the python-security-and-patches group across 1 directory with 74 updates — canfieldjuan/ATLAS1 reaction · 3 comments
- Jul 19, 2026chore(deps): bump cuda-bindings from 13.2.0 to 13.3.1 — grisuno/LazyOwn1 reaction · 1 comment
- Mar 2, 2026CuPy fails to auto-detect CUDA when CUDA_PATH is unset in containers (RawKernel / JIT compile) — cupy/cupy1 reaction · 1 comment
- Feb 26, 2026Unpin nvjitlink from ctk version — NVIDIA/numba-cuda1 reaction · 4 comments
- Feb 10, 2026[FEA] Migrate RAPIDS to CCCL `cuda::stream_ref` / `cuda::stream` in C++ and `cuda.core` streams in Python — rapidsai/rmm1 reaction · 1 comment
- Jan 7, 2026CI: Add CUDA 13.1 testing support — NVIDIA/numba-cudasays it tested it1 reaction · 23 comments
- Dec 23, 2025CI: Review/align conda test strategy — NVIDIA/numba-cuda1 reaction · 8 comments
- Sep 19, 2025RFC: Support CUDA Stream Protocol — rapidsai/rmm1 reaction · 6 comments
- Sep 19, 2025RFC: Support CUDA Stream Protocol — pytorch/pytorch1 reaction · 2 comments
- Sep 19, 2025RFC: Support CUDA Stream Protocol — cupy/cupy1 reaction · 4 comments
- Aug 21, 2025[FEA] Add SPDX checker pre-commit hook — NVIDIA/numba-cuda1 reaction
- Aug 15, 2025Add workflow to build and cleanup per PR docs previews — NVIDIA/cccl1 reaction · 21 comments
- Aug 5, 2025Add CUDA 13.0 Support across all of RAPIDS — rapidsai/build-planning1 reaction · 12 comments
- Jun 19, 2025CUB and compile_kernel composition — pytorch/pytorch1 reaction · 8 comments
- Apr 16, 2025Some PyTorch tensor functions silently change the default locale encoding — pytorch/pytorch1 reaction · 2 comments
- Jan 18, 2025[FEA]: Replace `__del__` with `weakref.finalize()` in cuda/parallel/experimental/algorithms/ — NVIDIA/cccl1 reaction · 1 comment
- Oct 25, 2024Prepare for CUDA Python new documentation layout — rapidsai/rmm1 reaction · 2 comments
- Sep 11, 2024Adopt cuda-python new module layout — cupy/cupy1 reaction · 1 comment
On Stack Overflow · 2
- May 19, 2026What is the best way to write code to my GPU's CUDA cores using python?0 votes
- Jan 12, 2024cannot run CUDA Python examples0 votes · 1 answer
On Hacker News · 1
- Aug 21, 2021CUDA Python Low-Level Bindings4 points
On Bluesky · 1
- Apr 9, 2025📦 NVIDIA / cuda-python ⭐ 1,537 (+50) 🗒 Python CUDA Python: Performance meets Productivity — @github-trending.bsky.social2 likes and reposts
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about code style.
Of the AGENTS.md files we read, the 28,693 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository8 other files it gives its agents.
- AGENTS.mdAGENTS.md
- benchmarks/cuda_bindings/AGENTS.mdAGENTS.md
- benchmarks/cuda_core/AGENTS.mdAGENTS.md
- cuda_core/AGENTS.mdAGENTS.md
- cuda_core/tests/AGENTS.mdAGENTS.md
- cuda_pathfinder/AGENTS.mdAGENTS.md
- cuda_python/AGENTS.mdAGENTS.md
- create-cuda-python-pull-requestSkill
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

