Skip to content

IammSwanand/UniGPU

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

57 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

You can download the UniGPU Agent's .exe file from here πŸ‘‰

⬑ UniGPU

Peer-to-Peer GPU Compute Marketplace β€” Built for Students, by Students


πŸš€ What is UniGPU?

UniGPU is a peer-to-peer GPU sharing platform that connects students who need compute power with students who have idle GPUs.

The Problem: High-performance GPUs are expensive and inaccessible to many students. Training ML models requires powerful hardware most individuals can't afford β€” yet thousands of student GPUs sit idle every day.

The Solution: UniGPU lets you share your idle GPU and earn credits, or submit training jobs that run on someone else's GPU. Every job is executed inside a secure, isolated Docker container with NVIDIA GPU runtime. The platform handles scheduling, execution, real-time log streaming, and usage-based billing β€” all automatically.


πŸ—οΈ Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     REST API      β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   Frontend   β”‚ ◄──────────────► β”‚         Backend (Docker)          β”‚
β”‚  Vite+React  β”‚   localhost:5173  β”‚                                  β”‚
β”‚  :5173       β”‚                   β”‚  FastAPI (:8000)                 β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜     WebSocket     β”‚  PostgreSQL (:5432)              β”‚
                                   β”‚  Redis (:6379)                   β”‚
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  ◄──────────────► β”‚  Celery Worker (job matching)    β”‚
β”‚  GPU Agent   β”‚   ws://...:8000   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
β”‚  (Python)    β”‚
β”‚  Student PC  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ› οΈ Tech Stack

Layer Technology
Frontend React 19, Vite 7, React Router, FontAwesome, Cloudinary
Backend API FastAPI (Python), async SQLAlchemy, Pydantic
Database PostgreSQL 16
Cache / Broker Redis 7
Task Queue Celery (job matching, heartbeat monitoring)
Auth JWT (jose), bcrypt password hashing
Agent Python (websockets, docker SDK, pynvml, pystray)
Job Isolation Docker containers with NVIDIA GPU runtime
Infrastructure Docker Compose (4 services)

πŸ“‹ Prerequisites

Before you begin, ensure you have the following installed:


⚑ Quick Start

1. Clone the Repository

git clone https://github.com/IammSwanand/UniGPU.git
cd UniGPU

2. Start the Backend

This spins up 4 Docker containers: PostgreSQL, Redis, FastAPI, and Celery Worker.

docker compose up --build

Windows users: If docker is not found, add Docker to PATH first:

$env:PATH += ";C:\Program Files\Docker\Docker\resources\bin"

Wait until you see the backend is ready (FastAPI logs will show Uvicorn running on 0.0.0.0:8000).

3. Start the Frontend

cd frontend
npm install        # first time only
npm run dev

The app opens at http://localhost:5173

4. Create an Account

Visit http://localhost:5173/register and sign up as either a Client or Provider.


πŸ‘€ Client Flow β€” Submit Training Jobs

As a Client, you want to run GPU-intensive workloads (ML training scripts) without owning a GPU.

  1. Register / Login as a Client
  2. Top up your wallet with credits from the Client Dashboard
  3. Upload your training script (.py file) and optionally a requirements.txt
  4. Select a GPU from the available GPUs list, or let the system auto-assign
  5. Submit the job β€” it enters a queue and gets matched to an available GPU
  6. Monitor progress β€” view real-time logs via the "πŸ“‹ Logs" button
  7. Download logs β€” once complete, click "⬇ Download" in the log viewer to save output as .txt
  8. Billing β€” credits are deducted based on GPU usage time (β‚Ή0.002/second)
Client uploads script  β†’  Backend queues job  β†’  Celery matches to GPU
     β†’  Agent receives job  β†’  Runs in Docker  β†’  Streams logs  β†’  Done

πŸ–₯️ Provider Flow β€” Share Your GPU & Earn

As a Provider, you share your idle GPU with the network and earn credits for every job it runs.

  1. Register / Login as a Provider
  2. Download the UniGPU Agent from the Download page
  3. Run the Agent β€” double-click the .exe, the setup wizard guides you through:
    • Detecting your GPU hardware (name, VRAM, CUDA version)
    • Registering your GPU with the backend
    • Configuring the WebSocket connection
  4. Go Online β€” your GPU appears in the marketplace and starts accepting jobs
  5. Monitor from Dashboard β€” the Provider Dashboard shows:
    • GPU status & health metrics (utilization, temperature, memory)
    • Real-time agent logs
    • Earnings & transaction history
  6. Jobs run automatically β€” the agent receives jobs, runs them in Docker containers, streams logs, and reports results
  7. Go Offline anytime β€” toggle from the dashboard to pause accepting jobs
Agent starts  β†’  WebSocket connects  β†’  Heartbeats keep GPU "online"
     β†’  Job assigned  β†’  Docker container runs  β†’  Logs streamed  β†’  Credits earned

Agent Requirements (Provider Machine)

  • NVIDIA GPU with CUDA support
  • Docker Desktop with NVIDIA Container Toolkit
  • Windows 10/11 (Linux/macOS coming soon)

πŸ“‚ Project Structure

UniGPU/
β”œβ”€β”€ backend/                    # FastAPI backend
β”‚   β”œβ”€β”€ app/
β”‚   β”‚   β”œβ”€β”€ main.py            # App entry + CORS + routers
β”‚   β”‚   β”œβ”€β”€ config.py          # Settings (DB, Redis, JWT)
β”‚   β”‚   β”œβ”€β”€ database.py        # Async SQLAlchemy setup
β”‚   β”‚   β”œβ”€β”€ deps.py            # Auth dependencies (JWT)
β”‚   β”‚   β”œβ”€β”€ models/            # SQLAlchemy models
β”‚   β”‚   β”œβ”€β”€ schemas/           # Pydantic request/response schemas
β”‚   β”‚   β”œβ”€β”€ routers/           # API endpoints
β”‚   β”‚   β”‚   β”œβ”€β”€ auth.py        # Register, Login
β”‚   β”‚   β”‚   β”œβ”€β”€ gpus.py        # GPU registration & status
β”‚   β”‚   β”‚   β”œβ”€β”€ jobs.py        # Job submission & management
β”‚   β”‚   β”‚   β”œβ”€β”€ wallet.py      # Wallet & transactions
β”‚   β”‚   β”‚   └── ws.py          # WebSocket for agent communication
β”‚   β”‚   └── services/          # Business logic
β”‚   β”‚       β”œβ”€β”€ billing.py     # Usage-based billing
β”‚   β”‚       β”œβ”€β”€ matching.py    # Job-to-GPU matching
β”‚   β”‚       └── connection_manager.py
β”‚   β”œβ”€β”€ Dockerfile
β”‚   └── requirements.txt
β”‚
β”œβ”€β”€ frontend/                   # Vite + React SPA
β”‚   └── src/
β”‚       β”œβ”€β”€ api/client.js      # API wrapper (Axios-like)
β”‚       β”œβ”€β”€ context/           # Auth context (JWT storage)
β”‚       β”œβ”€β”€ components/        # Shared components (Sidebar)
β”‚       └── pages/             # Route pages
β”‚           β”œβ”€β”€ Landing.jsx    # Homepage
β”‚           β”œβ”€β”€ Login.jsx      # Authentication
β”‚           β”œβ”€β”€ Register.jsx   # Account creation
β”‚           β”œβ”€β”€ ClientDashboard.jsx    # Job submission & wallet
β”‚           β”œβ”€β”€ ProviderDashboard.jsx  # GPU monitoring & earnings
β”‚           β”œβ”€β”€ Download.jsx   # Agent download page
β”‚           β”œβ”€β”€ AboutUs.jsx    # Team info
β”‚           └── HowToUse.jsx   # User guide
β”‚
└── docker-compose.yml          # Backend stack orchestration

πŸ”Œ API Reference

Full interactive API docs available at http://localhost:8000/docs (Swagger UI).

Auth

Method Endpoint Description
POST /auth/register Register a new user
POST /auth/login Login β†’ returns JWT token

GPUs

Method Endpoint Description
GET /gpus/ List all GPUs
GET /gpus/available List online GPUs
POST /gpus/register Register a GPU (provider)
PATCH /gpus/{id}/status Set GPU online/offline

Jobs

Method Endpoint Description
POST /jobs/submit Upload script + requirements
GET /jobs/ List user's jobs
GET /jobs/{id}/logs Get job logs
DELETE /jobs/{id} Delete a job

Wallet

Method Endpoint Description
GET /wallet/ Get balance
POST /wallet/topup Add credits
GET /wallet/transactions Transaction history

WebSocket

Endpoint Description
ws://localhost:8000/ws/agent/{gpu_id} Real-time agent ↔ backend communication

πŸ§ͺ Common Commands

Action Command
Start backend docker compose up --build
Start backend (detached) docker compose up --build -d
Stop backend docker compose down
Stop + wipe database docker compose down -v
View backend logs docker compose logs backend -f
Start frontend cd frontend && npm run dev
Build frontend cd frontend && npm run build

🀝 Contributing

  1. Fork the repository
  2. Clone your fork: git clone https://github.com/<your-username>/UniGPU.git
  3. Create a branch: git checkout -b feature/your-feature
  4. Set up the backend: docker compose up --build
  5. Set up the frontend: cd frontend && npm install && npm run dev
  6. Make your changes and test locally
  7. Push and open a Pull Request

πŸ“„ License

This project is proprietary software. All rights reserved.

Unauthorized copying, modification, distribution, or use of this software, in whole or in part, is strictly prohibited without explicit written permission from the authors.


πŸ‘₯ Credits

UniGPU is built with ❀️ by:

Name Role GitHub
🧠 Swanand Wakadmane Co-founder & Developer @IammSwanand
πŸ’» Sujal Kadam Co-founder & Developer @withonly-sujal

AI & Data Science / Information Technology Engineering Undergraduates, Class of 2027


⬑ UniGPU β€” Peer-to-Peer GPU Marketplace
Built for Students Β· By Students

Β© 2026 UniGPU. All rights reserved.

About

UniGPU is a peer-to-peer GPU marketplace that enables students to rent out idle GPUs while allowing clients to execute secure, containerized GPU workloads remotely.

Topics

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors