Skip to content

Commit 79eed48

Browse files
gnurizenclaude
andcommitted
Rewrite parcagpu to use Proton's CUPTI infrastructure
Major changes: - Use Proton as a git submodule for CUPTI callback handling - Rewrite in C++ using Proton's CuptiApi and callback patterns - Add PC sampling support for continuous GPU profiling - Simplify build to single library (works with any CUDA version at runtime) - Use CMake build system - Consolidate GitHub workflows into single build.yml - Update Dockerfile to Ubuntu 24.04 (fixes USDT probe generation) The library now uses Proton's dynamic CUPTI loading, so a single build works with CUDA 12.x and 13.x at runtime. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent a86187f commit 79eed48

23 files changed

+1456
-919
lines changed

.dockerignore

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Git metadata (especially important for proton submodule)
2+
.git/
3+
.gitmodules
4+
.github/
5+
6+
# Build artifacts (in case they exist in directories we copy)
7+
build/
8+
build-*/
9+
*.o
10+
*.so
11+
*.so.*
12+
13+
# CMake artifacts
14+
CMakeCache.txt
15+
CMakeFiles/
16+
cmake_install.cmake
17+
compile_commands.json

.github/workflows/build.yml

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
name: Build
2+
3+
on:
4+
push:
5+
branches: [main, proton]
6+
tags: ['v*']
7+
pull_request:
8+
branches: [main, proton]
9+
10+
env:
11+
REGISTRY: ghcr.io
12+
IMAGE_NAME: ${{ github.repository }}
13+
CUDA_HEADERS: ghcr.io/parca-dev/cuda-headers:12
14+
15+
jobs:
16+
build:
17+
runs-on: ubuntu-latest
18+
permissions:
19+
contents: read
20+
packages: write
21+
22+
steps:
23+
- name: Checkout repository
24+
uses: actions/checkout@v4
25+
with:
26+
submodules: recursive
27+
28+
- name: Set up Docker Buildx
29+
uses: docker/setup-buildx-action@v3
30+
31+
- name: Build library (amd64)
32+
run: |
33+
mkdir -p build/amd64
34+
docker buildx build -f Dockerfile \
35+
--build-arg CUDA_HEADERS=${{ env.CUDA_HEADERS }} \
36+
--target export \
37+
--output type=local,dest=build/amd64 \
38+
--platform linux/amd64 \
39+
.
40+
41+
- name: Verify build artifacts
42+
run: |
43+
echo "=== Build artifacts ==="
44+
ls -lh build/amd64/
45+
file build/amd64/libparcagpucupti.so
46+
readelf -n build/amd64/libparcagpucupti.so | grep -A2 "stapsdt" | head -20
47+
48+
- name: Log in to Container Registry
49+
if: github.event_name != 'pull_request'
50+
uses: docker/login-action@v3
51+
with:
52+
registry: ${{ env.REGISTRY }}
53+
username: ${{ github.actor }}
54+
password: ${{ secrets.GITHUB_TOKEN }}
55+
56+
- name: Extract metadata (tags, labels)
57+
id: meta
58+
uses: docker/metadata-action@v5
59+
with:
60+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
61+
tags: |
62+
type=semver,pattern={{version}}
63+
type=semver,pattern={{major}}.{{minor}}
64+
type=raw,value={{date 'YYYYMMDD'}}-{{sha}},enable={{is_default_branch}}
65+
type=raw,value=latest,enable={{is_default_branch}}
66+
67+
- name: Build and push multi-arch image
68+
if: github.event_name != 'pull_request'
69+
uses: docker/build-push-action@v5
70+
with:
71+
context: .
72+
file: ./Dockerfile
73+
build-args: |
74+
CUDA_HEADERS=${{ env.CUDA_HEADERS }}
75+
platforms: linux/amd64,linux/arm64
76+
target: runtime
77+
push: true
78+
tags: ${{ steps.meta.outputs.tags }}
79+
labels: ${{ steps.meta.outputs.labels }}
80+
cache-from: type=gha
81+
cache-to: type=gha,mode=max
82+
83+
release-binaries:
84+
if: startsWith(github.ref, 'refs/tags/v')
85+
needs: build
86+
runs-on: ubuntu-latest
87+
permissions:
88+
contents: write
89+
90+
strategy:
91+
matrix:
92+
arch: [amd64, arm64]
93+
94+
steps:
95+
- name: Checkout repository
96+
uses: actions/checkout@v4
97+
with:
98+
submodules: recursive
99+
100+
- name: Set up Docker Buildx
101+
uses: docker/setup-buildx-action@v3
102+
103+
- name: Build and extract binary for ${{ matrix.arch }}
104+
run: |
105+
mkdir -p build/${{ matrix.arch }}
106+
docker buildx build -f Dockerfile \
107+
--build-arg CUDA_HEADERS=${{ env.CUDA_HEADERS }} \
108+
--target export \
109+
--output type=local,dest=build/${{ matrix.arch }} \
110+
--platform linux/${{ matrix.arch }} \
111+
.
112+
mv build/${{ matrix.arch }}/libparcagpucupti.so \
113+
build/${{ matrix.arch }}/libparcagpucupti-${{ matrix.arch }}.so
114+
115+
- name: Upload to GitHub Release
116+
uses: softprops/action-gh-release@v1
117+
with:
118+
files: build/${{ matrix.arch }}/libparcagpucupti-${{ matrix.arch }}.so

.github/workflows/container.yml

Lines changed: 0 additions & 135 deletions
This file was deleted.

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "proton"]
2+
path = proton
3+
url = https://github.com/parca-dev/proton.git

0 commit comments

Comments
 (0)