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
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 }}
50 changes: 50 additions & 0 deletions .github/actions/nvcc-toolchain/install-cuda.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
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}"

# `cuda_${mmbVersionTag}_windows_network.exe` name only valid back to CUDA v11.5.1.
# Before that it was named `cuda_${mmbVersionTag}_win10_network.exe`.
$cudaVersionUrl = "https://developer.download.nvidia.com/compute/cuda/${mmbVersionTag}/network_installers/cuda_${mmbVersionTag}_windows_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
68 changes: 63 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,21 +86,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.8"
# Oldest supported version, keep in sync with README.md
rustc: "1.75.0"
extra_args: --no-fail-fast
extra_desc: cuda11.8
- 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 +141,28 @@ 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
sudo apt install -y --no-install-recommends clang gcc
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 @@ -206,7 +257,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 @@ -231,6 +283,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 Down
7 changes: 7 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ hyper-util = { version = "0.1.3", optional = true, features = [
"server",
] }
is-terminal = "0.4.12"
itertools = "0.12"
jobserver = "0.1"
jwt = { package = "jsonwebtoken", version = "9", optional = true }
libc = "0.2.153"
Expand Down Expand Up @@ -118,6 +119,7 @@ object = "0.32"
rouille = { version = "3.6", optional = true, default-features = false, features = [
"ssl",
] }
shlex = "1.3.0"
syslog = { version = "6", optional = true }
version-compare = { version = "0.1.1", optional = true }

Expand Down
2 changes: 1 addition & 1 deletion src/bin/sccache-dist/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ impl OverlayBuilder {
for (tc, _) in entries {
warn!("Removing old un-compressed toolchain: {:?}", tc);
assert!(toolchain_dir_map.remove(tc).is_some());
fs::remove_dir_all(&self.dir.join("toolchains").join(&tc.archive_id))
fs::remove_dir_all(self.dir.join("toolchains").join(&tc.archive_id))
.context("Failed to remove old toolchain directory")?;
}
}
Expand Down
3 changes: 3 additions & 0 deletions src/cache/cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@ pub enum Cache {
Hit(CacheRead),
/// Result was not found in cache.
Miss,
/// Do not cache the results of the compilation.
None,
/// Cache entry should be ignored, force compilation.
Recache,
}
Expand All @@ -110,6 +112,7 @@ impl fmt::Debug for Cache {
match *self {
Cache::Hit(_) => write!(f, "Cache::Hit(...)"),
Cache::Miss => write!(f, "Cache::Miss"),
Cache::None => write!(f, "Cache::None"),
Cache::Recache => write!(f, "Cache::Recache"),
}
}
Expand Down
Loading
Loading