Sparehand

Docs › GPU jobs

GPU jobs

Some work needs a graphics card: running a local AI model, speech-to-text, training. If one of your workers has an NVIDIA GPU, Sparehand can send that work there, and keep other jobs off the card while it runs.

sparehand run --gpu python train.py          # always on a worker with an NVIDIA GPU
sparehand run ollama run llama3 "hello"      # recognised as a GPU job, same thing

Like every sparehand run, it must be started inside a git checkout.

How a job becomes a GPU job

What changes for a GPU job

A card that is full but not busy

A graphics card can read 0% busy and still have no room: a model another program left loaded sits in its memory (Ollama keeps one there for minutes after its last answer), and a job started beside it dies with "CUDA out of memory". So a GPU job goes to a card only when it has memory free: 1 GB unless you say what the job needs.

sparehand run --gpu --vram 6G python train.py     # needs 6 GB of the card free (6000M works too)

When the card has less, Sparehand asks Ollama on that worker to unload its idle models (it loads one again by itself when it is next asked) and waits like for any busy worker; the line says "graphics card has 2.2 of 8.0 GB free (this job needs 6.0)". SPAREHAND_GPU_VRAM sets the amount for every GPU job (in MB; 0 switches the check off), and SPAREHAND_GPU_FREE_OLLAMA=0 leaves Ollama's models alone. Studio's own picture, clip and voice jobs are not held by this check: they keep their own models on the card between jobs and make room themselves.

A job that needs the whole machine

A big model can take most of a worker's memory as well as its GPU (a 14B video model on a 25 GB laptop): any job beside it pushes the machine into swap, and everything crawls. Give such a job --whole:

sparehand run --gpu --whole python make_clip.py

It waits until the worker has no other job, and while it runs the worker takes no other job (they go to other machines, or wait). sparehand status says "whole machine for one job" then. Studio's local clips are sent this way; its pictures aren't (they're small).

Example: AI models on the worker's GPU

sparehand ai install gaming-pc          # Ollama on the gaming PC, as a background service
sparehand ai pull gaming-pc qwen3:8b
curl localhost:11434/api/tags           # on the hub: every AI machine's models, one address

Point your tools at http://localhost:11434 (or /v1 for OpenAI-compatible ones). See ai.md for how requests are passed on and what fits on a card.

Note: the model server isn't a Sparehand job, so while it answers the card looks busy and the machine takes no new jobs for a moment, as with a game. It frees the GPU 5 minutes after the last request.

Troubleshooting