Skip to content

Commit 26e0b97

Browse files
committed
build(cudnn-sys): Add CUDNN_INCLUDE_DIR
Enables users to specify a non-standard cuDNN install path. This seems to be needed for the newer editions of the CUDA toolkit, as cuDNN isn't included by default (at least in the Fedora repo's, you have to install from a tarball)
1 parent 3c2e043 commit 26e0b97

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

crates/cudnn-sys/build/cudnn_sdk.rs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
use std::env;
12
use std::error;
23
use std::fs;
34
use std::path;
@@ -64,7 +65,18 @@ impl CudnnSdk {
6465
"C:/Program Files/NVIDIA/CUDNN/v9.x/include",
6566
"C:/Program Files/NVIDIA/CUDNN/v8.x/include",
6667
];
67-
CUDNN_DEFAULT_PATHS
68+
69+
let mut cudnn_paths: Vec<String> =
70+
CUDNN_DEFAULT_PATHS.iter().map(|s| s.to_string()).collect();
71+
if let Some(override_path) = env::var_os("CUDNN_INCLUDE_DIR") {
72+
cudnn_paths.push(
73+
override_path
74+
.into_string()
75+
.expect("CUDNN_INCLUDE_DIR to be a Unicode string"),
76+
);
77+
}
78+
79+
cudnn_paths
6880
.iter()
6981
.find(|s| Self::is_cudnn_include_path(s))
7082
.map(path::PathBuf::from)

0 commit comments

Comments
 (0)