Skip to main content

Real-time Torch visualization window with Vulkan zero-copy

Project description

VULTORCH

GPU-Native Tensor Visualization for PyTorch

Visualize CUDA tensors at GPU speed โ€” zero CPU readback, zero staging buffers. Neural rendering, reinforcement learning, physics โ€” if it's in a tensor, Vultorch can display it.

License: MIT Python 3.8+ Vulkan

๐Ÿ‡จ๐Ÿ‡ณ ไธญๆ–‡ ยท ๐ŸŒ Website ยท ๐Ÿ“– Tutorial


Vultorch screenshot

Overview

Vultorch displays CUDA tensors in a native window โ€” data never leaves the GPU. show() performs a fast GPU-GPU copy; create_tensor() eliminates even that via Vulkan shared memory.

vultorch.show(tensor)                     # GPU-only, no CPU readback
tensor = vultorch.create_tensor(...)      # true zero-copy, no memcpy at all

Key Features

  • GPU-only display โ€” vultorch.show(tensor) does a fast GPU-GPU copy to Vulkan, no CPU readback ever
  • True zero-copy โ€” vultorch.create_tensor() returns a torch.Tensor backed by Vulkan shared memory โ€” zero memcpy
  • Declarative API โ€” View โ†’ Panel โ†’ Canvas with auto layout and per-frame callback support
  • Built-in ImGui โ€” Sliders, buttons, color pickers, plots, docking layout โ€” all from Python
  • 3D scene view โ€” Map textures onto lit 3D planes with orbit camera, MSAA, Blinn-Phong shading
  • Docking windows โ€” Drag-and-drop window arrangement (ImGui docking branch)
  • Not just rendering โ€” RL environments, cellular automata, signal processing โ€” anything tensor-based

Quick Start

pip install vultorch
import torch, vultorch

texture = torch.rand(512, 512, 4, device="cuda")

view = vultorch.View("Viewer", 800, 600)
panel = view.panel("Output")
panel.canvas("main").bind(texture)
view.run()

True Zero-Copy

# Shared GPU memory โ€” writes are instantly visible on screen
tensor = vultorch.create_tensor(512, 512, channels=4)
tensor[:] = model(input)   # write directly, no copy needed

Interactive Training Loop

view = vultorch.View("Training", 1000, 700)
ctrl = view.panel("Controls", side="left", width=0.25)
output = view.panel("Output")
out_canvas = output.canvas("render")

while view.step():
    lr = 10 ** ctrl.slider("log LR", -5.0, -1.0, default=-2.0)
    loss = train_one_step(lr)
    out_canvas.bind(output_tensor)
    view.end_step()

3D Scene

scene = vultorch.SceneView("3D", 800, 600, msaa=4)
scene.set_tensor(texture)
scene.render()  # orbit camera, Blinn-Phong lighting

Examples

# Example Description
01 hello_tensor Minimal CUDA tensor display
02 imgui_controls Multi-panel layout with ImGui widgets
03 training_test Live network training with GT comparison
04 conway Conway's Game of Life on GPU
05 image_viewer Load, transform & save images
06 pixel_canvas Interactive pixel-level drawing
07 multichannel RGB + depth + normal + alpha viewer
08 gt_vs_pred Training comparison with error heatmap
09 live_tuning Runtime hyperparameter adjustment
10 gaussian2d Differentiable 2D Gaussian splatting
11 3d_inspector Orbit camera with Blinn-Phong lighting
12 neural_workstation Full neural rendering workstation
13 snake_rl DQN learns Snake โ€” RL visualization
python examples/01_hello_tensor.py

Building from Source

Prerequisites

Component Required Notes
GPU โœ… Any Vulkan-capable GPU (NVIDIA, AMD, Intel)
Vulkan SDK โœ… Build lunarg.com/vulkan-sdk โ€” headers + glslangValidator
Vulkan driver โœ… Runtime Ships with your GPU driver
CUDA Toolkit Optional Enables GPU zero-copy in show() / create_tensor()
Python 3.8+ โœ… With development headers (python3-dev on Linux)
CMake 3.25+ โœ… Build

Step 1 โ€” Clone (with submodules)

git clone --recursive https://github.com/ChenlizheMe/Vultorch.git
cd Vultorch

If you forgot --recursive, run: git submodule update --init --recursive

Step 2 โ€” Configure

# Windows (MSVC)
cmake --preset release-windows

# Linux / WSL2 (GCC + Make)
cmake --preset release-linux

Step 3 โ€” Build

cmake --build --preset release-windows    # or release-linux

This executes three targets in order:

  1. _vultorch โ€” Compiles the C++ extension module (.pyd / .so) and SPIR-V shaders.
  2. package_wheel โ€” Runs tools/make_wheel.py to produce a pip-installable .whl in dist/.
  3. docs (optional) โ€” If mkdocs is installed, builds tutorial + API docs into docs/tutorial/.

Step 4 โ€” Install

pip install dist/vultorch-*.whl

Verify:

python -c "import vultorch; print(vultorch.__version__, 'CUDA:', vultorch.HAS_CUDA)"

WSL2 Quick Setup

sudo bash scripts/setup_wsl2.sh

Packaging

Single Wheel

python tools/make_wheel.py

Multi-Version Wheels

python scripts/build_wheels.py            # all defaults (3.8 โ€“ 3.12)
python scripts/build_wheels.py 3.10 3.11  # specific versions

Upload to PyPI

python scripts/upload_wheels.py

Testing

pytest                  # all tests
pytest -m "not gpu"     # pure Python only
pytest -m gpu           # GPU tests only
Marker Description
gpu Requires Vulkan-capable GPU with CUDA
slow Long-running tests

Documentation

Tutorial and API reference are built with MkDocs Material + i18n (English + Chinese).

mkdocs build --clean    # build
mkdocs serve            # preview at http://127.0.0.1:8000

Architecture

Vultorch/
โ”œโ”€โ”€ src/                     # C++ core (Vulkan + CUDA + ImGui)
โ”‚   โ”œโ”€โ”€ engine.cpp/h         # Vulkan + SDL3 + ImGui engine
โ”‚   โ”œโ”€โ”€ tensor_texture.*     # CUDA โ†” Vulkan zero-copy interop
โ”‚   โ”œโ”€โ”€ scene_renderer.*     # 3D renderer (MSAA, Blinn-Phong)
โ”‚   โ”œโ”€โ”€ bindings.cpp         # pybind11 bindings
โ”‚   โ””โ”€โ”€ shaders/             # GLSL โ†’ SPIR-V
โ”œโ”€โ”€ vultorch/                # Python package
โ”‚   โ”œโ”€โ”€ __init__.py          # High-level API
โ”‚   โ”œโ”€โ”€ app.py               # Declarative API (View, Panel, Canvas)
โ”‚   โ””โ”€โ”€ *.pyi                # Type stubs
โ”œโ”€โ”€ examples/                # 13 runnable demos
โ”œโ”€โ”€ tutorial/                # MkDocs source (EN + ZH)
โ”œโ”€โ”€ tests/                   # pytest (GPU + non-GPU)
โ”œโ”€โ”€ external/                # pybind11, SDL3, imgui
โ”œโ”€โ”€ tools/                   # make_wheel.py, spv_to_header.py
โ””โ”€โ”€ scripts/                 # build_wheels.py, upload_wheels.py

License

MIT


Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

vultorch-0.5.1-cp312-cp312-win_amd64.whl (1.7 MB view details)

Uploaded CPython 3.12Windows x86-64

vultorch-0.5.1-cp311-cp311-win_amd64.whl (1.7 MB view details)

Uploaded CPython 3.11Windows x86-64

vultorch-0.5.1-cp310-cp310-win_amd64.whl (1.7 MB view details)

Uploaded CPython 3.10Windows x86-64

vultorch-0.5.1-cp39-cp39-win_amd64.whl (1.7 MB view details)

Uploaded CPython 3.9Windows x86-64

vultorch-0.5.1-cp38-cp38-win_amd64.whl (1.7 MB view details)

Uploaded CPython 3.8Windows x86-64

File details

Details for the file vultorch-0.5.1-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: vultorch-0.5.1-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 1.7 MB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.25

File hashes

Hashes for vultorch-0.5.1-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 9044b519af7aee06ae083753a166917909e0900e8430c2c0407ea193f5b85702
MD5 7b753b58c7963d4ccb8cdb7c92ca7073
BLAKE2b-256 022312fe69f96aa22e75b834cfa5bdae68017fa7070ee8d37479f2fa49837191

See more details on using hashes here.

File details

Details for the file vultorch-0.5.1-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: vultorch-0.5.1-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 1.7 MB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.25

File hashes

Hashes for vultorch-0.5.1-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 3d3083dbc3900baa2c953b8d434603ebe92265b525cfc0eefbbcadf5455f7515
MD5 39989d3a5964f05a931c7e998a5b31f5
BLAKE2b-256 573288d37b4c1e459650588869f17196725960eb1637b329bc8b639515da5f34

See more details on using hashes here.

File details

Details for the file vultorch-0.5.1-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: vultorch-0.5.1-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 1.7 MB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.25

File hashes

Hashes for vultorch-0.5.1-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 dc8fbd94a968cc5f00d29bb710a4b7a1731d47c050ffdcc17490a956c209cce2
MD5 c15b7baacf12e8a6bd21c9973a666b39
BLAKE2b-256 6cd00b70e2b7929ec32b5efce57d60bb8e92fcd3a14db508318e8c564a99c73e

See more details on using hashes here.

File details

Details for the file vultorch-0.5.1-cp39-cp39-win_amd64.whl.

File metadata

  • Download URL: vultorch-0.5.1-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 1.7 MB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.25

File hashes

Hashes for vultorch-0.5.1-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 999cd1c79bd575a024f61e70c58e3839b33c77c0588547c2539d575c11f266e4
MD5 3fc180a436f84e4171e90704569ce90a
BLAKE2b-256 9360dfb615624d59b93753ad7618731ddc6a726354b467d8abb96512394b3702

See more details on using hashes here.

File details

Details for the file vultorch-0.5.1-cp38-cp38-win_amd64.whl.

File metadata

  • Download URL: vultorch-0.5.1-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 1.7 MB
  • Tags: CPython 3.8, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.25

File hashes

Hashes for vultorch-0.5.1-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 78947214d0c3660e099ed7b31d628b0f30d7bff4b097066cefe3e0dd0c3d83d6
MD5 9d9b5014b54516083ab4a23e3285de93
BLAKE2b-256 5b775e0a31aa5918e800e0b48c0c866d9b142617cc43a2b029b3a1b9e6676a7a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page