Skip to content
Merged
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
153 changes: 125 additions & 28 deletions .github/workflows/ci_linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ jobs:
build:
name: Build / ${{ matrix.variance.name }}
runs-on: ${{ matrix.variance.runner }}
container:
image: ${{ matrix.variance.image }}
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -56,6 +54,47 @@ jobs:
artifact_path: ${{ steps.artifact_details.outputs.path }}

steps:
- name: Free up space
# Without this the job will likely run out of disk space.
run: |
df -h

# Remove Java
sudo rm -rf /usr/lib/jvm

# Remove .NET
sudo rm -rf /usr/share/dotnet

# Remove Swift
sudo rm -rf /usr/share/swift

# Remove Haskell
sudo rm -rf /usr/local/.ghcup

# Remove Julia
sudo rm -rf /usr/local/julia*

# Remove Android SDKs
sudo rm -rf /usr/local/lib/android

# Remove Chromium
sudo rm -rf /usr/local/share/chromium

# Remove Microsoft/Edge and Google Chrome builds
sudo rm -rf /opt/microsoft /opt/google

# Remove Azure CLI
sudo rm -rf /opt/az

# Remove PowerShell
sudo rm -rf /usr/local/share/powershell

# Remove CodeQL and other toolcaches
sudo rm -rf /opt/hostedtoolcache

docker system prune -af || true
docker builder prune -af || true
df -h
- name: Checkout repository
uses: actions/checkout@v4

Expand All @@ -68,39 +107,91 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Verify CUDA, Rust installation
- name: Pull build image
run: docker pull ${{ matrix.variance.image }}

- name: Record host UID/GID
run: |
nvcc --version
rustup show
echo "HOST_UID=$(id -u)" >> $GITHUB_ENV
echo "HOST_GID=$(id -g)" >> $GITHUB_ENV

- name: Load Rust cache
uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.variance.name }}-${{ github.sha }}
- name: Set container name
run: echo "CONTAINER_NAME=ci-build-${{ github.run_id }}-${{ github.run_attempt }}-${{ matrix.variance.runner }}" >> $GITHUB_ENV

- name: Start build container
run: |
docker create --name "$CONTAINER_NAME" \
-v "$PWD":/workspace \
-w /workspace \
-e RUST_LOG \
-e RUST_BACKTRACE \
${{ matrix.variance.image }} \
sleep infinity
docker start "$CONTAINER_NAME"

- name: Verify CUDA, Rust installation
run: |
docker exec "$CONTAINER_NAME" bash -lc 'set -euo pipefail
nvcc --version
rustup show
'

- name: Rustfmt
run: cargo fmt --all -- --check
run: |
docker exec "$CONTAINER_NAME" bash -lc 'set -euo pipefail
cargo fmt --all -- --check
'

- name: Build all bindings
run: cargo build --all-features -p cust_raw
run: |
docker exec "$CONTAINER_NAME" bash -lc 'set -euo pipefail
cargo build --all-features -p cust_raw
'

- name: Build workspace
run: cargo build --workspace --exclude "optix*" --exclude "path-tracer" --exclude "denoiser" --exclude "ex0*" --exclude "cudnn*"
run: |
docker exec "$CONTAINER_NAME" bash -lc 'set -euo pipefail
cargo build --workspace \
--exclude "optix*" \
--exclude "path-tracer" \
--exclude "denoiser" \
--exclude "ex0*" \
--exclude "cudnn*"
'

- name: Clippy
env:
RUSTFLAGS: -Dwarnings
run: cargo clippy --workspace --exclude "optix*" --exclude "path-tracer" --exclude "denoiser" --exclude "ex0*" --exclude "cudnn*"

# Don't currently test because many tests rely on the system having a CUDA GPU
# - name: Test
# run: cargo test --workspace
run: |
docker exec "$CONTAINER_NAME" bash -lc 'set -euo pipefail
export RUSTFLAGS=-Dwarnings
cargo clippy --workspace \
--exclude "optix*" \
--exclude "path-tracer" \
--exclude "denoiser" \
--exclude "ex0*" \
--exclude "cudnn*"
'

- name: Check documentation
env:
RUSTDOCFLAGS: -Dwarnings
run: cargo doc --workspace --all-features --document-private-items --no-deps --exclude "optix*" --exclude "path-tracer" --exclude "denoiser" --exclude "ex0*" --exclude "cudnn*" --exclude "cust_raw"
run: |
docker exec "$CONTAINER_NAME" bash -lc 'set -euo pipefail
export RUSTDOCFLAGS=-Dwarnings
cargo doc --workspace --all-features --document-private-items --no-deps \
--exclude "optix*" \
--exclude "path-tracer" \
--exclude "denoiser" \
--exclude "ex0*" \
--exclude "cudnn*" \
--exclude "cust_raw"
'

- name: Normalize build artifacts ownership
run: |
docker exec "$CONTAINER_NAME" bash -lc "rm -rf /workspace/target/debug/incremental || true"
docker exec "$CONTAINER_NAME" bash -lc "chown -R ${HOST_UID}:${HOST_GID} /workspace/target || true"

- name: Stop build container
run: |
docker rm -f "$CONTAINER_NAME" || true
- name: Prepare artifact details
id: artifact_details
run: |
Expand Down Expand Up @@ -159,18 +250,24 @@ jobs:
- name: Ubuntu-24.04 / CUDA-12.8.1 / ARM64
image: "ghcr.io/rust-gpu/rust-cuda-ubuntu24-cuda12:latest"
runner: ubuntu-24.04-arm
- name: RockyLinux-9 / CUDA-12.8.1 / x86_64
image: "ghcr.io/rust-gpu/rust-cuda-rockylinux9-cuda12:latest"
runner: ubuntu-latest
steps:
- name: Compute artifact name
id: test_artifact
run: |
SANITIZED_NAME=$(echo '${{ matrix.variance.name }}' | sed 's/[^a-zA-Z0-9.-]/-/g')
ARTIFACT_NAME="target_debug-${SANITIZED_NAME}-${{ github.run_id }}"
ARTIFACT_PATH="target/debug"
echo "name=${ARTIFACT_NAME}" >> $GITHUB_OUTPUT
echo "path=${ARTIFACT_PATH}" >> $GITHUB_OUTPUT

- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: ${{ needs.build.outputs.artifact_name }}
path: ${{ needs.build.outputs.artifact_path }}
name: ${{ steps.test_artifact.outputs.name }}
path: ${{ steps.test_artifact.outputs.path }}

- name: List downloaded files
run: ls -lR ${{ needs.build.outputs.artifact_path }}
run: ls -lR ${{ steps.test_artifact.outputs.path }}

- name: Run remote tests
env:
Expand Down
41 changes: 41 additions & 0 deletions .github/workflows/container_images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,47 @@ jobs:
image: "rust-gpu/rust-cuda-rockylinux9-cuda12"
dockerfile: ./container/rockylinux9-cuda12/Dockerfile
steps:
- name: Free up space
# Without this the job will likely run out of disk space.
run: |
df -h

# Remove Java
sudo rm -rf /usr/lib/jvm

# Remove .NET
sudo rm -rf /usr/share/dotnet

# Remove Swift
sudo rm -rf /usr/share/swift

# Remove Haskell
sudo rm -rf /usr/local/.ghcup

# Remove Julia
sudo rm -rf /usr/local/julia*

# Remove Android SDKs
sudo rm -rf /usr/local/lib/android

# Remove Chromium
sudo rm -rf /usr/local/share/chromium

# Remove Microsoft/Edge and Google Chrome builds
sudo rm -rf /opt/microsoft /opt/google

# Remove Azure CLI
sudo rm -rf /opt/az

# Remove PowerShell
sudo rm -rf /usr/local/share/powershell

# Remove CodeQL and other toolcaches
sudo rm -rf /opt/hostedtoolcache

docker system prune -af || true
docker builder prune -af || true
df -h
- name: Checkout repository
uses: actions/checkout@v4
- name: Validate platform
Expand Down
62 changes: 32 additions & 30 deletions container/rockylinux9-cuda12/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,41 +1,26 @@
FROM nvcr.io/nvidia/cuda:12.8.1-cudnn-devel-rockylinux9
FROM nvcr.io/nvidia/cuda:12.8.1-cudnn-devel-rockylinux9 AS llvm-builder

RUN dnf -y update && \
dnf -y install \
clang \
RUN dnf -y install \
--nobest \
--allowerasing \
--setopt=install_weak_deps=False \
openssl-devel \
pkgconfig \
redhat-rpm-config \
which \
xz \
zlib-devel && \
dnf clean all

# Needed to build `path_tracer`, `optix/ex03_window` example
RUN dnf -y install \
cmake \
fontconfig-devel \
libX11-devel \
libXcursor-devel \
libXi-devel \
libXrandr-devel && \
dnf clean all

# Get LLVM 7
WORKDIR /data/llvm7

# Install dependencies for building LLVM
RUN dnf -y install epel-release && \
dnf -y install \
zlib-devel \
libffi-devel \
ncurses-devel \
libxml2-devel \
libedit-devel \
python3 \
make && \
make \
cmake && \
dnf clean all

# Download and build LLVM 7.1.0 for all architectures
WORKDIR /data/llvm7

# Download and build LLVM 7.1.0 for all architectures.
RUN curl -sSf -L -O https://github.com/llvm/llvm-project/releases/download/llvmorg-7.1.0/llvm-7.1.0.src.tar.xz && \
tar -xf llvm-7.1.0.src.tar.xz && \
cd llvm-7.1.0.src && \
Expand All @@ -58,17 +43,34 @@ RUN curl -sSf -L -O https://github.com/llvm/llvm-project/releases/download/llvmo
-DLLVM_INCLUDE_BENCHMARKS=OFF \
-DLLVM_ENABLE_ZLIB=ON \
-DLLVM_ENABLE_TERMINFO=ON \
-DCMAKE_INSTALL_PREFIX=/usr \
-DCMAKE_INSTALL_PREFIX=/opt/llvm-7 \
.. && \
make -j$(nproc) && \
make install && \
cd ../.. && \
rm -rf llvm-7.1.0.src* && \
ln -s /usr/bin/llvm-config /usr/bin/llvm-config-7 && \
dnf clean all

# Get Rust
RUN curl -sSf -L https://sh.rustup.rs | bash -s -- -y
FROM nvcr.io/nvidia/cuda:12.8.1-cudnn-devel-rockylinux9

RUN dnf -y install \
--nobest \
--allowerasing \
--setopt=install_weak_deps=False \
openssl-devel \
pkgconfig \
which \
xz \
zlib-devel \
cmake && \
dnf clean all

COPY --from=llvm-builder /opt/llvm-7 /opt/llvm-7
RUN ln -s /opt/llvm-7/bin/llvm-config /usr/bin/llvm-config && \
ln -s /opt/llvm-7/bin/llvm-config /usr/bin/llvm-config-7

# Get Rust (install rustup; toolchain installed from rust-toolchain.toml below)
RUN curl -sSf -L https://sh.rustup.rs | bash -s -- -y --profile minimal --default-toolchain none
ENV PATH="/root/.cargo/bin:${PATH}"

# Setup the workspace
Expand Down
Loading
Loading