Skip to main content

GPUlayer

Run any workload on every GPU (and CPU) you can reach.
Install · Quickstart · AI agents · Why GPUlayer · Performance · Architecture · Docs · Examples · Changelog

GPUlayer sends a command, a Python function or a distributed job to machines that can run it (this one, remote servers, clusters, data centers, cloud VMs, or several at once), starts it there and brings back logs, outputs and results. PyTorch gets a deeper integration on top. Documentation: gpulayer.dev/docs.

v0.5.0. Tested on CPU, Apple Silicon (PyTorch MPS and MLX) and an NVIDIA Tesla T4, and on up to 30 machines on Google Cloud. Several GPUs per machine and NCCL across machines are implemented but not validated yet; cloud provisioning covers Google Cloud. See Status and roadmap.

Install

pip install gpulayer

That's it. Check what this machine can run:

gpulayer resources detect

To train with PyTorch, install it too: pip install "gpulayer[torch]".

Other ways to install
Method Command
As a standalone CLI with uv uv tool install gpulayer
Install script (own virtual environment, no sudo) curl -fsSL https://raw.githubusercontent.com/antonellof/gpulayer/main/install.sh | sh
Docker docker build -t gpulayer . (see deploy/docker)
Kubernetes (Helm) helm install gpulayer deploy/kubernetes/helm/gpulayer -n gpulayer --create-namespace (see Kubernetes)
From source, to run the examples git clone https://github.com/antonellof/gpulayer && cd gpulayer && pip install -e ".[dev,examples]"

More in Installation.

Quickstart

# Any command as a job: code and inputs shipped, outputs returned
gpulayer submit --accelerator cuda --source ./app -- ./render.sh

# PyTorch: the same script in this process, as 2-process DDP, or on 2 nodes
python examples/trainer_regression/train.py
python examples/trainer_regression/train.py --accelerator cpu --devices 2
python examples/trainer_regression/train.py --accelerator cpu --nodes 2 --devices 2

# More machines: run this on the server, then paste the printed `gpulayer join` line elsewhere
gpulayer up

# See what ran
gpulayer dashboard
import gpulayer as gl

@gl.remote(accelerator="mps", frameworks={"mlx": ">=0.10"})   # any library, any GPU
def benchmark(n: int) -> dict: ...

benchmark.map([1024, 2048, 4096])                           # in parallel

GPUlayer dashboard

The full quickstart walks through each step with its output.

For AI and coding agents

gpulayer mcp is an MCP server, so Claude Code, Claude Desktop, Cursor, Codex and VS Code agents can list GPUs, submit jobs, wait, read logs and download outputs. An Agent Skill covers agents that use the CLI.

claude mcp add gpulayer -- gpulayer mcp

See AI and coding agents.

Why GPUlayer

Most GPU code assumes the GPU is on the machine where you run it. With GPUlayer you describe what a workload needs (an accelerator, GPU memory, frameworks) and it runs on a machine that has it, wherever that machine is.

Situation Without GPUlayer With GPUlayer
Code on a laptop, GPU elsewhere ssh, copy code, rebuild the environment, tmux, copy results back gpulayer submit --target remote -- <cmd>
Several GPU machines track free machines by hand; jobs crash on the wrong GPU or library one queue; each job lands where it can run, or is rejected with the reason
NVIDIA servers and Apple Silicon Macs separate scripts and setup per machine ask for cuda or mps; one interface
Many independent tasks loops and ad hoc scripts fn.map([...]) across free GPUs
Multi-node training torchrun on every node with matching ranks and addresses Trainer(num_nodes=2, devices=4)

On one machine with one GPU, running your code directly is simpler. GPUlayer runs services without a load balancer in front of them, and is not a sandbox for untrusted code. More in Why GPUlayer.

Performance and comparison

Measured on one NVIDIA Tesla T4 against PyTorch Lightning, with the same model, data and optimizer:

Training step time: GPUlayer and PyTorch Lightning Training step time: GPUlayer and PyTorch Lightning

  • GPUlayer's Trainer is 1.3 to 1.4x faster per step on small models and the same on a compute-bound CNN, and starts about 0.6 s sooner.
  • One training job on 8 machines runs 3.6x faster than on one. With two-level gradient sync on CPUs (gloo), GPUlayer trains 11.9% faster than Lightning under torchrun on 8 machines (50.5 s vs 57.3 s; 5.3% on 4, 1.6% on 2), and it starts every machine from one Trainer(num_nodes=N) call.
  • Distributed jobs start 1.1 to 2.3 s faster than through torchrun; tested on up to 16 machines (32 processes) and 30 workers across two GCP regions.
  • Across two machines: a distributed job spanning both, fail-fast in 2.7 s, and 55.6 small jobs per second.

One training job on more machines One training job on more machines

Method, all charts and raw logs: Performance and comparison. Reproduce them with benchmarks/.

Architecture

Your workloads go through GPUlayer to the machines you can reach Your workloads go through GPUlayer to the machines you can reach

GPUlayer has three parts:

  • Clients submit work: the gpulayer CLI, the Python SDK (@gl.remote, gl.Client), the PyTorch Trainer and launch(), and the MCP server for AI agents. A job states what it needs (accelerator, GPU count and memory, frameworks), not which machine to use.
  • The control plane keeps the job queue, picks a worker for each job and records the reason when no worker fits. It stores code bundles, inputs, outputs and logs, and checks tokens. For work on one machine it runs inside your process; for several machines it runs as a server (gpulayer up).
  • Workers, one per machine, report their GPUs and installed frameworks, ask the control plane for tasks, run them as normal processes (one per rank for distributed jobs), stream logs back and upload outputs. Workers open every connection themselves, so they can sit behind NAT. A cloud VM is a worker that joined with gpulayer join.

A job goes from queued to scheduled when a worker fits, then running, and ends as succeeded, failed, cancelled or timed_out. Frameworks such as PyTorch, JAX, MLX and CuPy still decide how the computation uses the GPU; GPUlayer decides which GPU runs it. More in Architecture overview.

Development

uv pip install -e '.[dev,examples]'
.venv/bin/pytest && .venv/bin/ruff check src tests && .venv/bin/mypy src

See Contributing.

License

Apache License 2.0, see LICENSE.

Metadata

Release files for gpulayer 0.5.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for gpulayer 0.5.0
File Size Uploaded Provenance Actions
gpulayer-0.5.0.tar.gz 2.2 MB With provenance Details for gpulayer-0.5.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for gpulayer 0.5.0
File Interpreter ABI Platform Actions
gpulayer-0.5.0-py3-none-any.whl Python 3 none any Details for gpulayer-0.5.0-py3-none-any.whl

Total release size: 2.4 MB

Release files / gpulayer-0.5.0.tar.gz

Download URL gpulayer-0.5.0.tar.gz
Size 2.2 MB
Tags Source
SHA-256 checksum
How to use checksums
afb60d0bf5e74951adcfe202110468fa3719e13e3923acfe32096e722e0be7aa
BLAKE2b-256 checksum
How to use checksums
2a2208c91a58a7c564edb6342ac74160d437f0ae1cff7bd8f57fb18f07755b42
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 30, 2026.

Transparency log

Release files / gpulayer-0.5.0-py3-none-any.whl

Download URL gpulayer-0.5.0-py3-none-any.whl
Size 162.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a3414a457c5cc21c6bfb69b7af04115bad318b97dad297a0bb4c51f87f88cc6f
BLAKE2b-256 checksum
How to use checksums
c170db02ee1d2089917f66e53083850255f80a03fcaad19f6e89b578ee3d590f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 30, 2026.

Transparency log

Security for gpulayer 0.5.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for gpulayer-0.5.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 30, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page