Queue jobs. Catch free VRAM.
Stop watching GPUs. Let free memory call the next job.
English · 简体中文
gpuq is a lightweight GPU task queue for training, evaluation, and batch experiments.
Submit your commands once; gpuq watches available GPU memory and starts jobs when resources are ready.
Use it on a workstation, through SSH on a remote server, or across a shared pool of machines.
- Researchers and students running experiments on shared lab GPUs.
- Developers queuing training, evaluation, or parameter sweeps without watching GPU availability.
- Users with several projects who want configurable concurrency and priorities.
- Users working across local and remote GPUs who want consistent submission, logs, and task management.
-
Automatic scheduling. Choose GPUs by available memory and utilization, with stable sampling and a configurable memory reserve before launch.
-
Single- and multi-GPU jobs. Run a command on one GPU or allocate several GPUs on the same host for workloads such as
torchrun. -
Memory learning. Start with automatic memory estimation and learn from GPU OOMs, or provide a fixed estimate and retry limit.
-
Project concurrency. Rotate launch opportunities across projects, set project and total task caps, and prioritize urgent jobs.
-
Persistent task management. Keep task state, dependencies, logs, and notifications across terminal and scheduler restarts. Inspect the queue interactively or use JSON output in scripts.
-
Remote workspaces. Submit and manage jobs over SSH, upload only changed content, and reuse Python environments and model caches on each node.
-
Shared GPU pool. Persist local/remote nodes and spread tasks across available GPUs. The new simple pool uses SQLite and SSH; optional high-availability mode adds master failover.
-
Agent skill. Let your coding agent submit and inspect jobs through conversation; see installation and examples.
- Linux
- NVIDIA driver and a working
nvidia-smi - A CUDA workload using visible device IDs (
cuda:0for one GPU, local ranks for multiple GPUs)
The standalone binary does not require Python. A source installation requires Python
3.10+. Python 3.11+ uses the standard library only; Python 3.10 installs the small
tomli compatibility dependency for configuration parsing.
Current version: 0.3.0. Install the standalone binary or build from source.
VERSION=0.3.0
cd /tmp
curl -fLO "https://github.com/lzy248/gpuq/releases/download/v${VERSION}/gpuq-v${VERSION}-linux-x86_64.tar.gz"
curl -fLO "https://github.com/lzy248/gpuq/releases/download/v${VERSION}/gpuq-v${VERSION}-linux-x86_64.tar.gz.sha256"
sha256sum -c "gpuq-v${VERSION}-linux-x86_64.tar.gz.sha256"
tar -xzf "gpuq-v${VERSION}-linux-x86_64.tar.gz"
install -Dm755 "gpuq-v${VERSION}-linux-x86_64/gpuq" "$HOME/.local/bin/gpuq"
gpuq --versionEnsure ~/.local/bin is on PATH, then initialize:
gpuq init
gpuq doctorThe release archive also includes the example config, systemd unit, license, and both README languages.
git clone https://github.com/lzy248/gpuq.git
cd gpuq
export PATH="$(python -m site --user-base)/bin:$PATH"
python -m pip install --user -e .
gpuq init
gpuq doctorThe PATH setting lets your shell find the user-installed gpuq and gpuqd
commands. Setting it before installation also avoids pip's warning that the scripts
directory is not on PATH. It applies only to the current shell and its child
processes. For future terminals, add the same export line to your shell's startup
file (for example, ~/.bashrc for interactive Bash shells), then open a new terminal
or reload that file.
Start one persistent scheduler for the state directory:
gpuq daemonSubmit a job. Auto memory mode is the default, so --memory is optional:
gpuq submit \
--name train-model \
--gpu 0,1 \
--reserve 1500 \
--stable-samples 3 \
--cwd "$PWD" \
--env PYTHONPATH=. \
-- python train.py --device cuda:0If you know the peak, opt into a fixed estimate:
gpuq submit \
--memory 12000 \
--reserve 1500 \
--retry-on-oom \
--max-retries 2 \
-- python train.py --device cuda:0Inspect and control jobs:
gpuq list
gpuq show 1
gpuq logs -f 1
gpuq cancel 1
gpuq retry 1 --memory autoUse --gpus N (alias --gpu-count N) to request N GPUs on this machine. The
default remains one GPU; --gpu 0,1 alone is an allowlist, not a two-GPU request.
gpuq submit --gpus 2 --gpu 0,1,2,3 --memory 12000 --reserve 1500 \
-- torchrun --standalone --nproc_per_node=2 train.pyThis waits for two eligible GPUs, each with at least 13500 MB free after queue
reservations. All selected cards must pass stable sampling and the final recheck
before the task starts. --memory, --reserve, and OOM learning are per GPU.
The task must support multi-GPU execution itself; gpuq launches the command once.
Use a launcher such as torchrun that waits for all its workers to finish.
If the scheduler chooses physical GPU 1, it starts the child with:
CUDA_VISIBLE_DEVICES=1
The child therefore sees that card as cuda:0. Pass cuda:0 to your framework,
not the original physical index.
For a two-GPU assignment such as physical GPUs 1 and 3, the child receives
CUDA_VISIBLE_DEVICES=1,3, ordered by physical ID. They appear as cuda:0 and
cuda:1; distributed ranks should use their local rank. gpuq list and
gpuq show --json JOB_ID report all assigned physical IDs.
Auto memory mode starts a job when stable free memory covers the configured reserve and an initial
probe. If the job encounters a recognized GPU OOM, gpuq raises its memory estimate and queues another
attempt. Other command errors are recorded as failures for inspection. Use --memory N when you know
the expected peak; memory and reserve values apply to each GPU.
See scheduling details for memory learning, resource selection, and retry rules.
Use gpuq --remote user@host ... to submit, inspect and cancel remote tasks with incremental isolated code
snapshots and persistent remote model caches. See remote workspaces and environments.
daemon --background explicitly starts a detached daemon.
submit --project overrides automatic project identity; --project-limit N persists the ordinary project cap (default 1).
daemon --max-running-jobs N caps all active jobs (0 means unlimited); --scheduling fair|fifo selects fair projects or legacy FIFO.
With total cap 2, A alone may run 2 tasks; competing A/B get 1+1 without pausing running tasks. Inspect with projects --json.
With cluster configuration in place, use --cluster to target the shared queue:
gpuq --cluster submit -- python train.py
gpuq --cluster list
gpuq --cluster logs -f 1For a lightweight setup, use the SQLite + SSH pool: persist local/remote nodes in
TOML and set default_queue = "cluster". Then ordinary gpuq submit automatically spreads work across
eligible GPUs, preferring cards with fewer pool tasks. Each job stays on one host. This source-only addition
needs no etcd or witness; master downtime pauses new dispatch. Optional etcd mode provides master failover.
| Command | Purpose |
|---|---|
gpuq init |
Initialize state and an example config |
gpuq submit -- COMMAND... |
Queue a command; auto memory is default |
gpuq list / gpuq ls |
Interactive or script-friendly queue view |
gpuq show JOB_ID |
Show full job state and learned memory fields |
gpuq logs -f JOB_ID |
Follow merged stdout/stderr |
gpuq cancel JOB_ID |
Stop only this job's process group |
gpuq retry JOB_ID |
Requeue a terminal job |
gpuq priority JOB_ID N |
Change scheduling priority |
gpuq gpus |
Show the scheduler's GPU snapshot |
gpuq daemon |
Run the persistent scheduling loop |
gpuq doctor |
Check state, database, and GPU discovery |
gpuq projects --json |
Inspect project concurrency and task counts |
gpuq --remote HOST list |
Inspect a remote queue over SSH |
gpuq cluster status |
Inspect shared-pool leadership and nodes |
gpuq --cluster list |
Inspect the shared queue |
See the complete CLI reference.
mkdir -p ~/.config/systemd/user
cp systemd/gpuqd.service ~/.config/systemd/user/
systemctl --user daemon-reload
systemctl --user enable --now gpuqd.service
systemctl --user status gpuqd.serviceAdjust ExecStart if gpuq is installed outside ~/.local/bin. The supplied unit
uses KillMode=process, so restarting only the daemon does not kill independently
managed runners and training workers.
gpuq manages the jobs you submit and leaves other users' processes running. It checks available resources
before launch; --reserve leaves headroom for memory fluctuations on shared GPUs. Resource checks and
memory sampling are described in the scheduling guide.
Give your coding agent the gpuq skill to handle GPU jobs directly from a conversation. It covers queue selection, single- and multi-GPU submission, status and logs, remote code/checkpoint sync, and diagnosis of waiting or failed jobs. Remote and cluster details are loaded only when needed.
Install gpuq first using the instructions above. Then, from the root of a checkout containing
skills/gpuq, copy the complete skill folder:
mkdir -p "${CODEX_HOME:-$HOME/.codex}/skills"
cp -R skills/gpuq "${CODEX_HOME:-$HOME/.codex}/skills/"The default destination is ~/.codex/skills/gpuq. If it already exists, compare the files before updating
to preserve your customizations. Start a new session or refresh the skill list after installation.
The skill is distributed in the repository; installing the gpuq binary alone does not install it.
Mention $gpuq and describe the workload and target queue, for example:
- “Use $gpuq to submit
torchrun --standalone --nproc_per_node=2 train.pyon two local GPUs.” - “Use $gpuq to submit training to my
trainremote profile, includingcheckpoints/last.ckptfor resume.” - “Use $gpuq to check why job 42 is waiting in my shared pool, and show the relevant logs.”
Provide your config path when it differs from the default. The agent uses the CLI to perform the requested operations and reports the job ID and observed state. Remote profiles or a shared pool should already be configured unless setting them up is part of your request.
For other agents that support SKILL.md, copy the entire skills/gpuq/ directory into their skill search
path, including references/. agents/openai.yaml provides optional Codex UI metadata; the instructions
and references can be used independently.
Start with the engineering guide for architecture and module contracts. Documentation conventions are in AGENTS.md.
python -m pip install -e '.[dev]'
python scripts/check_docs.py
ruff check src tests scripts/check_docs.py
pytestThe test suite uses fake GPU backends and does not require a GPU. Contributions are welcome; see CONTRIBUTING.md. Security issues should follow SECURITY.md.
- CLI reference · 中文
- Scheduling guide · 中文
- Remote workspaces and environments · 中文
- Simple GPU pool configuration · 中文
- Shared pool setup and failover · 中文
- Changelog
MIT © Liu Zeyang and gpuq contributors. See LICENSE.