Run code in an EU GPU sandbox with the Python SDK. Use several GPUs in one sandbox.
Run Python code on one or more GPUs in an isolated EU sandbox. More powerful GPUs are coming.
Hello, GPU
Save this as hello_gpu.py. The decorator requests a GPU. Calling .remote() runs the function in the sandbox and returns its PyTorch version. Hello world on GitHub
from munitoai import App
app = App(region="eu")
@app.function(gpu="L4")
def torch_version():
import torch
return torch.__version__
print(torch_version.remote())Set MUNITO_API_KEY to a workspace key for your organization. Run the file with uv.
uv run --python 3.12 --with munitoai==0.1.0 hello_gpu.pyThe SDK releases the GPU when the function succeeds.
Ray-trace a glass VI
This example renders 120 frames on one GPU. The render helper uses the SDK to send the scene to the sandbox, retrieve the frames, and release the GPU. It encodes the MP4 locally.
from munitoai import Munito
from glass_vi import render_video
with Munito(region="eu") as client:
print(render_video(client, frames=120))Clone the public demo repository and run the rendering example on GitHub. The command prints the path to vi.mp4.
git clone https://github.com/munitoai/demo.git
cd demo/sandboxes/gpu/python
uv run render_vi.pyThe GPU sandbox produced the MP4 in 21.4–23.2 seconds, including sandbox creation, file transfers, cleanup, and encoding. A ready eight-vCPU sandbox took 141.3–146.4 seconds. Benchmark results
Run PyTorch on two GPUs
Request two GPUs on one host and print the device names that PyTorch sees. Two-GPU example on GitHub
from munitoai import App
app = App(region="eu")
@app.function(gpu="L4:2")
def gpu_names():
import torch
return [torch.cuda.get_device_name(i) for i in range(torch.cuda.device_count())]
print(gpu_names.remote())Run it from the demo checkout.
uv run two_gpus.pySum a tensor across both GPUs
The launcher starts one worker per GPU. Each worker contributes its rank plus one. After all_reduce, both hold the sum, and the first worker prints GPUs: 2, sum: 3. Worker on GitHub · Launcher on GitHub
import os
import torch
import torch.distributed as dist
rank = int(os.environ["LOCAL_RANK"])
torch.cuda.set_device(rank)
dist.init_process_group("nccl")
try:
value = torch.tensor([rank + 1], device=f"cuda:{rank}")
dist.all_reduce(value)
if rank == 0:
print(f"GPUs: {dist.get_world_size()}, sum: {value.item()}")
finally:
dist.destroy_process_group()uv run all_reduce.pyTrain a tiny language model
Train a one-layer GPT to predict the next byte in a French sentence. The sandbox includes PyTorch and Transformers. Training example on GitHub
from munitoai import App
with App(region="eu") as app:
@app.function(gpu="L4")
def train():
import torch
from transformers import GPT2Config, GPT2LMHeadModel
torch.manual_seed(7)
tokens = torch.tensor([list(b"Paris est en France.")], device="cuda")
model = GPT2LMHeadModel(GPT2Config(vocab_size=256, n_positions=32, n_embd=64, n_layer=1, n_head=2)).cuda()
optimizer = torch.optim.AdamW(model.parameters(), lr=0.003)
losses = []
for _ in range(32):
optimizer.zero_grad()
loss = model(tokens, labels=tokens).loss
loss.backward()
optimizer.step()
losses.append(loss.item())
return [round(losses[0], 3), round(losses[-1], 3)]
print(train.remote())uv run train_tiny_gpt.pyIn 32 updates, the loss on the training sentence fell from 5.623 to 0.345.
Workspace and limits
A sandbox supports one to eight GPUs on the same machine. If the requested GPUs are unavailable, the API returns 503 no_capacity. Retry after the interval in Retry-After, or request fewer GPUs.
GPU sandboxes have no outbound internet access. Custom images, private networks, and the pause, resume, and fork operations are unavailable.
Hardware and pricing
Each NVIDIA L4 has 24 GB of GPU memory and costs $0.78 per GPU-hour, plus CPU and RAM. With one GPU and the default 2 vCPUs and 4 GiB of RAM, the total is $0.798 per hour. The usual sandbox plan and trial terms apply. Billing measures elapsed run time even when the GPU is idle. Delete the sandbox or let its timeout expire to end the charge. See sandbox prices and limits.