Skip to content

Repository files navigation

gpu-node

P2P GPU compute. Submit jobs from anywhere, run them on any machine with a GPU.

Architecture

Submitter                    Worker (GPU machine)
  |                               |
  |  Tailscale VPN + sshfs        |
  +--> queue/job.sh ------------> Rust worker (in Docker, --gpus all)
                                  executes job, captures output
       done/job.sh  <------------ moves when done
       logs/job.sh.out <--------- stdout/stderr
       models/ <----------------- trained models, artifacts

Everything is Rust. The Docker worker is a compiled Rust binary (zero deps). The submitter GUI is GTK4+Rust with an embedded MCP server.

Quick Start

git clone https://github.com/karans4/gpu-node && cd gpu-node
./demo.sh

One image. Has GPU? Uses it. Doesn't? Falls back to CPU.

Two-Machine Setup with Tailscale

1. Install Tailscale on both machines

curl -fsSL https://tailscale.com/install.sh | sh
sudo tailscale up
tailscale ip -4   # note this IP

2. GPU machine: create shared directory + start worker

mkdir -p /data/gpujobs
docker build -t gpu-node -f Dockerfile.worker .
docker run -d --restart=unless-stopped --gpus all \
    --name gpu-worker \
    -v /data/gpujobs:/data \
    gpu-node

3. Submitter: mount the shared directory

# install sshfs
sudo apt install sshfs  # or brew install sshfs

# mount GPU machine's /data/gpujobs locally
sshfs user@<tailscale-ip>:/data/gpujobs /mnt/gpujobs

# submit a job
cp jobs/gpu-benchmark.sh /mnt/gpujobs/queue/
# watch it run
watch ls /mnt/gpujobs/{queue,running,done}
# read the log
cat /mnt/gpujobs/logs/*gpu-benchmark*.out

4. (Optional) GUI + MCP

cd gpu-node-gui && cargo build --release
./target/release/gpu-node-gui            # GTK4 window
# or
GPU_WORKDIR=/mnt/gpujobs ./target/release/gpu-node-gui --mcp  # for Claude Code

MCP tools: submit_job, queue_status, get_log, list_jobs, cancel_job, set_workdir, start_worker, stop_worker

Writing Jobs

Any bash script in queue/ gets executed. PyTorch + CUDA are available inside the container.

#!/bin/bash
python3 -c "
import torch
x = torch.randn(4096, 4096, device='cuda')
y = x @ x
print(f'result norm: {y.norm().item():.2f}')
"

See jobs/ for real examples.

What's in the box

File What
gpu-node-worker/ Rust worker binary (zero deps, runs in Docker)
gpu-node-gui/ GTK4 GUI + MCP server (Rust)
Dockerfile.worker CUDA 12.2 + PyTorch + Rust worker (falls back to CPU)
jobs/ Example compute scripts
demo.sh One-command end-to-end demo

About

GTK4+Rust GUI for Docker-based Slurm GPU worker node

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages