name: Rust
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
env:
CARGO_TERM_COLOR: always
jobs:
cuda-production:
strategy:
fail-fast: false
matrix:
architecture: [cuda-sm80, cuda-sm90]
runs-on: [self-hosted, linux, x64, "${{ matrix.architecture }}"]
env:
MESH_SIEVE_RUN_CUDA_TESTS: "1"
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- name: Record CUDA runtime
run: nvidia-smi
- name: Compile every CUDA feature combination
run: |
cargo check --all-targets --features cuda
cargo check --all-targets --features cuda-cublas
cargo check --all-targets --features cuda-cusparse
cargo check --all-targets --features cuda-cusolver
cargo check --all-targets --features cuda-nccl
- name: Execute required CUDA differential tests
run: cargo test --features cuda,cuda-cusparse --test cuda_fvm --test cuda_strict_mode
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
max-parallel: 2
matrix:
features:
- ""
- "rayon"
steps:
- uses: actions/checkout@v4
- name: Cache cargo
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
~/.cargo/bin
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock', '**/Cargo.toml') }}
restore-keys: |
${{ runner.os }}-cargo-
- name: Setup Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- name: Build library
run: cargo build --lib --verbose --features "${{ matrix.features }}"
- name: Build examples
run: cargo build --examples --verbose --features "${{ matrix.features }}"
- name: Run library tests
run: cargo test --lib --verbose --features "${{ matrix.features }}"
- name: Run example tests (non-MPI)
run: |
# Run non-MPI examples
cargo run --features "${{ matrix.features }}" --example partition || true
# Run example tests if they exist
cargo test --examples --verbose --features "${{ matrix.features }}" || true
docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- name: Build docs
run: cargo doc --no-deps
check-invariants:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- name: Build with invariant checks
run: cargo build --release --verbose --features "check-invariants"
- name: Run tests with invariant checks
run: cargo test --release --verbose --features "check-invariants"
test-release-strict:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- name: Build (release + strict invariants)
run: cargo build --workspace --release --features strict-invariants
- name: Test (release + strict invariants)
run: cargo test --workspace --release --features strict-invariants
benchmarks:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install MPI
run: |
sudo apt-get update
sudo apt-get install -y mpich libmpich-dev
- name: Setup Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- name: Build benchmarks
run: cargo build --benches --verbose --features "mpi-support,rayon"
- name: Run integration tests
run: cargo test --tests --verbose --features "mpi-support,rayon"
mpi-tests:
runs-on: ubuntu-latest
needs: build
timeout-minutes: 45
strategy:
fail-fast: false
matrix:
features:
- "mpi-support"
- "rayon,mpi-support"
steps:
- uses: actions/checkout@v4
- name: Cache cargo
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
~/.cargo/bin
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock', '**/Cargo.toml') }}
restore-keys: |
${{ runner.os }}-cargo-
- name: Install MPI
run: |
sudo apt-get update
sudo apt-get install -y mpich libmpich-dev
mpirun --version
- name: Setup Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- name: Install cargo-mpirun
run: |
# Install the cargo subcommand to run MPI examples via `cargo mpirun`
if [ -x "$HOME/.cargo/bin/cargo-mpirun" ]; then
echo "cargo-mpirun already installed at $HOME/.cargo/bin/cargo-mpirun"
$HOME/.cargo/bin/cargo-mpirun --version || true
else
cargo install --locked cargo-mpirun
fi
- name: Build library (MPI)
run: cargo build --lib --verbose --features "${{ matrix.features }}"
- name: Run selected MPI examples
run: |
echo "Running MPI examples with features: ${{ matrix.features }}"
# Keep MPI runs small and deterministic (2 ranks where possible).
cargo mpirun -n 2 --features "${{ matrix.features }}" --example mpi_complete
cargo mpirun -n 2 --features "${{ matrix.features }}" --example mpi_complete_stack || true
cargo mpirun -n 2 --features "${{ matrix.features }}" --example mesh_distribute_two_ranks || true
echo "MPI examples finished for features: ${{ matrix.features }}"