Skip to content

Commit 9cc7aa2

Browse files
nnethercoteLegNeato
authored andcommitted
Update compiletests CUDA-finding code.
Remove some CUDA 11 references, add some CUDA 13 references. Also separate the Unix and Windows code a little more.
1 parent 58ee34a commit 9cc7aa2

File tree

2 files changed

+31
-18
lines changed

2 files changed

+31
-18
lines changed

crates/nvvm/src/lib.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -312,8 +312,10 @@ pub enum NvvmArch {
312312
/// This default value of 7.5 corresponds to Turing and later devices. We default to this
313313
/// because it is the minimum supported by CUDA 13.0 while being in the middle of the range
314314
/// supported by CUDA 12.x.
315-
// WARNING: If you change the default, consider updating the `--target-arch` values used for
316-
// compiletests in `ci_linux.yml` and `.github/workflows/ci_{linux,windows}.yml`.
315+
// WARNING: If you change the default, consider updating:
316+
// - The `--target-arch` values used for compiletests in `ci_linux.yml` and
317+
// `.github/workflows/ci_{linux,windows}.yml`.
318+
// - The CUDA versions used in `setup_cuda_environment` in `compiletests`.
317319
#[default]
318320
Compute75,
319321
Compute80,

tests/compiletests/src/main.rs

Lines changed: 27 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -576,30 +576,41 @@ fn setup_cuda_environment() {
576576
// Set library path to include CUDA NVVM libraries
577577
let lib_path_var = dylib_path_envvar();
578578

579-
// Try to find CUDA installation
580-
let cuda_paths = vec![
581-
"/usr/local/cuda/nvvm/lib64",
582-
"/usr/local/cuda-12/nvvm/lib64",
583-
"/usr/local/cuda-11/nvvm/lib64",
584-
"C:\\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA\\v12.8\\nvvm\\lib\\x64",
585-
"C:\\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA\\v12.0\\nvvm\\lib\\x64",
586-
"C:\\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA\\v11.8\\nvvm\\lib\\x64",
587-
];
588-
589579
let mut found_cuda_paths = Vec::new();
590580

591581
// Check CUDA_PATH environment variable
592582
if let Ok(cuda_path) = env::var("CUDA_PATH") {
593-
let nvvm_path = Path::new(&cuda_path).join("nvvm").join("lib64");
594-
if nvvm_path.exists() {
595-
found_cuda_paths.push(nvvm_path.to_string_lossy().to_string());
583+
#[cfg(unix)]
584+
{
585+
let nvvm_path = Path::new(&cuda_path).join("nvvm").join("lib64");
586+
if nvvm_path.exists() {
587+
found_cuda_paths.push(nvvm_path.to_string_lossy().to_string());
588+
}
596589
}
597-
let nvvm_path_win = Path::new(&cuda_path).join("nvvm").join("lib").join("x64");
598-
if nvvm_path_win.exists() {
599-
found_cuda_paths.push(nvvm_path_win.to_string_lossy().to_string());
590+
#[cfg(windows)]
591+
{
592+
let nvvm_path = Path::new(&cuda_path).join("nvvm").join("lib").join("x64");
593+
if nvvm_path.exists() {
594+
found_cuda_paths.push(nvvm_path.to_string_lossy().to_string());
595+
}
600596
}
601597
}
602598

599+
// Try to find CUDA installation
600+
#[cfg(unix)]
601+
let cuda_paths = vec![
602+
"/usr/local/cuda/nvvm/lib64",
603+
"/usr/local/cuda-13/nvvm/lib64",
604+
"/usr/local/cuda-12/nvvm/lib64",
605+
];
606+
#[cfg(windows)]
607+
let cuda_paths = vec![
608+
"C:\\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA\\v13.0\\nvvm\\lib\\x64",
609+
"C:\\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA\\v12.9\\nvvm\\lib\\x64",
610+
"C:\\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA\\v12.8\\nvvm\\lib\\x64",
611+
"C:\\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA\\v12.0\\nvvm\\lib\\x64",
612+
];
613+
603614
// Check standard paths
604615
for path in &cuda_paths {
605616
if Path::new(path).exists() {

0 commit comments

Comments
 (0)