Real-time Torch visualization window with Vulkan zero-copy
Project description
๐ฅ Vultorch
Real-time Torch Visualization Window ยท Vulkan Zero-Copy
Visualize CUDA tensors at GPU speed โ zero CPU readback, zero staging buffers.
๐จ๐ณ ไธญๆ ยท ๐ Website
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 โ Canvaswith 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)
Quick Start
pip install vultorch
import torch, vultorch
# Your neural texture output (or any CUDA tensor)
texture = torch.rand(512, 512, 4, device="cuda")
view = vultorch.View("Neural Texture 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
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.py |
Minimal tensor display |
02_imgui_controls.py |
Multi-panel layout with docking |
03_training_test.py |
Tiny network live training (GT vs prediction + bottom info panel) |
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
Choose the preset matching your platform:
# Windows (MSVC)
cmake --preset release-windows
# Linux / WSL2 (GCC + Make)
cmake --preset release-linux
CMake automatically detects your active Python interpreter and CUDA toolkit (if installed).
Step 3 โ Build
cmake --build --preset release-windows # or release-linux
This executes three targets in order:
_vultorchโ Compiles the C++ extension module (.pyd/.so) and SPIR-V shaders.package_wheelโ Runstools/make_wheel.pyto produce a pip-installable.whlindist/.docs(optional) โ Ifmkdocsis installed, builds tutorial + API docs intodocs/tutorial/.
Step 4 โ Install
pip install dist/vultorch-*.whl
Verify:
python -c "import vultorch; print(vultorch.__version__, 'CUDA:', vultorch.HAS_CUDA)"
WSL2 Quick Setup
A one-command setup script for Ubuntu WSL2:
sudo bash scripts/setup_wsl2.sh
This installs all system dependencies (CMake, Vulkan headers, SDL2 dev libs, Python dev).
Packaging
Single Wheel
The build already produces a wheel in dist/. You can also manually run:
python tools/make_wheel.py
This reads the compiled _vultorch.*.pyd / .so from vultorch/, bundles it with the Python package files, and outputs a platform-specific .whl to dist/.
Multi-Version Wheels
Build wheels for multiple Python versions (requires conda):
# All default versions (3.8 โ 3.12)
python scripts/build_wheels.py
# Specific versions
python scripts/build_wheels.py 3.10 3.11 3.12
Each version gets a separate conda environment; CMake is re-configured and rebuilt for each.
Upload to PyPI
# Interactive token prompt
python scripts/upload_wheels.py
# Pass token directly
python scripts/upload_wheels.py --token pypi-YOUR_TOKEN
Requires twine (auto-installed if missing).
Testing
Tests use pytest with two custom markers:
| Marker | Description |
|---|---|
gpu |
Requires a Vulkan-capable GPU with CUDA |
slow |
Long-running tests |
Run All Tests
pytest
Run Only Non-GPU (Pure Python) Tests
pytest -m "not gpu"
Run GPU Tests Only
pytest -m gpu
Run with Verbose Output
pytest -ra -v
Test Structure
| File | Scope |
|---|---|
tests/conftest.py |
Shared fixtures + skip decorators |
tests/test_import.py |
Package import, version, module structure |
tests/test_camera_light.py |
Camera / Light data classes |
tests/test_normalize_tensor.py |
_normalize_tensor() dtype, shape, contiguity |
tests/test_show.py |
show() / create_tensor() error paths |
tests/test_declarative_api.py |
Canvas / Panel / View / RowContext (non-GPU) |
tests/test_edge_cases.py |
Edge-case and error-path coverage |
tests/test_ui_bindings.py |
All vultorch.ui.* functions exist |
tests/test_project_structure.py |
Type stubs, configs, examples, tutorials |
tests/test_tools_spv_to_header.py |
tools/spv_to_header.py |
tests/test_tools_make_wheel.py |
tools/make_wheel.py |
tests/test_scripts.py |
scripts/build_wheels.py + upload_wheels.py |
tests/test_gpu_integration.py |
GPU: Window, show(), create_tensor(), SceneView, ImGui |
tests/test_engine_bindings.py |
GPU: C++ Engine class bindings |
tests/test_panel_widgets_gpu.py |
GPU: Panel widgets + Canvas in real render loop |
Documentation
Tutorial & API Reference
Documentation is built with MkDocs Material and the i18n plugin (English + Chinese).
Source files live in tutorial/:
tutorial/
โโโ index.md / index.zh.md # Home page
โโโ 01_hello_tensor.md / .zh.md # Tutorial: Hello Tensor
โโโ 02_multi_panel.md / .zh.md # Tutorial: Multi-Panel
โโโ 03_training_test.md / .zh.md # Tutorial: Training Test
โโโ api.md / api.zh.md # API Reference
When Are Docs Generated?
Docs are built automatically as the last build target (after package_wheel), provided:
mkdocsis installed:pip install mkdocs-material mkdocs-static-i18nVULTORCH_BUILD_DOCS=ON(default)
The generated site lands in docs/tutorial/ (served via GitHub Pages).
Build Docs Manually
mkdocs build --clean
Preview Docs Locally
mkdocs serve
Opens at http://127.0.0.1:8000/.
Disable Doc Build
cmake --preset release-windows -DVULTORCH_BUILD_DOCS=OFF
Architecture
Vultorch/
โโโ CMakeLists.txt # Build system (compile + wheel + docs)
โโโ CMakePresets.json # Cross-platform build presets
โโโ pyproject.toml # Python package metadata
โโโ src/ # C++ core
โ โโโ engine.cpp/h # Vulkan + SDL3 + ImGui engine
โ โโโ tensor_texture.* # CUDA โ Vulkan zero-copy interop
โ โโโ scene_renderer.* # Offscreen 3D renderer (MSAA, Blinn-Phong)
โ โโโ bindings.cpp # pybind11 Python bindings
โ โโโ shaders/ # GLSL shaders โ SPIR-V
โโโ vultorch/ # Python package
โ โโโ __init__.py # High-level API (Window, show, SceneView)
โ โโโ app.py # Declarative API (View, Panel, Canvas)
โ โโโ __init__.pyi # Type stubs
โ โโโ ui.pyi # ImGui binding stubs
โ โโโ py.typed # PEP 561 marker
โโโ external/ # Git submodules
โ โโโ pybind11/ # C++ โ Python binding
โ โโโ SDL/ # Window / input (SDL3)
โ โโโ imgui/ # Dear ImGui (docking branch)
โโโ examples/ # Ready-to-run demos
โโโ tests/ # pytest tests (GPU + non-GPU)
โโโ tools/ # Build-time utilities
โ โโโ make_wheel.py # Wheel packaging
โ โโโ spv_to_header.py # SPIR-V โ C header
โโโ scripts/ # Developer scripts
โ โโโ build_wheels.py # Multi-Python wheel builder
โ โโโ upload_wheels.py # PyPI upload via twine
โ โโโ setup_wsl2.sh # WSL2 environment setup
โโโ tutorial/ # MkDocs source (Markdown, EN + ZH)
โโโ docs/ # Generated website (GitHub Pages)
License
Examples ยท API Docs ยท Website ยท ไธญๆๆๆกฃ
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
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file vultorch-0.5.0-cp312-cp312-win_amd64.whl.
File metadata
- Download URL: vultorch-0.5.0-cp312-cp312-win_amd64.whl
- Upload date:
- Size: 1.6 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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8348787afaaaa2d21699aaafd41873c8a1a7356339861f803d418e4861b06042
|
|
| MD5 |
d7ab3137de7292df0bfb8aae86168c3d
|
|
| BLAKE2b-256 |
ba680b1554ae61ddb5f6bfefb5a6f3fd19d5a7e062a8472f2caf9677c7eb1f6c
|
File details
Details for the file vultorch-0.5.0-cp311-cp311-win_amd64.whl.
File metadata
- Download URL: vultorch-0.5.0-cp311-cp311-win_amd64.whl
- Upload date:
- Size: 1.6 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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c0c8401bb7ca54072452e6d8bf8af1204c35d8e4f4df5118bc9b546803e830f7
|
|
| MD5 |
5c678586bc72d34ea0d91584d888cd56
|
|
| BLAKE2b-256 |
4ffbd608d13e31bd6dd1213a50cb3b3521995bbce5e5244617b12be6e449acd5
|
File details
Details for the file vultorch-0.5.0-cp310-cp310-win_amd64.whl.
File metadata
- Download URL: vultorch-0.5.0-cp310-cp310-win_amd64.whl
- Upload date:
- Size: 1.6 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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5fe0b893d243d09c09bbfb14c7391e8e618a16788b3b30ff91e13737c59cf2ee
|
|
| MD5 |
37358fc2cf625d35b1b32657332ec68c
|
|
| BLAKE2b-256 |
b2b45b19bc65045aa4ba1c375d7408eb66d21a8cfce835444b7297fbbf9aa12f
|
File details
Details for the file vultorch-0.5.0-cp39-cp39-win_amd64.whl.
File metadata
- Download URL: vultorch-0.5.0-cp39-cp39-win_amd64.whl
- Upload date:
- Size: 1.6 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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c539c1f15151c7c193cbaf2729da6e4447645386fe21559ea2a341280729dcc2
|
|
| MD5 |
b38f081599f72eb68cb8bf82ffbe8190
|
|
| BLAKE2b-256 |
c9b6adf7084c54712c558b21a4e5f97a48df69b93374055633a52645fc31f9b1
|
File details
Details for the file vultorch-0.5.0-cp38-cp38-win_amd64.whl.
File metadata
- Download URL: vultorch-0.5.0-cp38-cp38-win_amd64.whl
- Upload date:
- Size: 1.6 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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b6ad90a10ded7061a8884c476da4c0dcde6fc2dce826e21295dce12ac92ef312
|
|
| MD5 |
edc10fb47bbb311cd9d830143a539e43
|
|
| BLAKE2b-256 |
6ad199a1dd423f810505820e6d1344f7ee78e1cfb12fd571551c96ea4f469a58
|