Skip to content

Commit

Permalink
Add nvcuda.so.1 and cuda.so.1 to libcuda search paths
Browse files Browse the repository at this point in the history
  • Loading branch information
CatsAreFluffy authored Jan 20, 2025
1 parent 1d499fe commit 18f7e18
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/driver/sys/mod.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
use std::env::consts::{DLL_PREFIX, DLL_SUFFIX};

#[cfg(feature = "cuda-11040")]
mod sys_11040;
#[cfg(feature = "cuda-11040")]
Expand Down Expand Up @@ -62,9 +64,14 @@ pub unsafe fn lib() -> &'static Lib {
static LIB: std::sync::OnceLock<Lib> = std::sync::OnceLock::new();
LIB.get_or_init(|| {
let lib_name = "cuda";
let choices = [lib_name, "nvcuda"];
for choice in choices {
if let Ok(lib) = Lib::new(libloading::library_filename(choice)) {
// See issue #296
let choices = [
std::format!("{DLL_PREFIX}{lib_name}{DLL_SUFFIX}"),
std::format!("{DLL_PREFIX}nvcuda{DLL_SUFFIX}"),
std::format!("{DLL_PREFIX}{lib_name}{DLL_SUFFIX}.1"),
];
for choice in choices.iter() {
if let Ok(lib) = Lib::new(choice) {
return lib;
}
}
Expand Down

0 comments on commit 18f7e18

Please sign in to comment.