gpu-cuda
하는 일
smolvm 가상 머신 안의 프로그램이 내 컴퓨터의 NVIDIA GPU를 쓰게 하는 방법과, 실제로 작동하는지 확인하는 방법을 설명합니다. 샌드박스에서 GPU 작업을 하는 사람을 위한 스킬입니다.
사용하는 경우
- ✓머신 안의 프로그램이 더 빠르게 실행되려면 그래픽 카드가 필요할 때.
- ✓머신 안에 nvidia-smi나 GPU 장치가 없을 때.
- ✓CUDA 프로그램이 오류 없이 끝났지만 GPU를 전혀 쓰지 않을 수도 있을 때.
스킬 링크
https://github.com/smol-machines/smolvm/blob/main/docs/gpu-cuda/SKILL.md복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.
사용 방법
가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.
바로 붙여넣을 수 있는 메시지
Claude Code, Codex, Cursor용입니다. 프로젝트 폴더에서 실행하면 스킬이 설치됩니다.
SKILL.md를 다운로드해 에이전트의 스킬 폴더에 넣으세요.
AI에게 요청하는 예시
“제 CUDA 프로그램이 smolvm 머신에서 돌아가는데 nvidia-smi가 없습니다. GPU를 작동시키려면 어떻게 해야 하나요?”
매주 새 스킬 5개. 읽는 데 1분.
작동 방식
머신은 원격 경로를 통해 호스트의 NVIDIA 카드에 닿으며, 안쪽에는 호환성 라이브러리가 추가됩니다. 이후 스킬은 데이터가 실제로 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가 없는 컴퓨터에서는 GPU가 없다고 알려 줍니다.
Mac에서도 되나요?
실제 GPU로는 안 됩니다. 스킬은 Mac과 일부 Linux 호스트에는 NVIDIA 하드웨어가 없어서 GPU가 없다는 답만 받는다고 설명합니다.
nvidia-smi가 왜 없나요?
게스트에는 NVIDIA 드라이버와 장치 파일이 전달되지 않으므로, GPU 도구는 호환성 계층을 통해 제공됩니다.
상세 정보
작성자의 원본 설명
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
- 업데이트
- 2026. 11. 2.
댓글
- …
이 저장소의 다른 스킬
branch-and-checkpoint
6.9k에이전트가 실행 중인 smolvm 가상 머신을 체크포인트로 저장하고, 나중에 복원하고, 일시 중지와 재개를 하며, 복사본으로 분기하도록 돕습니다.
coding-agent
6.9k에이전트가 Claude Code 같은 코딩 에이전트를 안전한 smolvm 가상 머신 안에서, 프로젝트 폴더를 연결한 채로 실행하도록 돕습니다.
credentials
6.9k에이전트가 내 키로 API를 호출하게 하되, 키는 가상 머신 안에 들어가지 않아 신뢰할 수 없는 코드가 읽지 못하게 합니다.
dev-env
6.9k에이전트가 필요한 도구를 설치해 둔 smolvm 개발 머신을 유지하도록 가르칩니다. 그래서 빠르게 다시 시작하고 세션이 바뀌어도 패키지가 남습니다.