cuda-python / cuda_pathfinder
AGENTS.md3.4k starsChanged 4 months agoApache-2.0View on GitHub
This file describes cuda_pathfinder, a Python sub-package of cuda-python. It locates and loads NVIDIA dynamic libraries (CTK, third-party, and driver) across Linux and Windows. - Language: all implementation code in this package is pure Python. - Public API: keep user-facing imports stable via cuda.pathfinder. Internal modules should stay under cuda.pathfinder._*. - Behavior: loader behavior must remain deterministic and explicit. Avoid "best effort" silent fallbacks that mask why discovery/loading failed. - Cross-platform: preserve Linux and Windows behavior parity unless a change…
Trending
More talk lately.thin dataabout 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
- apache/arrow“POC: [Python] try out stubgen-pyx for auto-generated typing stubs”GitHub · Oct 1, 2026 · 2 reactions
The biggest 5 of 12 mentions linking to the repository that our crawl found. Each line is their own headline.
See all 12
Talked about on GitHub, Hacker News and Bluesky (12 times).
On GitHub · 10
- 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 1, 2026POC: [Python] try out stubgen-pyx for auto-generated typing stubs — apache/arrow2 reactions · 4 comments
- Apr 11, 2026Allow getting `AtenTensorHandle` from the tensor object via AOTI stable C API — pytorch/pytorch2 reactions · 6 comments
5 more on GitHub
- Oct 5, 2026deps: bump the python-minor group with 8 updates — pcalnon/juniper-cascor1 reaction · 1 comment
- 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 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
- Sep 19, 2025RFC: Support CUDA Stream Protocol — rapidsai/rmm1 reaction · 6 comments
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 checking a change actually works.
Of the AGENTS.md files we read, the 11,773 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 repository13 other files it gives its agents.
- AGENTS.mdAGENTS.md
- benchmarks/cuda_bindings/AGENTS.mdAGENTS.md
- benchmarks/cuda_core/AGENTS.mdAGENTS.md
- cuda_bindings/AGENTS.mdAGENTS.md
- cuda_core/AGENTS.mdAGENTS.md
- cuda_core/tests/AGENTS.mdAGENTS.md
- cuda_python/AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- cuda_bindings/CLAUDE.mdCLAUDE.md
- cuda_core/CLAUDE.mdCLAUDE.md
- cuda_pathfinder/CLAUDE.mdCLAUDE.md
- cuda_python/CLAUDE.mdCLAUDE.md
- create-cuda-python-pull-requestSkill
The file
We split this AGENTS.md into the rules it gives an agent
11 rules. About 0 are common, 4 are distinctive, and 7 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈4
Distinctive · estimate
This author's own choices. Worth a look.
7
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 8
Language: all implementation code in this package is pure Python.
- Very specific: line 9
Public API: keep user-facing imports stable via cuda.pathfinder.
- Very specific: line 37
Edit authored descriptors, not derived tables: when adding/changing a library, update descriptor_catalog.py first.
- Distinctive: line 46
Do not hardcode host assumptions: avoid baking in machine-local paths, shell-specific quoting, or environment assumptions.
- Distinctive: line 48
Prefer focused abstractions: if a change is platform-specific, route it through existing platform abstraction points instead of branching …
- Very specific: line 54
Primary command: run pytest tests/ from cuda_pathfinder/.
- Distinctive: line 55
Real-loading tests: prefer spawned child-process tests for actual dynamic loading behavior.
- Very specific: line 57
Cache-aware tests: if a test patches internals used by load_nvidia_dynamic_lib, call load_nvidia_dynamic_lib.cache_clear().
- Very specific: line 59
Negative-case names: use obviously fake names (for example "not_a_real_lib") in unknown/invalid-lib tests.
- Very specific: line 61
INFO summary in CI logs: use info_summary_append for useful test-context lines visible in terminal summaries.
- Very specific: line 70
Run package tests: pytest tests/
≈ “Common” is an estimate: at least 1 in 5 of the 16,595 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_pathfinder, a Python sub-package of
cuda-python. It locates and loads
NVIDIA dynamic libraries (CTK, third-party, and driver) across Linux and
Windows.
Scope and principles
- Language: all implementation code in this package is pure Python.
- Public API: keep user-facing imports stable via
cuda.pathfinder. Internal modules should stay undercuda.pathfinder._*. - Behavior: loader behavior must remain deterministic and explicit. Avoid "best effort" silent fallbacks that mask why discovery/loading failed.
- Cross-platform: preserve Linux and Windows behavior parity unless a change is explicitly platform-scoped.
Package architecture
- Descriptor source-of-truth:
cuda/pathfinder/_dynamic_libs/descriptor_catalog.pydefines canonical metadata for known libraries. - Registry layers:
lib_descriptor.pybuilds the name-keyed runtime registry from the catalog.supported_nvidia_libs.pykeeps legacy exported tables derived from the catalog for compatibility.
- Search pipeline:
search_steps.pyimplements composable find steps (site-packages,CONDA_PREFIX,CUDA_HOME/CUDA_PATH, canary-assisted CTK root flow).search_platform.pyandplatform_loader.pyisolate OS-specific logic.
- Load orchestration:
load_nvidia_dynamic_lib.pycoordinates find/load phases, dependency loading, driver-lib fast path, and cache semantics.
- Process isolation helper:
cuda/pathfinder/_utils/spawned_process_runner.pyis used where process global dynamic loader state would otherwise leak across tests.
Editing guidance
- Edit authored descriptors, not derived tables: when adding/changing a
library, update
descriptor_catalog.pyfirst; keep derived exports in sync through existing conversion logic and tests. - Respect cache semantics:
load_nvidia_dynamic_libis cached. Never add behavior that closes returned handles or assumes repeated fresh loads. - Keep error contracts intact:
- unknown name ->
DynamicLibUnknownError - known but unsupported on this OS ->
DynamicLibNotAvailableError - known/supported but not found/loadable ->
DynamicLibNotFoundError
- unknown name ->
- Do not hardcode host assumptions: avoid baking in machine-local paths, shell-specific quoting, or environment assumptions.
- Prefer focused abstractions: if a change is platform-specific, route it through existing platform abstraction points instead of branching in many call sites.
Testing expectations
- Primary command: run
pytest tests/fromcuda_pathfinder/. - Real-loading tests: prefer spawned child-process tests for actual dynamic loading behavior; avoid in-process cross-test interference.
- Cache-aware tests: if a test patches internals used by
load_nvidia_dynamic_lib, callload_nvidia_dynamic_lib.cache_clear(). - Negative-case names: use obviously fake names (for example
"not_a_real_lib") in unknown/invalid-lib tests. - INFO summary in CI logs: use
info_summary_appendfor useful test-context lines visible in terminal summaries. - Strictness toggle:
CUDA_PATHFINDER_TEST_LOAD_NVIDIA_DYNAMIC_LIB_STRICTNESScontrols whether missing libraries are tolerated (see_what_works) or treated as failures (all_must_work).
Useful commands
- Run package tests:
pytest tests/ - Build package docs:
cd docs && ./build_docs.sh
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.

