Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
53 changes: 53 additions & 0 deletions .github/actions/build-anari-sdk/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: 'Build ANARI-SDK'
description: 'Build and cache ANARI-SDK dependency'
inputs:
config:
description: 'Build configuration (Release, Debug, etc.)'
required: true
install-prefix:
description: 'Installation prefix for ANARI-SDK'
required: true
build-deps-path:
description: 'Path to the build_deps directory containing CMakeLists.txt'
required: false
default: 'tsd/cmake/build_deps'
generator:
description: 'CMake generator to use'
required: false
default: ''
outputs:
cache-hit:
description: 'Whether the cache was hit'
value: ${{ steps.cache-anari.outputs.cache-hit }}
runs:
using: 'composite'
steps:
- name: Cache ANARI-SDK
uses: actions/cache@v4
id: cache-anari
with:
path: ${{ inputs.install-prefix }}
key: anari-sdk-${{ runner.os }}-${{ inputs.config }}-${{ inputs.generator || 'default' }}-${{ hashFiles('**/build_deps/CMakeLists.txt', '**/build_deps/superbuild_macros.cmake') }}

- name: Configure ANARI-SDK CMake (with generator)
if: steps.cache-anari.outputs.cache-hit != 'true' && inputs.generator != ''
shell: bash
run: |
cmake -LA -G "${{ inputs.generator }}" -B "${{ github.workspace }}/anari_deps_build" \
-DCMAKE_BUILD_TYPE=${{ inputs.config }} \
-DCMAKE_INSTALL_PREFIX="${{ inputs.install-prefix }}" \
"${{ github.workspace }}/${{ inputs.build-deps-path }}"

- name: Configure ANARI-SDK CMake (default generator)
if: steps.cache-anari.outputs.cache-hit != 'true' && inputs.generator == ''
shell: bash
run: |
cmake -LA -B "${{ github.workspace }}/anari_deps_build" \
-DCMAKE_BUILD_TYPE=${{ inputs.config }} \
-DCMAKE_INSTALL_PREFIX="${{ inputs.install-prefix }}" \
"${{ github.workspace }}/${{ inputs.build-deps-path }}"

- name: Build + install ANARI-SDK
if: steps.cache-anari.outputs.cache-hit != 'true'
shell: bash
run: cmake --build "${{ github.workspace }}/anari_deps_build" --config ${{ inputs.config }}
133 changes: 133 additions & 0 deletions .github/actions/setup-cuda/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
name: 'Setup CUDA Toolkit'
description: 'Install CUDA toolkit using redistributable archives with checksum verification and caching'
inputs:
cuda-version:
description: 'CUDA version to install (e.g., 12.4.1, 13.0.2)'
required: true
outputs:
cuda-path:
description: 'Path to CUDA installation'
value: ${{ steps.set-env.outputs.cuda-path }}
cache-hit:
description: 'Whether cache was hit'
value: ${{ steps.cache-cuda.outputs.cache-hit }}
runs:
using: 'composite'
steps:
# Parse version components
- name: Parse CUDA version
id: parse-version
shell: bash
run: |
CUDA_VERSION="${{ inputs.cuda-version }}"
CUDA_MAJOR=$(echo $CUDA_VERSION | cut -d. -f1)
CUDA_MINOR=$(echo $CUDA_VERSION | cut -d. -f2)
CUDA_PATCH=$(echo $CUDA_VERSION | cut -d. -f3)
echo "major=$CUDA_MAJOR" >> $GITHUB_OUTPUT
echo "minor=$CUDA_MINOR" >> $GITHUB_OUTPUT
echo "patch=$CUDA_PATCH" >> $GITHUB_OUTPUT
echo "major-minor=${CUDA_MAJOR}.${CUDA_MINOR}" >> $GITHUB_OUTPUT

# Cache the CUDA installation
# Install directly to cache directory - no sudo needed
- name: Cache CUDA installation (Linux)
if: runner.os == 'Linux'
uses: actions/cache@v4
id: cache-cuda-linux
with:
path: ~/cuda-${{ steps.parse-version.outputs.major-minor }}
key: cuda-Linux-${{ inputs.cuda-version }}-redist-v4
Copy link

Copilot AI Feb 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The cache key version suffix 'v4' for Linux differs from 'v2' for Windows (line 47). This inconsistency could lead to confusion. Consider synchronizing version numbers or documenting why they differ.

Copilot uses AI. Check for mistakes.

- name: Cache CUDA installation (Windows)
if: runner.os == 'Windows'
uses: actions/cache@v4
id: cache-cuda-windows
with:
path: C:\cuda-${{ steps.parse-version.outputs.major-minor }}
key: cuda-Windows-${{ inputs.cuda-version }}-redist-v2

# Set cache-hit output for use in conditions
- name: Set cache status
id: cache-cuda
shell: bash
run: |
if [ "${{ runner.os }}" == "Linux" ]; then
echo "cache-hit=${{ steps.cache-cuda-linux.outputs.cache-hit }}" >> $GITHUB_OUTPUT
else
echo "cache-hit=${{ steps.cache-cuda-windows.outputs.cache-hit }}" >> $GITHUB_OUTPUT
fi

# Linux installation via redistributables (cache miss)
- name: Install CUDA (Linux)
if: runner.os == 'Linux' && steps.cache-cuda-linux.outputs.cache-hit != 'true'
shell: bash
run: |
CUDA_VERSION="${{ inputs.cuda-version }}"
CUDA_MAJOR_MINOR="${{ steps.parse-version.outputs.major-minor }}"
INSTALL_DIR="$HOME/cuda-${CUDA_MAJOR_MINOR}"
ACTION_DIR="${{ github.action_path }}"

echo "Installing CUDA $CUDA_VERSION using redistributables"

# Make install script executable and run it
chmod +x "$ACTION_DIR/scripts/install-cuda.sh"
"$ACTION_DIR/scripts/install-cuda.sh" \
-v "$CUDA_VERSION" \
-p "$INSTALL_DIR" \
-c "$ACTION_DIR/components.json"

# Windows installation via redistributables (cache miss)
- name: Install CUDA (Windows)
if: runner.os == 'Windows' && steps.cache-cuda-windows.outputs.cache-hit != 'true'
shell: pwsh
run: |
$cudaVersion = "${{ inputs.cuda-version }}"
$cudaMajorMinor = "${{ steps.parse-version.outputs.major-minor }}"
$installPath = "C:\cuda-$cudaMajorMinor"
$actionDir = "${{ github.action_path }}"

Write-Host "Installing CUDA $cudaVersion using redistributables"

& "$actionDir\scripts\install-cuda.ps1" `
-CudaVersion $cudaVersion `
-InstallPath $installPath `
-ComponentsFile "$actionDir\components.json"

# Set environment variables
- name: Set CUDA environment
id: set-env
shell: bash
run: |
CUDA_MAJOR_MINOR="${{ steps.parse-version.outputs.major-minor }}"

if [ "${{ runner.os }}" == "Linux" ]; then
CUDA_PATH="$HOME/cuda-${CUDA_MAJOR_MINOR}"
echo "CUDA_PATH=${CUDA_PATH}" >> $GITHUB_ENV
echo "${CUDA_PATH}/bin" >> $GITHUB_PATH
echo "LD_LIBRARY_PATH=${CUDA_PATH}/lib64:${LD_LIBRARY_PATH:-}" >> $GITHUB_ENV
else
CUDA_PATH="C:\\cuda-${CUDA_MAJOR_MINOR}"
echo "CUDA_PATH=${CUDA_PATH}" >> $GITHUB_ENV
echo "${CUDA_PATH}\\bin" >> $GITHUB_PATH
# Required for CMake to find CUDA on Windows with Visual Studio
echo "CUDA_TOOLKIT_ROOT_DIR=${CUDA_PATH}" >> $GITHUB_ENV
echo "CudaToolkitDir=${CUDA_PATH}" >> $GITHUB_ENV
# CUDACXX tells CMake which CUDA compiler to use, bypassing VS toolset detection
echo "CUDACXX=${CUDA_PATH}\\bin\\nvcc.exe" >> $GITHUB_ENV
fi

echo "cuda-path=${CUDA_PATH}" >> $GITHUB_OUTPUT
echo "CUDA environment configured: ${CUDA_PATH}"

# Verify installation
- name: Verify CUDA installation
shell: bash
run: |
echo "Verifying CUDA installation..."
if command -v nvcc &> /dev/null; then
nvcc --version
else
echo "Warning: nvcc not found in PATH, but installation may still be valid"
echo "CUDA_PATH: $CUDA_PATH"
ls -la "$CUDA_PATH/bin" 2>/dev/null || dir "$CUDA_PATH\\bin" 2>/dev/null || true
fi
73 changes: 73 additions & 0 deletions .github/actions/setup-cuda/components.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
{
"components": {
"cuda_nvcc": {
"required": true,
"description": "NVIDIA CUDA Compiler",
"platforms": [
"linux-x86_64",
"windows-x86_64"
]
},
"cuda_cudart": {
"required": true,
"description": "CUDA Runtime",
"platforms": [
"linux-x86_64",
"windows-x86_64"
]
},
"cuda_crt": {
"required": false,
"description": "C Runtime headers - only in CUDA 13+, bundled in cuda_cudart for 12.x",
"platforms": [
"linux-x86_64",
"windows-x86_64"
],
"min_version": "13.0.0"
},
"libnvvm": {
"required": false,
"description": "NVVM library (cicc compiler) - only in CUDA 13+, bundled in cuda_nvcc for 12.x",
"platforms": [
"linux-x86_64",
"windows-x86_64"
],
"min_version": "13.0.0"
},
"cuda_cccl": {
"required": true,
"description": "CUDA C++ Core Libraries (Thrust/CUB/libcudacxx)",
"platforms": [
"linux-x86_64",
"windows-x86_64"
]
},
"cuda_nvml_dev": {
"required": true,
"description": "NVML development headers",
"platforms": [
"linux-x86_64",
"windows-x86_64"
]
},
"libcurand": {
"required": true,
"description": "Random number generation library",
"platforms": [
"linux-x86_64",
"windows-x86_64"
]
},
"visual_studio_integration": {
"required": true,
"description": "Visual Studio build integration (MSBuild rules)",
"platforms": [
"windows-x86_64"
]
}
},
"supported_versions": [
"12.4.1",
"13.0.2"
]
}
Loading