rGPU Open-Sourced: Enables Remote NVIDIA GPU Execution for PyTorch Tensors and CUDA Binaries

Original title: Show HN: Rgpu – a PyTorch device whose tensors live on a remote GPU
68AI Score

rGPU is an open-source tool that offloads computation to remote NVIDIA GPUs while keeping applications local. It offers two integration paths: a native PyTorch device backend supporting `rgpu`, and a CUDA shim intercepting low-level APIs for existing binaries. This solution addresses remote training and inference needs in scenarios with limited local compute or resource isolation requirements.

Related Entities

Full Report

Contents4 sections

rGPU

rGPU 在远程 NVIDIA 机器上运行 GPU 任务,而应用程序则保留在客户端。目前它提供两种使用路径:

路径适用场景接口
PyTorch 设备可启用 rgpu 设备的 PyTorch 程序通过 TCP 进行的 torch 操作
CUDA shim现有的 Linux CUDA 程序,包括标准 CUDA PyTorchlibcuda、CUDA Runtime、cuBLAS、cuBLASLt 和 cuDNN shims

PyTorch 设备是更简单的集成方式。CUDA shim 覆盖现有二进制文件,但具有更大的兼容性范围。

文档

website/ 中的 Fumadocs 站点即为产品文档:

工程记录与实验索引见 docs/README.md。

快速开始:PyTorch 设备

通过 pip install rgpu 安装 rGPU,或在此代码库中执行 pip install -e ./python,然后按照快速开始部署服务器。将以下内容保存为工作目录下的 smoke.py:

PYTHON
import torch
import rgpu

x = torch.ones(4, device="rgpu")
print((x * 2).sum().item())  # 8.0

在安装 rGPU 的环境中运行该程序,并使用服务器的 SSH 目标地址及选项:

BASH
rgpu-run --host user@gpu-host --ssh-port 2222 -i ~/.ssh/gpu_key \
  python smoke.py

程序选择设备;rgpu-run 负责建立隧道并配置连接。预期输出为 8.0。

对于现有的 Linux CUDA 程序,请遵循 CUDA shim 指南,从 ./scripts/build_client.sh 开始。

这两种协议均不对连接进行身份验证或加密。请将 rgpu-opserver 保持默认的 localhost 绑定,并使用 SSH。CUDA 服务器监听所有 IPv4 接口:即使使用 SSH 隧道,在启动前也需通过主机/云防火墙规则限制端口 9713。参见部署。

开发

BASH
# C++ 客户端和 fake-driver 测试
./scripts/build_client.sh

# Python 测试
python -m pip install -e './python[test]'
python -m pytest python/tests

# 静态文档
npm --prefix website ci
npm --prefix website run build

有关其余的构建、云和硬件命令,请参阅 scripts/README.md。生成的 C++ 代码已提交至仓库;其策略和重新生成步骤详见 codegen/README.md。

仓库结构图

路径用途
client/CUDA 客户端垫片(shims)与传输层
server/CUDA 服务器与调度分发
common/共享协议及生成的 API 元数据
python/PyTorch 设备与启动器
tests/C++、Python、CUDA 及硬件检查
codegen/CUDA 头文件解析器与源代码生成器
website/Fumadocs 产品文档
docs/设计记录、测量数据及实验报告
jax/实验性 JAX 工作;非受支持的产品路径
scripts/构建、部署、云及测试辅助脚本
skills/用于使用 rGPU 的可安装智能体指南

历史实现笔记和实验结果已在 docs/README.md 中索引。


作者发帖说明(HN):

rGPU 在远程 NVIDIA 机器上运行 GPU 任务,而应用程序仍保留在客户端。