Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
dd8de4a
Add Vulkan GPU context probe (Issue GPU-01 #9) behind CTHREADS_GPU.
T-Karu-smaecs Sep 5, 2026
7e677a8
Merge pull request #19 from K-T0BIAS/9-gpu-01-vulkan-context-in-_ext
K-T0BIAS Sep 5, 2026
1791a34
add simple vk guide
T-Karu-smaecs Sep 6, 2026
2c6cac7
add vulkan api reference
T-Karu-smaecs Sep 6, 2026
2f64a67
Add GPU memory TransferEngine and GpuPack marshal substrate (#20).
T-Karu-smaecs Sep 6, 2026
8ae0ec4
Merge pull request #21 from K-T0BIAS/20-gou-02-memory-gpupack-marshal…
K-T0BIAS Sep 6, 2026
3f7c91c
Add GPU launch path and SpawnedGpuKernel join (#22).
T-Karu-smaecs Sep 12, 2026
db2c21f
Merge pull request #23 from K-T0BIAS/22-gpu-03-launch-path-and-gpujob
K-T0BIAS Sep 12, 2026
4879743
Add Context LaunchEngine for GPU dispatch CB/fence checkout.
T-Karu-smaecs Sep 12, 2026
8abfc53
Ship @Gpu public path: glslang emit, gpu()/prepare, and SPH demo.
T-Karu-smaecs Sep 13, 2026
0ec8c60
skip gpu tests on gh actions
T-Karu-smaecs Sep 14, 2026
7629332
Add GpuArena residency and sort-grid GPU SPH.
T-Karu-smaecs Sep 15, 2026
4748d8f
Merge pull request #25 from K-T0BIAS/24-gpu-04-gpu-gpu-public-path-la…
K-T0BIAS Sep 16, 2026
8274d34
Add GPU workgroup barrier via __sync_threads and Barrier.arrive_and_w…
T-Karu-smaecs Sep 16, 2026
d3203ac
Merge pull request #27 from K-T0BIAS/26-gpu-workgroup-sync-threads
K-T0BIAS Sep 16, 2026
c439b8d
document the GPU features and prep the release/wheel build
T-Karu-smaecs Sep 18, 2026
7cb11c0
bump version of: humbletim/setup-vulkan-sdk@v1.2.1
T-Karu-smaecs Sep 18, 2026
42036a4
remove local gpu testing scripts from cmakelists
T-Karu-smaecs Sep 18, 2026
67d6605
fix glsl include for cicl
T-Karu-smaecs Sep 18, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions .clangd
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# clangd config for cthreads (Cursor / VS Code clangd).
# Paths are relative to this file (repo root), except Vulkan SDK.

CompileFlags:
Add:
- -std=c++17
# Match CMake CTHREADS_GPU=ON so #ifdef CTHREADS_WITH_GPU paths analyze correctly.
- -DCTHREADS_WITH_GPU=1
# Project includes (same as CMake target_include_directories for GPU builds).
- -Isrc/cthreads/cpp/headers
- -Isrc/cthreads/cpp/gpu/headers
# Vulkan headers from local SDK (VULKAN_SDK=C:\VulkanSDK\1.4.357.0).
# Update this -I if you install a newer SDK version.
- -IC:/VulkanSDK/1.4.357.0/Include

Diagnostics:
UnusedIncludes: None

Index:
Background: Build
55 changes: 55 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,58 @@ jobs:

- name: Pytest
run: python -m pytest tests/ -q

# Compile-smokes the Vulkan path (CTHREADS_GPU=ON). Live device tests still skip
# when no ICD is present; the goal is to catch header / glslang / link breakage.
test-gpu:
name: test-gpu (${{ matrix.os }}, py${{ matrix.python }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
python: ["3.12"]
steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}

- name: Install Vulkan headers (Ubuntu)
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y libvulkan-dev vulkan-tools

- name: Install Vulkan SDK (Windows)
if: runner.os == 'Windows'
uses: humbletim/setup-vulkan-sdk@v1.2.1
with:
vulkan-query-version: 1.3.296.0
vulkan-components: Vulkan-Headers, Vulkan-Loader
vulkan-use-cache: true

- name: Install CMake, Ninja, package (GPU ON, Linux)
if: runner.os == 'Linux'
run: |
python -m pip install -U pip
python -m pip install cmake ninja
export CMAKE_ARGS="-DCTHREADS_GPU=ON"
python -m pip install -e ".[test]"

- name: Install CMake, Ninja, package (GPU ON, Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
python -m pip install -U pip
python -m pip install cmake ninja
$env:CMAKE_ARGS = "-DCTHREADS_GPU=ON"
python -m pip install -e ".[test]"

- name: Assert GPU extension linked
run: |
python -c "from cthreads import _ext, gpu; assert hasattr(_ext, 'gpu'), 'CTHREADS_GPU build missing _ext.gpu'; print('available=', gpu.available())"

- name: Pytest (GPU build; device tests skip if no ICD)
run: python -m pytest tests/ -q
122 changes: 115 additions & 7 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ name: Release

# Production PyPI: only when you click Publish on a GitHub Release.
# Manual "Run workflow" always targets TestPyPI, never PyPI.
#
# Artifacts:
# - cthreads CPU wheels + sdist (CTHREADS_GPU=OFF)
# - cthreads-gpu GPU wheels (CTHREADS_GPU=ON)
# Users: pip install cthreads OR pip install 'cthreads[gpu]' (pulls cthreads-gpu)

on:
release:
Expand All @@ -28,6 +33,32 @@ jobs:
python -m pip install -e ".[test]"
python -m pytest tests/ -q

test-gpu:
name: test-gpu (ubuntu)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: "3.12"

- name: Install Vulkan headers
run: |
sudo apt-get update
sudo apt-get install -y libvulkan-dev

- name: Install and test (GPU ON)
run: |
python -m pip install -U pip cmake ninja
export CMAKE_ARGS="-DCTHREADS_GPU=ON"
python -m pip install -e ".[test]"
python - <<'PY'
from cthreads import _ext
assert hasattr(_ext, "gpu"), "CTHREADS_GPU build missing _ext.gpu"
PY
python -m pytest tests/ -q

check-version:
name: tag matches pyproject
if: github.event_name == 'release'
Expand All @@ -37,22 +68,34 @@ jobs:
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Compare release tag to project.version
- name: Compare release tag to project.version and [gpu] pin
env:
TAG: ${{ github.event.release.tag_name }}
run: |
python - <<'PY'
import os
import pathlib
import re
import sys
import tomllib

tag = os.environ["TAG"].removeprefix("v")
ver = tomllib.loads(pathlib.Path("pyproject.toml").read_text(encoding="utf-8"))["project"]["version"]
text = pathlib.Path("pyproject.toml").read_text(encoding="utf-8")
ver = tomllib.loads(text)["project"]["version"]
if tag != ver:
print(f"GitHub tag version {tag!r} != pyproject.toml version {ver!r}")
sys.exit(1)
print(f"version ok: {ver}")
m = re.search(r'gpu\s*=\s*\["cthreads-gpu==([^"]+)"\]', text)
if not m:
print("missing [project.optional-dependencies] gpu = [\"cthreads-gpu==...\"]")
sys.exit(1)
if m.group(1) != ver:
print(
f"optional gpu pin cthreads-gpu=={m.group(1)!r} "
f"!= project.version {ver!r}"
)
sys.exit(1)
print(f"version ok: {ver} (gpu extra pin matches)")
PY

build-sdist:
Expand All @@ -74,7 +117,7 @@ jobs:
path: dist/*.tar.gz

build-wheels:
name: wheels (${{ matrix.os }})
name: wheels-cpu (${{ matrix.os }})
needs: [test]
runs-on: ${{ matrix.os }}
strategy:
Expand All @@ -83,16 +126,70 @@ jobs:
os: [ubuntu-latest, windows-latest]
steps:
- uses: actions/checkout@v4
- name: Build wheels
- name: Build CPU wheels
uses: pypa/cibuildwheel@v4.2.0
- uses: actions/upload-artifact@v4
with:
name: cibw-wheels-${{ matrix.os }}
path: wheelhouse/*.whl

build-wheels-gpu:
name: wheels-gpu (${{ matrix.os }})
needs: [test-gpu]
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
steps:
- uses: actions/checkout@v4

- name: Install Vulkan headers (Ubuntu host; manylinux uses before-all)
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y libvulkan-dev

- name: Install Vulkan SDK (Windows)
if: runner.os == 'Windows'
uses: humbletim/setup-vulkan-sdk@v1.2.1
with:
vulkan-query-version: 1.3.296.0
vulkan-components: Vulkan-Headers, Vulkan-Loader
vulkan-use-cache: true

- name: Retarget project name to cthreads-gpu
run: python scripts/retarget_gpu_wheel.py

- name: Build GPU wheels
uses: pypa/cibuildwheel@v4.2.0
env:
# Headers only at build time; loader is resolved at runtime.
CIBW_ENVIRONMENT: CMAKE_ARGS=-DCTHREADS_GPU=ON
CIBW_BEFORE_ALL_LINUX: |
set -eux
if command -v dnf >/dev/null 2>&1; then
dnf install -y vulkan-headers vulkan-loader-devel git
else
yum install -y vulkan-headers vulkan-loader-devel git
fi
# glslang FetchContent makes this slower than CPU wheels.
CIBW_BUILD_VERBOSITY: 1

- uses: actions/upload-artifact@v4
with:
name: cibw-wheels-gpu-${{ matrix.os }}
path: wheelhouse/*.whl

publish-pypi:
name: publish to PyPI
needs: [test, check-version, build-sdist, build-wheels]
needs:
- test
- test-gpu
- check-version
- build-sdist
- build-wheels
- build-wheels-gpu
if: github.event_name == 'release' && github.event.action == 'published'
runs-on: ubuntu-latest
environment:
Expand All @@ -106,11 +203,20 @@ jobs:
pattern: cibw-*
path: dist
merge-multiple: true
- name: Show artifacts
run: ls -la dist
# Uploads both cthreads and cthreads-gpu wheels. Configure Trusted
# Publishing for BOTH PyPI projects (same workflow: release.yml).
- uses: pypa/gh-action-pypi-publish@release/v1

publish-testpypi:
name: publish to TestPyPI
needs: [test, build-sdist, build-wheels]
needs:
- test
- test-gpu
- build-sdist
- build-wheels
- build-wheels-gpu
if: github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
environment:
Expand All @@ -124,6 +230,8 @@ jobs:
pattern: cibw-*
path: dist
merge-multiple: true
- name: Show artifacts
run: ls -la dist
- uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ dist/
*.dylib
.cthreads_cache.json
.pytest_cache/
.vscode/

# CMake / MSVC litter - must never land in the source tree
src/cthreads/cpp/CMakeCache.txt
Expand Down Expand Up @@ -51,6 +52,7 @@ api/
# >>> cthreads (auto)
__Thread__/
__Threadable__/
__Gpu__/
.cthreads_cache.json
cthreads_kernels.dll
cthreads_kernels.so
Expand All @@ -59,4 +61,6 @@ libcthreads_kernels.so
libcthreads_kernels.dylib
# <<< cthreads (auto)

todo.md
todo.md
# demo artifacts
*.gif
Loading
Loading