Skip to content

Python 3.9 floor and a libcuda fallback for GPU identity - #13

Merged
plancherb1 merged 2 commits into
mainfrom
python39-libcuda-fallback
Nov 3, 2026
Merged

plancherb1 merged 2 commits into
mainfrom
python39-libcuda-fallback

Conversation

@plancherb1

Copy link
Copy Markdown
Member

Trust claim before and after

Before: environment.gpu_info and the gpu_required probe know two sources, nvidia-smi and PyTorch. A board with neither (a Jetson before JetPack 7, where a plain pytest venv has no torch) records gpu_info: null, so a require_gpu policy fails for the wrong reason, and gpu_required tests skip on a machine that has a GPU. The package also requires Python 3.10, which excludes JetPack 5 boards (Python 3.8 and 3.9).

After: a third source, the CUDA driver library through ctypes (cuInit, cuDeviceGetName, compute-capability attributes, cuDeviceTotalMem_v2, cuDeviceGetUuid), used only when the first two are absent or fail. gpu_info.source names the source used (nvidia-smi, torch, or libcuda). The claim is unchanged: GPU metadata stays self-reported, not evidence of execution (docs/security_model.md row unchanged). The Python floor is 3.9; the code already avoided 3.10-only syntax, so only metadata and the CI matrix moved.

Fail-closed behaviour

The probe returns None when libcuda.so.1 cannot be loaded, when any driver call returns a nonzero CUresult, when a symbol is missing, or when the driver reports no device. Tests cover each branch with a fake library object; the existing nvidia-smi and torch tests now stub the probe so they stay hermetic on a box that has a GPU.

Migration

None. Receipts gain no field; source: "libcuda" is a new value of an existing field. Existing receipts verify unchanged.

Checks run

  • python -m pytest tests -q: 271 passed (Python 3.12 here; 271 passed under Python 3.9.5 on a Jetson AGX Xavier, aarch64, from this wheel)
  • coverage run -m pytest tests -q && coverage report --fail-under=100: 100% line and branch
  • mkdocs build --strict, python -m build, twine check --strict dist/*
  • Real probes: RTX 5090 and Jetson AGX Orin (JetPack 7) still report through nvidia-smi; Jetson AGX Xavier (JetPack 5.1, CUDA 11.4) reports Xavier, compute capability 7.2, driver 11.4 through libcuda, with the same UUID nvidia-smi prints where it exists.
  • GLASS recorded its sm_72 lane receipt (5257 tests) with this build on the Xavier; the 0.5.0 verifier accepts it.

The version is 0.5.1.dev0 so receipts recorded from this tree name a development build; the release commit sets 0.5.1.

🤖 Generated with Claude Code

@plancherb1 plancherb1 mentioned this pull request Nov 3, 2026
@plancherb1
plancherb1 merged commit 306905a into main Nov 3, 2026
9 checks passed
@plancherb1
plancherb1 deleted the python39-libcuda-fallback branch November 3, 2026 06:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant