# Rgpu: a PyTorch device whose tensors live on a remote GPU

**URL:** <https://discuss.pytorch.org/t/rgpu-a-pytorch-device-whose-tensors-live-on-a-remote-gpu/225481>\
**Category:** projects\
**Created:** [October 3, 2026, 5:28am UTC](https://discuss.pytorch.org/t/rgpu-a-pytorch-device-whose-tensors-live-on-a-remote-gpu/225481 "2026-10-03T05:28:52Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![yanmi](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/yanmi/32/80063_2.png) [@yanmi](https://discuss.pytorch.org/u/yanmi)\
**Post date:** [October 3, 2026, 5:28am UTC](https://discuss.pytorch.org/t/rgpu-a-pytorch-device-whose-tensors-live-on-a-remote-gpu/225481/1 "2026-10-03T05:28:52Z")

</div>

Hi all. I’ve been building **rgpu** , which lets you write `device="rgpu"` on a laptop while the tensors and kernels live on a GPU host you reach over SSH.

```sh
pip install rgpu

```

```python
import torch, rgpu
x = torch.ones(4, device="rgpu")
print((x * 2).sum().item()) # 8.0, computed on the remote GPU

```

**How it works**

- rgpu is a PrivateUse1 backend with a `RemoteTensor` wrapper subclass. Each op’s output shape is worked out locally on meta tensors, so the op returns at once with a handle, and it’s queued and sent to the server in batches.
- Only `.item()`, `.cpu()`, printing, ops whose output size depends on the data, and an explicit synchronize wait for the server. Training nanoGPT for 20 iterations sent about 140,000 messages but waited only 5 times.
- `torch.compile(model, backend="rgpu")` sends the whole graph once, instead of one message per op.
- Autograd, AMP, optimizers and reconnecting after a dropped connection all work. A test suite checks results against CPU references.

**A data point:** training nanoGPT (10.8M parameters) from a Mac on an A40 about 116 ms away took 1.04 s per iteration, against 3.04 s per iteration on the Mac’s own GPU.

**Limits:**

- The protocol has no authentication, so it’s meant for an SSH tunnel to a machine you trust.
- The client and server need matching PyTorch major and minor versions.
- It’s not a replacement for running directly on the GPU host. On a single machine, eager mode costs real overhead, mostly CPU time on the client.

**A question for PyTorch developers:** once `rename_privateuse1_backend` has run, `getAccelerator()` returns PrivateUse1. After that, `backward()` on a local CUDA or MPS tensor in the same process fails an assertion in `engine.cpp` (pytorch/pytorch#161129, broken since 2.8). Is there a supported way for an out-of-tree backend to coexist with a local accelerator?

Docs: [Overview | rGPU](https://rgpu.pages.dev/docs/) · Code: [GitHub - ymcrcat/rgpu: Keep Python on your laptop. Run PyTorch operations and hold tensors on a remote GPU, including from a Mac with no CUDA installation. · GitHub](https://github.com/ymcrcat/rgpu)

Feedback welcome, especially from anyone with a workload where the GPU is far from where they write code.

---

<div class="post-metadata">

**Author:** ![sundaram](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/sundaram/32/79642_2.png) [@sundaram](https://discuss.pytorch.org/u/sundaram)\
**Post date:** [October 3, 2026, 6:11am UTC](https://discuss.pytorch.org/t/rgpu-a-pytorch-device-whose-tensors-live-on-a-remote-gpu/225481/2 "2026-10-03T06:11:26Z")

</div>

Hi @ymcrcat (and the PyTorch forum community),

I’ve been following the progress on **rgpu** and think the approach—intercepting PyTorch CUDA calls to run remote GPU execution while keeping local code execution lightweight—is brilliant for developers working without local CUDA hardware.

### Feedback & Observations

- **Architecture:** The client-side streaming model and CUDA operator shimming (cuBLAS/cuDNN integration) show great potential for low-latency remote execution.
- **Key Focus Areas:** Expanding operator support, improving handshake resilience over variable networks, and handling tensor memory lifetimes effectively will make this a staple tool for remote workflows.

### Collaboration & Maintenance

I’m very interested in helping actively drive this project forward! I can contribute by:

1. Testing and refining client-side features and connection handling.
2. Implementing and testing missing operator shims.
3. Helping triage forum feedback, issues, and pull requests.

If you are open to co-maintainers or core collaborators, I’d be thrilled to team up and help grow `rgpu`! Let me know where contributions would be most helpful right now.
