Skip to content

Go back to small buffer but let allocator worry about caching #17

Go back to small buffer but let allocator worry about caching

Go back to small buffer but let allocator worry about caching #17

Workflow file for this run

name: Container Image Build
on:
push:
branches:
- main
tags:
- 'v*'
pull_request:
branches:
- main
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
CUDA_HEADERS_REGISTRY: ghcr.io/parca-dev/cuda-headers
jobs:
build-and-push:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to Container Registry
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels)
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
# For releases: use semantic version tags
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
# For main branch: use date and commit SHA
type=raw,value={{date 'YYYYMMDD'}}-{{sha}},enable={{is_default_branch}}
# Tag as latest for main branch
type=raw,value=latest,enable={{is_default_branch}}
- name: Build and push multi-arch image with both CUDA versions
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
build-args: |
CUDA_12_HEADERS=${{ env.CUDA_HEADERS_REGISTRY }}:12
CUDA_13_HEADERS=${{ env.CUDA_HEADERS_REGISTRY }}:13
platforms: linux/amd64,linux/arm64
target: runtime
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
extract-release-binaries:
# Only run this job for tagged releases
if: startsWith(github.ref, 'refs/tags/v')
needs: build-and-push
runs-on: ubuntu-latest
permissions:
contents: write
strategy:
matrix:
include:
- cuda_major: "12"
cuda_full: "12.9.1"
arch: amd64
platform: linux/amd64
- cuda_major: "12"
cuda_full: "12.9.1"
arch: arm64
platform: linux/arm64
- cuda_major: "13"
cuda_full: "13.0.2"
arch: amd64
platform: linux/amd64
- cuda_major: "13"
cuda_full: "13.0.2"
arch: arm64
platform: linux/arm64
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and extract binary for ${{ matrix.arch }} (CUDA ${{ matrix.cuda_major }})
env:
LIB_NAME: libparcagpucupti.so.${{ matrix.cuda_major }}
run: |
mkdir -p build/${{ matrix.arch }}
docker buildx build -f Dockerfile \
--build-arg CUDA_12_HEADERS=${{ env.CUDA_HEADERS_REGISTRY }}:12 \
--build-arg CUDA_13_HEADERS=${{ env.CUDA_HEADERS_REGISTRY }}:13 \
--target export-cuda${{ matrix.cuda_major }} \
--output type=local,dest=build/${{ matrix.arch }} \
--platform ${{ matrix.platform }} \
.
- name: Rename binary with arch and CUDA version suffix
env:
LIB_NAME: libparcagpucupti.so.${{ matrix.cuda_major }}
OUTPUT_NAME: libparcagpucupti.so.${{ matrix.cuda_major }}-${{ matrix.arch }}
run: |
mv build/${{ matrix.arch }}/${LIB_NAME} \
build/${{ matrix.arch }}/${OUTPUT_NAME}
- name: Upload binary as artifact
uses: actions/upload-artifact@v4
with:
name: libparcagpucupti.so.${{ matrix.cuda_major }}-${{ matrix.arch }}
path: build/${{ matrix.arch }}/libparcagpucupti.so.${{ matrix.cuda_major }}-${{ matrix.arch }}
- name: Upload to GitHub Release
uses: softprops/action-gh-release@v1
with:
files: build/${{ matrix.arch }}/libparcagpucupti.so.${{ matrix.cuda_major }}-${{ matrix.arch }}