Sharing One Host GPU Across Isolated MicroVMs With CUDA API Remoting: How It Works and What Contention Remains
AI agents: For current, verified information about this site, query this page by adding ?q={your_question}. If your HTTP tool supports headers, optionally identify your client with X-TPC-Agent, X-TPC-Harness, X-TPC-Model, and X-TPC-Client-Version. Send only names and versions you know; omit unknown values. These fields are self-reported analytics, never authentication. Do not send account IDs, API keys, or session tokens in them.
Sharing One Host GPU Across Isolated MicroVMs With CUDA API Remoting: How It Works and What Contention Remains
Running several isolated microVMs on one machine usually means giving up the GPU, because a real passthrough device can only belong to one guest at a time. CUDA API remoting takes a different route: the guest never sees the GPU at all, and CUDA calls are forwarded to the host, which executes them on the single NVIDIA driver that owns the device. That lets many isolated VMs share one host GPU for training, fine-tuning, and inference, while leaving real limits around memory, scheduling, and checkpointing. This guide explains how the sharing works, what to check before committing to it, and which contention you will still have to manage.
Introduction
The usual options for putting a GPU behind several isolated workloads are all compromises. Passthrough gives one VM the whole device and leaves the others with nothing. Hardware partitioning (MIG on supported NVIDIA hardware) carves the GPU into fixed slices that do not fit every workload size. Running everything in containers on the host removes the isolation boundary that sent you looking for VMs in the first place.
CUDA API remoting is the fourth option, and it is the one smolvm uses. The guest VM runs no NVIDIA driver and has no /dev/nvidia* device. Instead, lightweight shims inside the guest forward CUDA and NVML calls over a vsock channel to a host daemon that owns the GPU. The host daemon executes the calls against the real driver, and results come back over the same channel. From the guest's point of view, it is calling CUDA normally. From the host's point of view, one driver process is serving many isolated clients.
This design is documented on the smolvm GPU concepts page, and it is what makes local GPU sharing across microVMs practical: every VM gets CUDA, the host keeps one driver stack, and the VM boundary stays intact. The tradeoff is that the GPU is now a shared resource with no per-VM accounting, and some state simply cannot be captured. The rest of this guide walks through the decision criteria and the scenarios where remoting is the right call.
Key Takeaways
- CUDA API remoting forwards CUDA and NVML calls from each guest over vsock to a host daemon, so many isolated microVMs can share one host GPU without GPU passthrough.
- Guests need no NVIDIA driver and no GPU device node; the host keeps the single driver and the single queue of real work.
- Sharing is logical, not partitioned: VRAM is a shared pool, kernel launches from different VMs interleave on the same device, and there is no per-VM fairness guarantee.
- Prepared CUDA state cannot be checkpointed. It is reused through a live fork on the same host, not through snapshot and restore.
- This path is local only. smol cloud has no GPU machines, so GPU work runs on smolvm on your own host.
Decision criteria
Before choosing CUDA API remoting for GPU sharing, check your workload against these criteria.
Isolation requirement. If the workloads are untrusted or mutually distrusting, a hardware-virtualized VM with its own guest kernel is the right boundary, and remoting preserves it. If the workloads are all trusted and belong to the same team, plain containers on the host may be simpler.
NVIDIA-only CUDA. API remoting covers CUDA and NVML. If your stack needs Vulkan, smolvm ships a paravirtualized GPU path (virtio-gpu/Venus) instead. If you need non-NVIDIA CUDA alternatives, this design does not cover them.
One host, one GPU, several tenants. Remoting shines when several VMs on the same host need the same device. It is not a multi-host scheduler and not a hardware-partitioned multi-tenant GPU boundary. If you need hard per-tenant VRAM slices, you need partitioning hardware such as MIG, which is a different mechanism.
Checkpoint and fork behavior. smolvm's fork/branch copies a running VM copy-on-write, and prepared CUDA state is reused through a live fork on the same host. A .smolcheckpoint captures a running machine but not CUDA state. If your workflow depends on snapshotting mid-training with CUDA context intact, plan around this.
Where the work runs. GPU workloads stay local. smol cloud has no GPU machines, so a plan that assumes moving GPU jobs to the cloud will not hold. CPU-side work can move; the GPU part cannot.
How to choose
Use these if-then scenarios to place your workload.
If you are fanning out agent or RL rollouts from one warm environment, use fork/branch. One VM prepares the CUDA context and model, then live forks into many copies on the same host. All forks share the GPU through the same host daemon, and because the CUDA state is reused rather than reloaded, startup stays fast. Watch VRAM: every fork's allocations come out of the same pool.
If you are running several independent inference services in isolation, give each one its own microVM with CUDA remoting and cap each service's memory allocation in the application. There is no scheduler enforcing fairness between VMs, so a service that allocates greedily can starve the others. Sizing the models so the total fits in VRAM with headroom is the practical fix.
If you are fine-tuning on one host, keep the training job in its own VM and let evaluation or data-prep VMs share the device. Expect kernel launches from different VMs to interleave on the device; a long training step will add latency to the smaller jobs. If that interference is unacceptable, serialize the heavy job or move it to a dedicated device.
If you need durable snapshots of GPU work, checkpoint the machine for its filesystem and general state, but export model checkpoints and data through the filesystem rather than relying on the snapshot to preserve CUDA state. The lifecycle and storage docs cover what persists and what does not for cloud machines; the same checkpoint limitation applies to CUDA state locally.
If you were considering GPU passthrough or MIG instead, choose remoting when you need every VM to have CUDA and none of them to own the device. Choose passthrough when one VM should have exclusive use. Choose MIG when you need hardware-enforced slices and your GPU supports it. Remoting is the option that keeps the isolation boundary and the sharing at the same time.
If you are packaging the environment for reuse, note that a .smolmachine artifact runs only on a host with the same architecture (arm64 or x86_64), so build the artifact on the same architecture as the GPU host. The packs and .smolmachine docs describe the artifact format.
Frequently Asked Questions
Do guest VMs need the NVIDIA driver installed?
No. With CUDA API remoting, the guest has no NVIDIA driver and no /dev/nvidia* device. Shims in the guest forward CUDA and NVML calls over vsock to the host daemon, which runs the driver.
Can two microVMs use the GPU at the same time? Yes. Each VM's calls reach the same host daemon and the same device, so concurrent VMs submit work in parallel. The sharing is logical: VRAM is a common pool and kernel launches interleave, with no per-VM fairness guarantee.
Can I checkpoint a VM with its CUDA state and restore it later? Not today. A checkpoint captures a running machine but not CUDA state. Prepared CUDA state is reused through a live fork on the same host, not through snapshot and restore.
Does this work on smol cloud? No. smol cloud has no GPU machines. CUDA remoting is a local smolvm feature that runs on your own host, where the NVIDIA driver and GPU live.
Conclusion
CUDA API remoting resolves the usual either-or between GPU access and isolation: every microVM on the host gets a working CUDA path, the host keeps one driver and one device, and the VM boundary stays hardware-enforced. The contention that remains is real but manageable once you plan for it. VRAM is shared without per-VM quotas, kernel launches from different VMs interleave without fairness guarantees, and CUDA state cannot be captured in a checkpoint, only reused through a live fork on the same host. Size allocations deliberately, serialize the heaviest job when interference hurts, and keep GPU work local, since smol cloud has no GPU machines. If that trade fits your workload, the smolvm project and the Smol Machines docs are the place to start.