Repository navigation
Conversation
Expose host GPU devices inside the sandbox behind an explicit --gpu flag. NVIDIA (/dev/nvidiaN + auxiliary), DRM (dri/cardN, renderDN) and AMD (kfd) character devices are discovered at launch and mounted individually with --dev-bind, along with read-only sysfs and driver metadata (ld.so.cache, OpenCL/Vulkan/glvnd ICDs, /proc/driver/nvidia). Symlinked nodes and device directories are rejected, non-matching names are skipped, and a missing GPU fails with a clear error before bwrap runs. GPU mounts follow the private /dev, so explicit --with/--with-ro binds can still override them and the OpenCode v2 isolation overlay stays last. The feature is default-off; without --gpu no GPU-specific mounts or probes are added. Ported from the sandbox-podman-persistent-tmp branch (6283b83), scoped to the GPU feature only. Tests are ported from unittest/test_podman to the pytest harness in tests/ (14 new tests; full suite: 76 passed). Docs note that dri/cardN also exposes display/KMS and that NPUs stay out of scope, per upstream feedback on the earlier proposal (fityannugroho#6).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
$ nvidia-smi -L && ./opencodebox --gpu
GPU 0: NVIDIA GeForce RTX 3090 (UUID: GPU-a6984273-01a5-22e8-5ddd-8bbbf032c9e5)
Warning: --gpu exposes host GPU devices and read-only sysfs; GPU resources and driver access are shared with the host.
▄
█▀▀█ █▀▀█ █▀▀█ █▀▀▄ █▀▀▀ █▀▀█ █▀▀█ █▀▀█
█ █ █ █ █▀▀▀ █ █ █ █ █ █ █ █▀▀▀
▀▀▀▀ █▀▀▀ ▀▀▀▀ ▀▀▀▀ ▀▀▀▀ ▀▀▀▀ ▀▀▀▀ ▀▀▀▀
Session GPU checks via nvidia-smi and torch.cuda
Continue opencode -s ses_ea3925f38ffevqS7Foiuo1Wx9f
Both commands ran successfully. Let me summarize the results for the user.
Everything checks out — CUDA is fully functional:
nvidia-smi -L
torch.cuda checks
cuda:0— ✅ OK (float32)The single RTX 3090 is visible to PyTorch, and an actual GPU kernel (matmul + synchronize) ran without errors, so the driver/CUDA/torch stack is working end-to-end.
Heads-up on versions: torch 2.13.0+cu130 is built against CUDA 13.0 — if you plan to compile extensions (flash-attn, deepspeed, custom kernels), make sure the local CUDA toolkit matches or is compatible with sm_86. Want me to check the driver version /
nvcctoolkit as well?