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.3.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 is simulated. 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)
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 jobs that finish (long-running services are planned) 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.4x faster than on one, and GPUlayer finishes it 7% sooner than Lightning under torchrun (39.9 s vs 42.8 s; 9% sooner on one machine).
  • 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.3.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.3.0
File Size Uploaded Provenance Actions
gpulayer-0.3.0.tar.gz 2.2 MB With provenance Details for gpulayer-0.3.0.tar.gz

Built distribution (wheel)

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

Total release size: 2.3 MB

Release files / gpulayer-0.3.0.tar.gz

Download URL gpulayer-0.3.0.tar.gz
Size 2.2 MB
Tags Source
SHA-256 checksum
How to use checksums
645d4df5a759427a8f477bfd5def2798773e39432d186aaeba6d885942f4eb3e
BLAKE2b-256 checksum
How to use checksums
4779393e29728eccbd5013c1582e91443a1b1ff5167bb93b96801cb1a5e72d04
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.3.0-py3-none-any.whl

Download URL gpulayer-0.3.0-py3-none-any.whl
Size 146.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e6ba7fdc1377f42e0a543876092ef3b729b6fb9c748123565fdf75d0f0c05813
BLAKE2b-256 checksum
How to use checksums
c1373220b30304caec505d2086621b306cf975004356c7f0ffc13b135fcaa8d5
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.3.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.3.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