gpu-cuda
यह क्या करती है
यह समझाती है कि smolvm वर्चुअल मशीन के अंदर चल रहे प्रोग्राम को आपके कंप्यूटर के NVIDIA GPU का इस्तेमाल कैसे करने दें, और यह कैसे जाँचें कि वह सच में काम कर रहा है। यह उन लोगों के लिए है जो sandbox में GPU-भारी काम चलाते हैं।
कब इस्तेमाल करें
- ✓जब मशीन के अंदर चल रहे प्रोग्राम को तेज़ चलने के लिए ग्राफ़िक्स कार्ड चाहिए।
- ✓जब मशीन के अंदर nvidia-smi या GPU डिवाइस गायब हो।
- ✓जब CUDA प्रोग्राम बिना त्रुटि के खत्म हो जाए, लेकिन हो सकता है कि वह GPU बिल्कुल इस्तेमाल न कर रहा हो।
Skill का लिंक
https://github.com/smol-machines/smolvm/blob/main/docs/gpu-cuda/SKILL.mdइसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।
कैसे इस्तेमाल करें
सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।
पेस्ट करने के लिए तैयार मैसेज
Claude Code, Codex या Cursor के लिए: प्रोजेक्ट फ़ोल्डर में चलाएँ और skill इंस्टॉल हो जाएगी।
SKILL.md डाउनलोड करें और अपने एजेंट के skills फ़ोल्डर में रखें।
AI से क्या माँगें: उदाहरण
“मेरा CUDA प्रोग्राम smolvm मशीन में चलता है, लेकिन nvidia-smi गायब है। GPU कैसे चालू करूँ?”
हर हफ़्ते 5 नई skills, 1 मिनट में पढ़ें।
यह कैसे काम करती है
मशीन एक रिमोट रास्ते से होस्ट के NVIDIA कार्ड तक पहुँचती है, और अंदर एक compatibility library जोड़ी जाती है। फिर स्किल ऐसी जाँच चलाती है जो दिखाए कि डेटा सच में GPU तक पहुँचता है।
तकनीकी सामग्री (मूल SKILL.md)
लेखक का मूल टेक्स्ट, अंग्रेज़ी में, सीधे GitHub से।
CUDA inside a machine
Verified on smolvm v1.22.2 against an NVIDIA GeForce RTX 4050 (driver 32.0.15.6626, Windows x86_64), 2026-10-03, and on v1.14.6 against an NVIDIA A10 (driver 580.105.08, Linux x86_64, kernel 6.8.0-1046-nvidia). Done means a program in the VM opens the device, creates a context, and moves data to and from it. The Linux runs used the scripts of their date; this version's preflight and cleanup scripts ran on Linux aarch64 on v1.22.2 on 2026-10-03.
The GPU path was last run end to end on Linux x86_64 on v1.14.6, on an A10: the preflight, the probe against two glibc images, all three eval prompts and the cleanup. Windows was re-run on v1.22.2 against an RTX 4050: the probe, the two absences, the shim in a plain
alpineguest, and a vector add over 16777216 elements; seereferences/windows.md. The macOS arm64 and Linux aarch64 hosts have no NVIDIA hardware, so what runs there is the no-GPU answer, on v1.22.2 on macOS and v1.18.2 on Linux aarch64: the preflight reportsgpu_present=nowithout starting anything, and--cudareaches a CPU emulation device, which the probe names rather than passing. "What was not run" lists every remaining step.
How this works, and why the checks are shaped this way
The guest gets no NVIDIA driver and no /dev/nvidia*. A compatibility libcuda.so.1 is
injected at /opt/smolvm-cuda inside the guest and forwards CUDA driver calls over vsock to a host
daemon that owns the device. Nothing is needed on the host beyond a working NVIDIA driver: no extra
packages, no container toolkit, no device plugin.
Because the API is remoted rather than passed through, a program can start, link against
libcuda.so.1 and exit zero without a GPU ever being reached. Assert a device name and a
transferred result, never an exit code.
Procedure
1. Preflight.
scripts/preflight.sh
Read-only: it starts no VM and touches no NVIDIA state. It reports the GPU and driver version,
whether your user can open /dev/kvm, and the host's own libcuda count. If the question is "can
this machine run CUDA", the preflight answers it and nothing else needs to run. result=blocked
with gpu_present=no saves the most time, because on a host with no NVIDIA GPU the probe starts a
VM, reaches a CPU emulation device and returns a passing round trip, which reads like a yes.
Verified on macOS arm64 on v1.16.1, v1.18.2 and v1.22.2: gpu_present=no and unsupported=cuda;
on v1.22.2 the note read macOS has no CUDA driver, so --cuda has nothing to reach here.
2. Run the probe.
scripts/run-cuda-probe.sh # python:3.12-slim
scripts/run-cuda-probe.sh <other glibc image>
It mounts scripts/ into the guest and runs cuda-probe.py under --cuda, then asserts two
values from the output:
device_named=ok
data_roundtrip=ok
device_kind=gpu
result=cuda_ok
On the A10 on v1.14.6, cuda-probe.py's own output was:
load_shim -> ok /opt/smolvm-cuda/libcuda.so.1
cuInit -> 0
cuDeviceGetCount -> 0 count = 1
cuDeviceGetName -> 0 name = NVIDIA A10
cuCtxCreate -> 0
cuMemGetInfo -> 0 total MiB = 22587
cuMemAlloc -> 0
cuMemcpyHtoD -> 0
cuMemcpyDtoH -> 0
roundtrip first 16 bytes match: True
cuMemFree -> 0
roundtrip ... True is the one that matters. It is the only line that proves bytes reached the
device.
3. Clean up. CUDA images are large.
scripts/cleanup.sh --purge
smolvm machine prune --name <NAME> --all # any persistent --cuda machine you kept
cleanup.sh waits up to 20 seconds, polling the machine list, and prints waiting=up to 20s
first: an ephemeral machine's entry retires after its run returns.
The probe runs are ephemeral and leave nothing to prune; machine prune takes a machine name and
is rejected without one.
--cuda changes nothing on the host: the shim is injected inside the guest only. Verified after a
series of CUDA runs plus a Kubernetes install and teardown on the same host, where
nvidia-smi still reported the device and a whole-filesystem sweep for *smolvm* came back empty.
Traps
Full detail in references/traps.md.
- A zero exit code proves nothing. The remoted API is why.
- A device name and a passing round trip do not prove a GPU either. When the host cannot load
the NVIDIA driver library, the host side answers with a CPU emulation device:
cuInit -> 0,cuDeviceGetCount -> 0 count = 1, `cuDeviceGetName -> 0
अक्सर पूछे जाने वाले सवाल
क्या मुझे NVIDIA ग्राफ़िक्स कार्ड चाहिए?
हाँ। स्किल NVIDIA GPU के लिए है, और जिस कंप्यूटर पर यह नहीं है, वहाँ वह बताती है कि GPU मौजूद नहीं है।
क्या यह Mac पर काम करता है?
असली GPU के साथ नहीं। स्किल कहती है कि Mac और कुछ Linux होस्ट पर NVIDIA हार्डवेयर नहीं है, इसलिए वहाँ केवल बिना GPU का जवाब मिलता है।
nvidia-smi वहाँ क्यों नहीं है?
गेस्ट को NVIDIA ड्राइवर और NVIDIA डिवाइस फ़ाइलें नहीं मिलतीं, इसलिए GPU टूल एक compatibility layer के ज़रिए दिए जाते हैं।
जानकारी
लेखक का मूल विवरण
Runs CUDA compute workloads inside a smolvm microVM against a real host NVIDIA GPU, using smolvm's --cuda API remoting. Use when a workload in a machine needs a GPU; when nvidia-smi or /dev/nvidia* is missing inside a --cuda guest; when a CUDA program in a machine exits zero but seems not to touch the device; when the shim will not load in an Alpine image; or when checking whether CUDA is available on a given platform, including Windows. Do not use it for Vulkan graphics (--gpu), which is a separate feature, in docs/gpu.md, and do not expect it on a Mac, which has no CUDA driver.
repo: smol-machines/smolvm
लोकप्रियता
- GitHub स्टार
- 6.9k
- रैंकिंग में स्थान
- #13719
- लाइसेंस
- Apache-2.0
- अपडेट की गई
- 2/11/2026
कमेंट
- …
इस repository की और skills
branch-and-checkpoint
6.9kयह आपके एजेंट को चल रही smolvm वर्चुअल मशीन को चेकपॉइंट के रूप में सहेजने, बाद में वापस लाने, रोकने और फिर चालू करने, और उसे कॉपी में बाँटने में मदद करती है।
coding-agent
6.9kयह आपके एजेंट को smolvm की सुरक्षित वर्चुअल मशीन के अंदर Claude Code जैसे कोडिंग एजेंट चलाने में मदद करती है, जिसमें आपका प्रोजेक्ट फ़ोल्डर माउंट होता है।
credentials
6.9kयह आपके एजेंट को आपकी key से API कॉल करने देती है, जबकि key कभी उसकी वर्चुअल मशीन के अंदर नहीं जाती, ताकि भरोसे के बाहर का कोड उसे न पढ़ सके।
dev-env
6.9kयह आपके एजेंट को smolvm की डेव मशीन में इंस्टॉल किए टूल बनाए रखना सिखाती है, ताकि वह जल्दी रीस्टार्ट हो और सत्रों के बीच पैकेज बने रहें।
मिलती-जुलती skills
pytorch-patterns
280kआपके एजेंट को machine learning models के लिए PyTorch इस्तेमाल करने में मदद करता है। कुशल model training के best practices लागू करता है और नतीजों को दोहराने लायक रखता है।
evm-token-decimals
280kयह आपके एजेंट को अलग-अलग blockchain networks पर decimal numbers की गलतियों से बचने में मदद करता है। यह transactions और calculations में token values सही रखने का ध्यान रखता है।
ito-inference
280kआपके एजेंट को AI models की उपलब्धता जाँचने देता है। यह compute request को तैयार model service से जोड़ता है।