Skip to content

Commit

Permalink
Merge branch 'main' into explicit-credentials-for-s3-configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
sylvestre authored Jan 21, 2025
2 parents 987eb66 + e8b9af4 commit 4da5534
Show file tree
Hide file tree
Showing 62 changed files with 6,066 additions and 1,183 deletions.
7 changes: 3 additions & 4 deletions .github/actions/artifact_failure/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ runs:
lsof +D `pwd` || true
killall sccache || true
killall sccache-dist || true
# possible temp dirs for either linux or windows
cp "${TMP:-${TEMP:-${TMPDIR:-/tmp}}}"/sccache_*.txt . 2>/dev/null || true
tar --exclude='target' \
--exclude='docs' \
--exclude='bins' \
Expand All @@ -25,6 +26,4 @@ runs:
- uses: actions/upload-artifact@v3
with:
name: ${{ inputs.name }}
path: |
target/failure-${{ inputs.name }}.tar.gz
/tmp/sccache_*.txt
path: target/failure-${{ inputs.name }}.tar.gz
16 changes: 16 additions & 0 deletions .github/actions/nvcc-toolchain/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: nvcc-toolchain
inputs:
cuda-version:
description: CUDA Toolkit version
required: true

runs:
using: composite
steps:
- if: runner.os == 'Linux'
shell: bash
run: .github/actions/nvcc-toolchain/install-cuda.sh ${{ inputs.cuda-version }}

- if: runner.os == 'Windows'
shell: powershell
run: .\.github\actions\nvcc-toolchain\install-cuda.ps1 -cudaVersion ${{ inputs.cuda-version }}
60 changes: 60 additions & 0 deletions .github/actions/nvcc-toolchain/install-cuda.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
Param(
[Parameter(Mandatory=$false)]
[string]
$cudaVersion="12.6.0"
)

# Use System.Version to tokenize version
$version = [Version]$cudaVersion

$major = $version.Major
$minor = $version.Minor
$build = $version.Build

# Minimum build is 0, not -1 as default in case "12.5" is passed
if ($build -lt 0) {
$build = 0
}

# mmb == major minor build
$mmbVersionTag = "${major}.${minor}.${build}"
# mm = major minor
$mmVersionTag = "${major}.${minor}"

$cudaVersionUrl = "https://developer.download.nvidia.com/compute/cuda/${mmbVersionTag}/network_installers/cuda_${mmbVersionTag}_windows_network.exe"

###
# `cuda_${mmbVersionTag}_windows_network.exe` name only valid back to CUDA v11.5.1.
# Before that it was named `cuda_${mmbVersionTag}_win10_network.exe`:
# * https://developer.download.nvidia.com/compute/cuda/11.5.1/network_installers/cuda_11.5.1_windows_network.exe
# * https://developer.download.nvidia.com/compute/cuda/11.5.0/network_installers/cuda_11.5.0_win10_network.exe
###

if ([version]$mmbVersionTag -le "11.5.0") {
$cudaVersionUrl = "https://developer.download.nvidia.com/compute/cuda/${mmbVersionTag}/network_installers/cuda_${mmbVersionTag}_win10_network.exe"
}

$cudaComponents =
"nvcc_$mmVersionTag",
"curand_$mmVersionTag",
"curand_dev_$mmVersionTag",
"cudart_$mmVersionTag",
"cupti_$mmVersionTag",
"nvrtc_$mmVersionTag",
"nvrtc_dev_$mmVersionTag",
"nvml_dev_$mmVersionTag",
"nvtx_$mmVersionTag"

Invoke-WebRequest -Uri "$cudaVersionUrl" -OutFile "./cuda_network.exe" -UseBasicParsing
Start-Process -Wait -PassThru -FilePath .\cuda_network.exe -ArgumentList "-s $cudaComponents"

$ENV:PATH="$ENV:PATH;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v$mmVersionTag\bin"
$ENV:CUDA_PATH="C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v$mmVersionTag"

$PATH_STR="PATH=$ENV:PATH"
$PATH_STR | Out-File -Append $ENV:GITHUB_ENV

$CUDA_PATH_STR="CUDA_PATH=$ENV:CUDA_PATH"
$CUDA_PATH_STR | Out-File -Append $ENV:GITHUB_ENV

Remove-Item .\cuda_network.exe
72 changes: 72 additions & 0 deletions .github/actions/nvcc-toolchain/install-cuda.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
#! /usr/bin/env bash
set -eu

export DEBIAN_FRONTEND=noninteractive

get_cuda_deb() {
local deb="$( \
wget --no-hsts -q -O- "${1}/Packages" \
| grep -P "^Filename: \./${2}(.*)\.deb$" \
| sort -Vr | head -n1 | cut -d' ' -f2 \
)";
if [ -z "$deb" ]; then
echo "Error: No matching .deb found for '${1}' and '${2}'" >&2
return 1
fi
wget --no-hsts -q -O "/tmp/${deb#./}" "${1}/${deb#./}";
echo -n "/tmp/${deb#./}";
}

VERSION="$1";

NVARCH="$(uname -p)";

if test "$NVARCH" = aarch64; then
NVARCH="sbsa";
fi

OSNAME="$(
. /etc/os-release;
major="$(cut -d'.' -f1 <<< "${VERSION_ID}")";
minor="$(cut -d'.' -f2 <<< "${VERSION_ID}")";
echo "$ID$((major - (major % 2)))${minor}";
)";

CUDA_HOME="/usr/local/cuda";

cuda_repo_base="https://developer.download.nvidia.com/compute/cuda/repos";
cuda_repo="${cuda_repo_base}/${OSNAME}/${NVARCH}";

cuda_ver="$VERSION";
cuda_ver="$(grep -Po '^[0-9]+\.[0-9]+' <<< "${cuda_ver}")";
cuda_ver="${cuda_ver/./-}";

if ! dpkg -s cuda-keyring; then
sudo apt-get install -y --no-install-recommends \
"$(get_cuda_deb "${cuda_repo}" cuda-keyring)" \
;
fi

PKGS=();
PKGS+=("cuda-toolkit-${cuda_ver}");

sudo apt-get update;
sudo apt-get install -y --no-install-recommends "${PKGS[@]}";

if ! test -L "${CUDA_HOME}"; then
# Create /usr/local/cuda symlink
sudo ln -s "${CUDA_HOME}-${cuda_ver}" "${CUDA_HOME}";
fi

export PATH="$PATH:$CUDA_HOME/bin"

which -a nvcc
nvcc --version

cat <<EOF | tee -a "$GITHUB_ENV"
CUDA_HOME=$CUDA_HOME
CUDA_PATH=$CUDA_HOME
PATH=$PATH
EOF

rm /tmp/*.deb
92 changes: 82 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ jobs:
matrix:
include:
- os: ubuntu-20.04
# Oldest tested CUDA Toolkit version. Older CTKs might work, but they're
# difficult to test without Ubuntu18.04 GHA runners or containerized jobs.
cuda: "11.1"
extra_desc: cuda11.1
# Oldest supported version, keep in sync with README.md
rustc: "1.75.0"
- os: ubuntu-22.04
Expand All @@ -86,21 +90,53 @@ jobs:
extra_args: --no-default-features
allow_failure: true
- os: ubuntu-22.04
cuda: "11.8"
extra_desc: cuda11.8
- os: ubuntu-24.04
cuda: "12.6"
# Oldest supported version, keep in sync with README.md
rustc: "1.75.0"
extra_desc: cuda12.6
- os: macos-13
# M1 CPU
# # M1 CPU
- os: macos-14
- os: windows-2019
cuda: "11.1"
# Oldest supported version, keep in sync with README.md
rustc: "1.75.0"
extra_args: --no-fail-fast
extra_desc: cuda11.1
- os: windows-2019
cuda: "11.8"
rustc: nightly
allow_failure: true
extra_args: --features=unstable
extra_desc: cuda11.8
- os: windows-2019
cuda: "11.8"
rustc: beta
extra_desc: cuda11.8
- os: windows-2022
cuda: "12.6"
# Oldest supported version, keep in sync with README.md
rustc: "1.75.0"
extra_args: --no-fail-fast
extra_desc: cuda12.6
- os: windows-2022
cuda: "12.6"
rustc: nightly
allow_failure: true
extra_args: --features=unstable
extra_desc: cuda12.6
- os: windows-2022
cuda: "12.6"
rustc: beta
extra_desc: cuda12.6
env:
RUST_BACKTRACE: 1
steps:
- uses: ilammy/msvc-dev-cmd@v1

- name: Clone repository
uses: actions/checkout@v4

Expand All @@ -109,9 +145,35 @@ jobs:
with:
toolchain: ${{ matrix.rustc }}

- name: Install gcc & clang for tests
run: sudo apt-get install -y clang gcc
if: ${{ matrix.os == 'ubuntu-20.04' || matrix.os == 'ubuntu-22.04' }}
- if: ${{ contains(matrix.os, 'ubuntu') }}
name: Install gcc & clang for tests
env:
DEBIAN_FRONTEND: noninteractive
run: |
set -x
# Conflicts with clang-cuda
if dpkg -s gcc-14 >/dev/null 2>&1; then
sudo apt remove -y gcc-14 g++-14
sudo apt autoremove -y
fi
# Ubuntu20.04's clang-10 is too old for CTK 11+, so install clang-12 instead
if test "${{ matrix.os }}" = "ubuntu-20.04" && test -n "${{ matrix.cuda }}"; then
sudo apt install -y --no-install-recommends gcc clang-12
sudo ln -sf $(which clang-12) /usr/bin/clang
sudo ln -sf $(which clang++-12) /usr/bin/clang++
else
sudo apt install -y --no-install-recommends gcc clang
fi
echo 'gcc version:'
gcc --version
echo 'clang version:'
clang --version
- if: matrix.cuda != '' && contains(fromJSON('["Linux", "Windows"]'), runner.os)
name: Install nvcc
uses: ./.github/actions/nvcc-toolchain
with:
cuda-version: ${{ matrix.cuda }}

- name: Build tests
run: cargo test --no-run --locked --all-targets ${{ matrix.extra_args }}
Expand Down Expand Up @@ -160,6 +222,9 @@ jobs:
- os: windows-2019
target: x86_64-pc-windows-msvc
rustflags: -Ctarget-feature=+crt-static
- os: windows-2019
target: aarch64-pc-windows-msvc
rustflags: -Ctarget-feature=+crt-static
steps:
- name: Clone repository
uses: actions/checkout@v4
Expand Down Expand Up @@ -203,7 +268,8 @@ jobs:
fail-fast: false
matrix:
include:
- os: ubuntu-20.04
- os: ubuntu-22.04
cuda: "11.8"
rustc: nightly
allow_failure: true
extra_args: --features=unstable
Expand All @@ -228,6 +294,12 @@ jobs:
run: sudo apt-get install -y clang gcc
if: ${{ matrix.os == 'ubuntu-20.04' }}

- if: matrix.cuda != '' && contains(fromJSON('["Linux", "Windows"]'), runner.os)
name: Install nvcc
uses: ./.github/actions/nvcc-toolchain
with:
cuda-version: ${{ matrix.cuda }}

- name: "`grcov` ~ install"
run: cargo install grcov

Expand All @@ -236,7 +308,7 @@ jobs:
env:
CARGO_INCREMENTAL: "0"
RUSTC_WRAPPER: ""
RUSTFLAGS: "-Zprofile -Ccodegen-units=1 -Copt-level=0 -Clink-dead-code -Coverflow-checks=off"
RUSTFLAGS: "-Ccodegen-units=1 -Copt-level=0 -Clink-dead-code -Coverflow-checks=off -Cprofile-generate=target/debug"

- name: Generate coverage data (via `grcov`)
id: coverage
Expand All @@ -255,7 +327,7 @@ jobs:
echo "report=${COVERAGE_REPORT_FILE}" >> $GITHUB_OUTPUT
- name: Upload coverage results (to Codecov.io)
uses: codecov/codecov-action@v4
uses: codecov/codecov-action@v5
with:
file: ${{ steps.coverage.outputs.report }}
## flags: IntegrationTests, UnitTests, ${{ steps.vars.outputs.CODECOV_FLAGS }}
Expand All @@ -264,7 +336,7 @@ jobs:
fail_ci_if_error: false

test_freebsd:
name: test freebsd-13.2 rust stable
name: test freebsd-14.1 rust stable
runs-on: ${{ matrix.job.os }}
timeout-minutes: 70
strategy:
Expand All @@ -275,7 +347,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Prepare, build and test
uses: vmactions/freebsd-vm@v1.0.7
uses: vmactions/freebsd-vm@v1
with:
mem: 8192
usesh: true
Expand Down Expand Up @@ -323,7 +395,7 @@ jobs:
if: failure()
uses: ./.github/actions/artifact_failure
with:
name: test-freebsd-13.2-stable
name: test-freebsd-14.1-stable

release:
name: release
Expand Down
Loading

0 comments on commit 4da5534

Please sign in to comment.