Skip to main content

GPUlayer

Train PyTorch on every GPU you can reach.
One Trainer, from your laptop to many machines.
Install · Quickstart · Performance · AI agents · Architecture · Docs · Examples · Changelog

The GPUlayer Trainer runs the same PyTorch script in your process, on every GPU of a machine, or across many machines: laptops, workstations, servers and cloud VMs. It picks machines and GPUs that can train the model, starts every process, and brings back logs, checkpoints and metrics. It uses PyTorch Lightning's names (LightningModule hooks, manual optimization, DataModule, callbacks, loggers, profilers, tuner), so most Lightning code moves with an import change.

NVIDIA CUDA, Apple Metal (MPS) and CPU are validated on hardware. AMD ROCm is implemented and not yet validated. Docs: gpulayer.dev/docs.

v0.8.0. Validated on a Tesla T4, 4× RTX 3070, 2× A100 (NVLink), an Apple M2 Pro, and distributed CPU training on up to 16 Google Cloud machines. NCCL across machines is implemented but not validated. See Status.

Install

pip install gpulayer

Check what this machine can train on:

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 pull ghcr.io/antonellof/gpulayer:0.8.0 (also :0.8.0-torch; 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

import gpulayer.pytorch as glt

trainer = glt.Trainer(max_epochs=5, accelerator="cuda", devices=4, num_nodes=2)
trainer.fit(model, train_loader)          # 2 machines x 4 GPUs, DDP over NCCL
# The same file in this process, as 2-process DDP, or on 2 nodes: only the flags change
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: start a server on one, join the others, and point your laptop at it. Each line is printed by gpulayer up; on a single machine, use three terminals.

gpulayer up                                                    # machine 1: the server, runs jobs too
gpulayer join https://192.168.1.56:8470 --token glj_... --fingerprint sha256:...   # each GPU machine
export GPULAYER_URL=https://192.168.1.56:8470 GPULAYER_TOKEN=glc_... GPULAYER_FINGERPRINT=sha256:...
python examples/trainer_regression/train.py --accelerator cpu --nodes 2   # one node per worker

The full quickstart shows the output of each step.

Performance

Against PyTorch Lightning, with the same model, data and optimizer and each trainer's defaults, the GPUlayer Trainer was faster in 10 of 11 GPU cases and in every CPU case.

Training step time: GPUlayer and PyTorch Lightning Training step time: GPUlayer and PyTorch Lightning Several GPUs in one machine Several GPUs in one machine

Hardware GPUlayer Trainer against Lightning
Tesla T4 1.14 to 1.39x per step
1, 2 and 4 RTX 3070s (DDP over NCCL) 1.11 to 1.76x in 5 cases; 1.14x slower on one GPU with a CNN
Apple M2 Pro, GPU and CPU 1.05 to 1.75x
8 CPU machines on Google Cloud (gloo) 11.9% faster (Lightning under torchrun)

Keeping a 4-machine run in one zone instead of two regions made it 1.38x faster (42.5 s vs 58.8 s). Method and logs: Performance; scripts in benchmarks/.

How it works

Your training goes through GPUlayer to the machines you can reach Your training goes through GPUlayer to the machines you can reach

The Trainer submits a run that says what it needs (accelerator, number of GPUs and machines, GPU memory). A control plane, inside your process or run as a server with gpulayer up, picks machines that can train it: the best-connected GPUs of a machine, and machines in one zone when it can. A worker on each machine starts the ranks, streams logs and uploads checkpoints. Workers open every connection themselves, so machines can sit behind NAT. More in the Architecture overview.

The same engine runs plain commands and Python functions as jobs, and gpulayer mcp lets coding agents start runs and read their results (AI agents).

With one GPU on the machine you are using, a plain training loop is simpler. Jobs are not sandboxed, so use GPUlayer among people who trust each other.

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.8.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.8.0
File Size Uploaded Provenance Actions
gpulayer-0.8.0.tar.gz 2.3 MB With provenance Details for gpulayer-0.8.0.tar.gz

Built distribution (wheel)

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

Total release size: 2.6 MB

Release files / gpulayer-0.8.0.tar.gz

Download URL gpulayer-0.8.0.tar.gz
Size 2.3 MB
Tags Source
SHA-256 checksum
How to use checksums
d0f3b398e04f8a88628389655b827f1cc025c5049dc1494f334c9fcb3d3412b5
BLAKE2b-256 checksum
How to use checksums
591d8e5689acaa5c12581f8e87ad3d7bca14c4e994829d9b3379387b0277b01e
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 Nov 1, 2026.

Transparency log

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

Download URL gpulayer-0.8.0-py3-none-any.whl
Size 221.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1cc91becaabd3e804bf151fac41dd7f96313fc07bf5666ba4dabd8b8446d7d6c
BLAKE2b-256 checksum
How to use checksums
2073bf8321308ce0ce4d5fe60a5b68f9e8f13f5d4b816e8885aa42e512fba1ab
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 Nov 1, 2026.

Transparency log

Security for gpulayer 0.8.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.8.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 Nov 1, 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