Skip to content

docs(cuda): document Docker-free PyTorch worker layout - #600

Open
NickyHeC wants to merge 4 commits into
smol-machines:mainfrom
NickyHeC:nickyhec/docs-cuda-pytorch-image-layout
Open

docs(cuda): document Docker-free PyTorch worker layout#600
NickyHeC wants to merge 4 commits into
smol-machines:mainfrom
NickyHeC:nickyhec/docs-cuda-pytorch-image-layout

Conversation

@NickyHeC

@NickyHeC NickyHeC commented Jul 12, 2026

Copy link
Copy Markdown
Contributor

Depends on #602 and #638 — land together. #602 stages the official conda image layout; #638 supplies the Runtime exports conda PyTorch needs.

Fixes #598.

Problem

The CUDA section still described Runtime-API workloads as unsupported and did not explain the pull-time staging requirement. PyTorch's CUDA libraries must already exist in the image when smolvm pulls it so the agent can overlay the forwarding shims at each RPATH-pinned soname.

Changes

  • document Runtime-API forwarding through smolvm-cudart-shim
  • document pip-wheel, conda, and SMOLVM_CUDA_STAGE_EXTRA_DIRS staging layouts
  • add a Docker-free PyTorch example using the upstream-maintained pytorch/pytorch:2.4.0-cuda12.4-cudnn9-runtime image directly
  • include a staging check and current allocator / fused-SDPA caveats

No Dockerfile, local image build, or third-party container toolchain is required; smolvm pulls the existing OCI image itself.

Validation

The exact official image was validated on a Lambda A10 with #602 + #638:

cuda: True
matmul_ok torch.Size([4, 4])
backward ok

The staged /opt/conda/lib/libcudart.so.12.4.127 was the ~901 KB shim bind-mount rather than the real NVIDIA library, with no LD_PRELOAD.

@ghost

ghost commented Jul 12, 2026

Copy link
Copy Markdown

Ready to review this PR? Stage has broken it down into 3 individual chapters for you:

Title
1 Update CUDA documentation for Runtime-API support
2 Add PyTorch CUDA example and worker image
3 Link PyTorch example in main examples index
Open in Stage

Chapters generated by Stage for commit 5da5bba on Jul 13, 2026 1:52am UTC.

The CUDA section still described Runtime-API workloads as unsupported ("a pure
libcuda shim cannot provide it", Phase 4), which predates the smolvm-cudart-shim
merge — PyTorch/vLLM/Triton now run. Correct that, and document the one
non-obvious requirement that bit us: auto-staging overlays the guest shims onto
pip NVIDIA wheels at IMAGE PULL TIME under site-packages/nvidia/, so the image
must already contain pip torch when smolvm pulls it. conda /opt/conda/lib and
runtime `pip install torch` are not staged.

Add examples/cuda-pytorch/ (Dockerfile + Smolfile + README) with the working
recipe, a staging-verification check, and the math-SDPA note for training.

Refs smol-machines#598.
@NickyHeC
NickyHeC force-pushed the nickyhec/docs-cuda-pytorch-image-layout branch from 9132956 to 5da5bba Compare July 13, 2026 01:52
Comment thread examples/cuda-pytorch/pytorch.smolfile Outdated
# PyTorch worker on smolvm with CUDA forwarding.
#
# Build the image first (torch must be present at pull time — see README.md):
# docker build -t torch-cuda examples/cuda-pytorch

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a smolvm example should not have a dependency on docker + dockerfile because it adds a third party dependency + increases complexity/management

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in d555a1f: removed the Dockerfile and all Docker build/export instructions. The example now uses the upstream pytorch/pytorch:2.4.0-cuda12.4-cudnn9-runtime image directly through smolvm; it explicitly depends on #602 + #638, which already validate that conda layout.

Remove the Docker build dependency from the example and rely on the conda staging support already validated by the companion CUDA PRs.
@NickyHeC NickyHeC changed the title docs(cuda): document PyTorch worker image layout for auto-staging docs(cuda): document Docker-free PyTorch worker layout Jul 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

Document CUDA worker image layout for PyTorch auto-staging

2 participants