Skip to content

Samples: Ported the MatrixMul example of CUDA samples #597

Samples: Ported the MatrixMul example of CUDA samples

Samples: Ported the MatrixMul example of CUDA samples #597

Workflow file for this run

name: CI on Linux
on:
pull_request:
paths-ignore:
- "**.md"
push:
branches:
- main
paths-ignore:
- "**.md"
env:
RUST_LOG: info
RUST_BACKTRACE: 1
jobs:
build:
name: Build / ${{ matrix.variance.name }}
runs-on: ${{ matrix.variance.runner }}
strategy:
fail-fast: false
matrix:
variance:
- name: Ubuntu-24.04 / CUDA-12.8.1 / x86_64
image: "ghcr.io/rust-gpu/rust-cuda-ubuntu24-cuda12:latest"
runner: ubuntu-latest
- 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: 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: Pull build image
run: docker pull ${{ matrix.variance.image }}
- name: Record host UID/GID
run: |
echo "HOST_UID=$(id -u)" >> $GITHUB_ENV
echo "HOST_GID=$(id -g)" >> $GITHUB_ENV
- 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: |
docker exec "$CONTAINER_NAME" bash -lc 'set -euo pipefail
cargo fmt --all -- --check
'
- name: Build all bindings
run: |
docker exec "$CONTAINER_NAME" bash -lc 'set -euo pipefail
cargo build --all-features -p cust_raw
'
- name: Build workspace
run: |
docker exec "$CONTAINER_NAME" bash -lc 'set -euo pipefail
cargo build
'
- name: Clippy
run: |
docker exec "$CONTAINER_NAME" bash -lc 'set -euo pipefail
export RUSTFLAGS=-Dwarnings
cargo clippy
'
# Exclude crates with tests that require an NVIDIA GPU: blastoff, cudnn, cust.
- name: Test
run: |
docker exec "$CONTAINER_NAME" bash -lc 'set -euo pipefail
export RUSTFLAGS=-Dwarnings
cargo test --workspace \
--exclude blastoff \
--exclude cudnn \
--exclude cust
'
- name: Check documentation
run: |
docker exec "$CONTAINER_NAME" bash -lc 'set -euo pipefail
export RUSTDOCFLAGS=-Dwarnings
cargo doc --workspace --all-features --document-private-items --no-deps
'
- name: Stop build container
run: |
docker rm -f "$CONTAINER_NAME" || true
compiletest:
name: Compile tests
runs-on: ubuntu-latest
container:
image: "ghcr.io/rust-gpu/rust-cuda-ubuntu24-cuda12:latest"
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Run cargo version
run: cargo --version
- name: Rustfmt compiletests
shell: bash
# Uses rustfmt directly, rather than via `cargo fmt`, because the compiletests .rs files
# are not within a package.
run: shopt -s globstar && rustfmt --check tests/compiletests/ui/**/*.rs
- name: Compiletest
run: cargo run -p compiletests --release --no-default-features -- --target-arch compute_61,compute_75,compute_90