зеркало из https://github.com/mozilla/sccache.git
Test nvcc and clang-cuda in workflows/ci.yml
* Test nvcc and clang-cuda in workflows/ci.yml * Fix clang-cuda tests * Ensure /tmp/sccache_*.txt files are included in failed job artifacts on Windows
This commit is contained in:
Родитель
34482cb3af
Коммит
19198f4709
|
@ -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' \
|
||||
|
@ -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
|
||||
|
|
|
@ -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 }}
|
|
@ -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
|
|
@ -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
|
|
@ -86,21 +86,53 @@ jobs:
|
|||
extra_args: --no-default-features
|
||||
allow_failure: true
|
||||
- os: ubuntu-22.04
|
||||
- os: macos-13
|
||||
# M1 CPU
|
||||
- os: macos-14
|
||||
- os: windows-2019
|
||||
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
|
||||
- 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
|
||||
|
||||
|
@ -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 }}
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
||||
|
|
|
@ -140,6 +140,7 @@ impl CCompilerImpl for Clang {
|
|||
self.kind(),
|
||||
rewrite_includes_only,
|
||||
ignorable_whitespace_flags,
|
||||
language_to_clang_arg,
|
||||
)
|
||||
.await
|
||||
}
|
||||
|
@ -168,6 +169,7 @@ impl CCompilerImpl for Clang {
|
|||
env_vars,
|
||||
self.kind(),
|
||||
rewrite_includes_only,
|
||||
language_to_clang_arg,
|
||||
)
|
||||
.map(|(command, dist_command, cacheable)| {
|
||||
(CCompileCommand::new(command), dist_command, cacheable)
|
||||
|
@ -175,6 +177,24 @@ impl CCompilerImpl for Clang {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn language_to_clang_arg(lang: Language) -> Option<&'static str> {
|
||||
match lang {
|
||||
Language::C => Some("c"),
|
||||
Language::CHeader => Some("c-header"),
|
||||
Language::Cxx => Some("c++"),
|
||||
Language::CxxHeader => Some("c++-header"),
|
||||
Language::ObjectiveC => Some("objective-c"),
|
||||
Language::ObjectiveCxx => Some("objective-c++"),
|
||||
Language::ObjectiveCxxHeader => Some("objective-c++-header"),
|
||||
Language::Cuda => Some("cuda"),
|
||||
Language::Ptx => None,
|
||||
Language::Cubin => None,
|
||||
Language::Rust => None, // Let the compiler decide
|
||||
Language::Hip => Some("hip"),
|
||||
Language::GenericHeader => None, // Let the compiler decide
|
||||
}
|
||||
}
|
||||
|
||||
counted_array!(pub static ARGS: [ArgInfo<gcc::ArgData>; _] = [
|
||||
take_arg!("--dependent-lib", OsString, Concatenated('='), PassThrough),
|
||||
take_arg!("--hip-device-lib-path", PathBuf, Concatenated('='), PassThroughPath),
|
||||
|
|
|
@ -90,6 +90,7 @@ impl CCompilerImpl for Gcc {
|
|||
self.kind(),
|
||||
rewrite_includes_only,
|
||||
ignorable_whitespace_flags,
|
||||
language_to_gcc_arg,
|
||||
)
|
||||
.await
|
||||
}
|
||||
|
@ -118,6 +119,7 @@ impl CCompilerImpl for Gcc {
|
|||
env_vars,
|
||||
self.kind(),
|
||||
rewrite_includes_only,
|
||||
language_to_gcc_arg,
|
||||
)
|
||||
.map(|(command, dist_command, cacheable)| {
|
||||
(CCompileCommand::new(command), dist_command, cacheable)
|
||||
|
@ -710,7 +712,7 @@ pub fn language_to_gcc_arg(lang: Language) -> Option<&'static str> {
|
|||
}
|
||||
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
fn preprocess_cmd<T>(
|
||||
fn preprocess_cmd<F, T>(
|
||||
cmd: &mut T,
|
||||
parsed_args: &ParsedArguments,
|
||||
cwd: &Path,
|
||||
|
@ -719,10 +721,12 @@ fn preprocess_cmd<T>(
|
|||
kind: CCompilerKind,
|
||||
rewrite_includes_only: bool,
|
||||
ignorable_whitespace_flags: Vec<String>,
|
||||
language_to_arg: F,
|
||||
) where
|
||||
F: Fn(Language) -> Option<&'static str>,
|
||||
T: RunCommand,
|
||||
{
|
||||
let language = language_to_gcc_arg(parsed_args.language);
|
||||
let language = language_to_arg(parsed_args.language);
|
||||
if let Some(lang) = &language {
|
||||
cmd.arg("-x").arg(lang);
|
||||
}
|
||||
|
@ -791,7 +795,7 @@ fn preprocess_cmd<T>(
|
|||
}
|
||||
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
pub async fn preprocess<T>(
|
||||
pub async fn preprocess<F, T>(
|
||||
creator: &T,
|
||||
executable: &Path,
|
||||
parsed_args: &ParsedArguments,
|
||||
|
@ -801,8 +805,10 @@ pub async fn preprocess<T>(
|
|||
kind: CCompilerKind,
|
||||
rewrite_includes_only: bool,
|
||||
ignorable_whitespace_flags: Vec<String>,
|
||||
language_to_arg: F,
|
||||
) -> Result<process::Output>
|
||||
where
|
||||
F: Fn(Language) -> Option<&'static str>,
|
||||
T: CommandCreatorSync,
|
||||
{
|
||||
trace!("preprocess");
|
||||
|
@ -816,6 +822,7 @@ where
|
|||
kind,
|
||||
rewrite_includes_only,
|
||||
ignorable_whitespace_flags,
|
||||
language_to_arg,
|
||||
);
|
||||
if log_enabled!(Trace) {
|
||||
trace!("preprocess: {:?}", cmd);
|
||||
|
@ -823,7 +830,8 @@ where
|
|||
run_input_output(cmd, None).await
|
||||
}
|
||||
|
||||
pub fn generate_compile_commands(
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
pub fn generate_compile_commands<F>(
|
||||
path_transformer: &mut dist::PathTransformer,
|
||||
executable: &Path,
|
||||
parsed_args: &ParsedArguments,
|
||||
|
@ -831,11 +839,15 @@ pub fn generate_compile_commands(
|
|||
env_vars: &[(OsString, OsString)],
|
||||
kind: CCompilerKind,
|
||||
rewrite_includes_only: bool,
|
||||
language_to_arg: F,
|
||||
) -> Result<(
|
||||
SingleCompileCommand,
|
||||
Option<dist::CompileCommand>,
|
||||
Cacheable,
|
||||
)> {
|
||||
)>
|
||||
where
|
||||
F: Fn(Language) -> Option<&'static str>,
|
||||
{
|
||||
// Unused arguments
|
||||
#[cfg(not(feature = "dist-client"))]
|
||||
{
|
||||
|
@ -853,7 +865,7 @@ pub fn generate_compile_commands(
|
|||
|
||||
// Pass the language explicitly as we might have gotten it from the
|
||||
// command line.
|
||||
let language = language_to_gcc_arg(parsed_args.language);
|
||||
let language = language_to_arg(parsed_args.language);
|
||||
let mut arguments: Vec<OsString> = vec![];
|
||||
if let Some(lang) = &language {
|
||||
arguments.extend(vec!["-x".into(), lang.into()])
|
||||
|
@ -885,7 +897,7 @@ pub fn generate_compile_commands(
|
|||
let dist_command = (|| {
|
||||
// https://gcc.gnu.org/onlinedocs/gcc-4.9.0/gcc/Overall-Options.html
|
||||
let mut language: Option<String> =
|
||||
language_to_gcc_arg(parsed_args.language).map(|lang| lang.into());
|
||||
language_to_arg(parsed_args.language).map(|lang| lang.into());
|
||||
if !rewrite_includes_only {
|
||||
match parsed_args.language {
|
||||
Language::C => language = Some("cpp-output".into()),
|
||||
|
@ -1689,6 +1701,7 @@ mod test {
|
|||
CCompilerKind::Gcc,
|
||||
true,
|
||||
vec![],
|
||||
language_to_gcc_arg,
|
||||
);
|
||||
// make sure the architectures were rewritten to prepocessor defines
|
||||
let expected_args = ovec![
|
||||
|
@ -1724,6 +1737,7 @@ mod test {
|
|||
CCompilerKind::Gcc,
|
||||
true,
|
||||
vec![],
|
||||
language_to_gcc_arg,
|
||||
);
|
||||
// make sure the architectures were rewritten to prepocessor defines
|
||||
let expected_args = ovec![
|
||||
|
@ -1758,6 +1772,7 @@ mod test {
|
|||
CCompilerKind::Clang,
|
||||
true,
|
||||
vec![],
|
||||
language_to_gcc_arg,
|
||||
);
|
||||
let expected_args = ovec!["-x", "c", "-E", "-frewrite-includes", "--", "foo.c"];
|
||||
assert_eq!(cmd.args, expected_args);
|
||||
|
@ -1783,6 +1798,7 @@ mod test {
|
|||
CCompilerKind::Gcc,
|
||||
true,
|
||||
vec![],
|
||||
language_to_gcc_arg,
|
||||
);
|
||||
// disable with extensions enabled
|
||||
assert!(!cmd.args.contains(&"-fdirectives-only".into()));
|
||||
|
@ -1808,6 +1824,7 @@ mod test {
|
|||
CCompilerKind::Gcc,
|
||||
true,
|
||||
vec![],
|
||||
language_to_gcc_arg,
|
||||
);
|
||||
// no reason to disable it with no extensions enabled
|
||||
assert!(cmd.args.contains(&"-fdirectives-only".into()));
|
||||
|
@ -1833,6 +1850,7 @@ mod test {
|
|||
CCompilerKind::Gcc,
|
||||
true,
|
||||
vec![],
|
||||
language_to_gcc_arg,
|
||||
);
|
||||
// disable with extensions enabled
|
||||
assert!(!cmd.args.contains(&"-fdirectives-only".into()));
|
||||
|
@ -2178,6 +2196,7 @@ mod test {
|
|||
&[],
|
||||
CCompilerKind::Gcc,
|
||||
false,
|
||||
language_to_gcc_arg,
|
||||
)
|
||||
.unwrap();
|
||||
#[cfg(feature = "dist-client")]
|
||||
|
@ -2208,6 +2227,7 @@ mod test {
|
|||
&[],
|
||||
CCompilerKind::Clang,
|
||||
false,
|
||||
language_to_gcc_arg,
|
||||
)
|
||||
.unwrap();
|
||||
let expected_args = ovec!["-x", "c", "-c", "-o", "foo.o", "--", "foo.c"];
|
||||
|
@ -2268,6 +2288,7 @@ mod test {
|
|||
CCompilerKind::Gcc,
|
||||
true,
|
||||
vec![],
|
||||
language_to_gcc_arg,
|
||||
);
|
||||
assert!(cmd.args.contains(&"-x".into()) && cmd.args.contains(&"c++-header".into()));
|
||||
}
|
||||
|
@ -2292,6 +2313,7 @@ mod test {
|
|||
CCompilerKind::Gcc,
|
||||
true,
|
||||
vec![],
|
||||
language_to_gcc_arg,
|
||||
);
|
||||
assert!(cmd.args.contains(&"-x".into()) && cmd.args.contains(&"c++-header".into()));
|
||||
}
|
||||
|
@ -2316,6 +2338,7 @@ mod test {
|
|||
CCompilerKind::Gcc,
|
||||
true,
|
||||
vec![],
|
||||
language_to_gcc_arg,
|
||||
);
|
||||
assert!(!cmd.args.contains(&"-x".into()));
|
||||
}
|
||||
|
|
|
@ -180,6 +180,7 @@ impl CCompilerImpl for Nvhpc {
|
|||
env_vars,
|
||||
self.kind(),
|
||||
rewrite_includes_only,
|
||||
gcc::language_to_gcc_arg,
|
||||
)
|
||||
.map(|(command, dist_command, cacheable)| {
|
||||
(CCompileCommand::new(command), dist_command, cacheable)
|
||||
|
|
|
@ -1391,6 +1391,7 @@ fn test_s3_no_credentials_valid_false() {
|
|||
|
||||
#[test]
|
||||
fn test_gcs_service_account() {
|
||||
env::set_var("SCCACHE_S3_NO_CREDENTIALS", "false");
|
||||
env::set_var("SCCACHE_GCS_BUCKET", "my-bucket");
|
||||
env::set_var("SCCACHE_GCS_SERVICE_ACCOUNT", "my@example.com");
|
||||
env::set_var("SCCACHE_GCS_RW_MODE", "READ_WRITE");
|
||||
|
@ -1410,6 +1411,7 @@ fn test_gcs_service_account() {
|
|||
None => unreachable!(),
|
||||
};
|
||||
|
||||
env::remove_var("SCCACHE_S3_NO_CREDENTIALS");
|
||||
env::remove_var("SCCACHE_GCS_BUCKET");
|
||||
env::remove_var("SCCACHE_GCS_SERVICE_ACCOUNT");
|
||||
env::remove_var("SCCACHE_GCS_RW_MODE");
|
||||
|
|
|
@ -128,7 +128,17 @@ fn compile_cuda_cmdline<T: AsRef<OsStr>>(
|
|||
exe,
|
||||
compile_flag,
|
||||
input,
|
||||
"--cuda-gpu-arch=sm_50",
|
||||
"--cuda-gpu-arch=sm_70",
|
||||
format!(
|
||||
"--cuda-path={}",
|
||||
env::var_os("CUDA_PATH")
|
||||
.or(env::var_os("CUDA_HOME"))
|
||||
.unwrap_or("/usr/local/cuda".into())
|
||||
.to_string_lossy()
|
||||
),
|
||||
"--no-cuda-version-check",
|
||||
// work around for clang-cuda on windows-2019 (https://github.com/microsoft/STL/issues/2359)
|
||||
"-D_ALLOW_COMPILER_AND_STL_VERSION_MISMATCH",
|
||||
"-o",
|
||||
output
|
||||
)
|
||||
|
@ -206,7 +216,7 @@ fn test_basic_compile(compiler: Compiler, tempdir: &Path) {
|
|||
exe,
|
||||
env_vars,
|
||||
} = compiler;
|
||||
trace!("run_sccache_command_test: {}", name);
|
||||
println!("test_basic_compile: {}", name);
|
||||
// Compile a source file.
|
||||
copy_to_tempdir(&[INPUT, INPUT_ERR], tempdir);
|
||||
|
||||
|
@ -258,7 +268,7 @@ fn test_noncacheable_stats(compiler: Compiler, tempdir: &Path) {
|
|||
exe,
|
||||
env_vars,
|
||||
} = compiler;
|
||||
trace!("test_noncacheable_stats: {}", name);
|
||||
println!("test_noncacheable_stats: {}", name);
|
||||
copy_to_tempdir(&[INPUT], tempdir);
|
||||
|
||||
trace!("compile");
|
||||
|
@ -517,7 +527,7 @@ fn test_gcc_clang_no_warnings_from_macro_expansion(compiler: Compiler, tempdir:
|
|||
exe,
|
||||
env_vars,
|
||||
} = compiler;
|
||||
trace!("test_gcc_clang_no_warnings_from_macro_expansion: {}", name);
|
||||
println!("test_gcc_clang_no_warnings_from_macro_expansion: {}", name);
|
||||
// Compile a source file.
|
||||
copy_to_tempdir(&[INPUT_MACRO_EXPANSION], tempdir);
|
||||
|
||||
|
@ -543,7 +553,7 @@ fn test_compile_with_define(compiler: Compiler, tempdir: &Path) {
|
|||
exe,
|
||||
env_vars,
|
||||
} = compiler;
|
||||
trace!("test_compile_with_define: {}", name);
|
||||
println!("test_compile_with_define: {}", name);
|
||||
// Compile a source file.
|
||||
copy_to_tempdir(&[INPUT_WITH_DEFINE], tempdir);
|
||||
|
||||
|
@ -631,7 +641,7 @@ fn test_nvcc_cuda_compiles(compiler: &Compiler, tempdir: &Path) {
|
|||
exe,
|
||||
env_vars,
|
||||
} = compiler;
|
||||
trace!("run_sccache_command_test: {}", name);
|
||||
println!("test_nvcc_cuda_compiles: {}", name);
|
||||
// Compile multiple source files.
|
||||
copy_to_tempdir(&[INPUT_FOR_CUDA_A, INPUT_FOR_CUDA_B], tempdir);
|
||||
|
||||
|
@ -642,6 +652,7 @@ fn test_nvcc_cuda_compiles(compiler: &Compiler, tempdir: &Path) {
|
|||
name,
|
||||
exe,
|
||||
"-c",
|
||||
// relative path for input
|
||||
INPUT_FOR_CUDA_A,
|
||||
// relative path for output
|
||||
out_file.file_name().unwrap().to_string_lossy().as_ref(),
|
||||
|
@ -677,6 +688,7 @@ fn test_nvcc_cuda_compiles(compiler: &Compiler, tempdir: &Path) {
|
|||
name,
|
||||
exe,
|
||||
"-c",
|
||||
// relative path for input
|
||||
INPUT_FOR_CUDA_A,
|
||||
// absolute path for output
|
||||
out_file.to_string_lossy().as_ref(),
|
||||
|
@ -720,7 +732,8 @@ fn test_nvcc_cuda_compiles(compiler: &Compiler, tempdir: &Path) {
|
|||
name,
|
||||
exe,
|
||||
"-c",
|
||||
INPUT_FOR_CUDA_B,
|
||||
// absolute path for input
|
||||
&tempdir.join(INPUT_FOR_CUDA_B).to_string_lossy(),
|
||||
// absolute path for output
|
||||
out_file.to_string_lossy().as_ref(),
|
||||
Vec::new(),
|
||||
|
@ -848,7 +861,7 @@ fn test_nvcc_proper_lang_stat_tracking(compiler: Compiler, tempdir: &Path) {
|
|||
} = compiler;
|
||||
zero_stats();
|
||||
|
||||
trace!("run_sccache_command_test: {}", name);
|
||||
println!("test_nvcc_proper_lang_stat_tracking: {}", name);
|
||||
// Compile multiple source files.
|
||||
copy_to_tempdir(&[INPUT_FOR_CUDA_C, INPUT], tempdir);
|
||||
|
||||
|
@ -925,7 +938,7 @@ fn test_clang_cuda_compiles(compiler: &Compiler, tempdir: &Path) {
|
|||
exe,
|
||||
env_vars,
|
||||
} = compiler;
|
||||
trace!("run_sccache_command_test: {}", name);
|
||||
println!("test_clang_cuda_compiles: {}", name);
|
||||
// Compile multiple source files.
|
||||
copy_to_tempdir(&[INPUT_FOR_CUDA_A, INPUT_FOR_CUDA_B], tempdir);
|
||||
|
||||
|
@ -1022,16 +1035,17 @@ fn test_clang_proper_lang_stat_tracking(compiler: Compiler, tempdir: &Path) {
|
|||
} = compiler;
|
||||
zero_stats();
|
||||
|
||||
trace!("run_sccache_command_test: {}", name);
|
||||
println!("test_clang_proper_lang_stat_tracking: {}", name);
|
||||
// Compile multiple source files.
|
||||
copy_to_tempdir(&[INPUT_FOR_CUDA_C, INPUT], tempdir);
|
||||
|
||||
let out_file = tempdir.join(OUTPUT);
|
||||
trace!("compile CUDA A");
|
||||
sccache_command()
|
||||
.args(compile_cmdline(
|
||||
.args(compile_cuda_cmdline(
|
||||
name,
|
||||
&exe,
|
||||
"-c",
|
||||
INPUT_FOR_CUDA_C,
|
||||
OUTPUT,
|
||||
Vec::new(),
|
||||
|
@ -1043,9 +1057,10 @@ fn test_clang_proper_lang_stat_tracking(compiler: Compiler, tempdir: &Path) {
|
|||
fs::remove_file(&out_file).unwrap();
|
||||
trace!("compile CUDA A");
|
||||
sccache_command()
|
||||
.args(compile_cmdline(
|
||||
.args(compile_cuda_cmdline(
|
||||
name,
|
||||
&exe,
|
||||
"-c",
|
||||
INPUT_FOR_CUDA_C,
|
||||
OUTPUT,
|
||||
Vec::new(),
|
||||
|
@ -1096,7 +1111,7 @@ fn test_hip_compiles(compiler: &Compiler, tempdir: &Path) {
|
|||
exe,
|
||||
env_vars,
|
||||
} = compiler;
|
||||
trace!("run_sccache_command_test: {}", name);
|
||||
println!("test_hip_compiles: {}", name);
|
||||
// Compile multiple source files.
|
||||
copy_to_tempdir(&[INPUT_FOR_HIP_A, INPUT_FOR_HIP_B], tempdir);
|
||||
|
||||
|
@ -1193,7 +1208,7 @@ fn test_hip_compiles_multi_targets(compiler: &Compiler, tempdir: &Path) {
|
|||
exe,
|
||||
env_vars,
|
||||
} = compiler;
|
||||
trace!("run_sccache_command_test: {}", name);
|
||||
println!("test_hip_compiles_multi_targets: {}", name);
|
||||
// Compile multiple source files.
|
||||
copy_to_tempdir(&[INPUT_FOR_HIP_A, INPUT_FOR_HIP_B], tempdir);
|
||||
|
||||
|
@ -1330,13 +1345,13 @@ fn test_clang_cache_whitespace_normalization(
|
|||
exe,
|
||||
env_vars,
|
||||
} = compiler;
|
||||
println!("run_sccache_command_test: {}", name);
|
||||
println!("expecting hit: {}", hit);
|
||||
println!("test_clang_cache_whitespace_normalization: {}", name);
|
||||
debug!("expecting hit: {}", hit);
|
||||
// Compile a source file.
|
||||
copy_to_tempdir(&[INPUT_WITH_WHITESPACE, INPUT_WITH_WHITESPACE_ALT], tempdir);
|
||||
zero_stats();
|
||||
|
||||
println!("compile whitespace");
|
||||
debug!("compile whitespace");
|
||||
sccache_command()
|
||||
.args(compile_cmdline(
|
||||
name,
|
||||
|
@ -1349,7 +1364,7 @@ fn test_clang_cache_whitespace_normalization(
|
|||
.envs(env_vars.clone())
|
||||
.assert()
|
||||
.success();
|
||||
println!("request stats");
|
||||
debug!("request stats");
|
||||
get_stats(|info| {
|
||||
assert_eq!(1, info.stats.compile_requests);
|
||||
assert_eq!(1, info.stats.requests_executed);
|
||||
|
@ -1357,7 +1372,7 @@ fn test_clang_cache_whitespace_normalization(
|
|||
assert_eq!(1, info.stats.cache_misses.all());
|
||||
});
|
||||
|
||||
println!("compile whitespace_alt");
|
||||
debug!("compile whitespace_alt");
|
||||
sccache_command()
|
||||
.args(compile_cmdline(
|
||||
name,
|
||||
|
@ -1370,7 +1385,7 @@ fn test_clang_cache_whitespace_normalization(
|
|||
.envs(env_vars)
|
||||
.assert()
|
||||
.success();
|
||||
println!("request stats (expecting cache hit)");
|
||||
debug!("request stats (expecting cache hit)");
|
||||
if hit {
|
||||
get_stats(move |info| {
|
||||
assert_eq!(2, info.stats.compile_requests);
|
||||
|
@ -1444,7 +1459,13 @@ fn find_cuda_compilers() -> Vec<Compiler> {
|
|||
})
|
||||
})
|
||||
.collect::<Vec<_>>(),
|
||||
Err(_) => vec![],
|
||||
Err(_) => {
|
||||
eprintln!(
|
||||
"unable to find `nvcc` in PATH={:?}",
|
||||
env::var_os("PATH").unwrap_or_default()
|
||||
);
|
||||
vec![]
|
||||
}
|
||||
};
|
||||
compilers
|
||||
}
|
||||
|
@ -1544,6 +1565,13 @@ fn test_cuda_sccache_command(preprocessor_cache_mode: bool) {
|
|||
.tempdir()
|
||||
.unwrap();
|
||||
let compilers = find_cuda_compilers();
|
||||
println!(
|
||||
"CUDA compilers: {:?}",
|
||||
compilers
|
||||
.iter()
|
||||
.map(|c| c.exe.to_string_lossy())
|
||||
.collect::<Vec<_>>()
|
||||
);
|
||||
if compilers.is_empty() {
|
||||
warn!("No compilers found, skipping test");
|
||||
} else {
|
||||
|
|
Загрузка…
Ссылка в новой задаче