Skip to content
Open
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: 4 additions & 3 deletions cuda-bindings/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ Use `cuda-core` for wrappers around these raw bindings.
- The bindings are generated at build time from a CUDA 13.0+ toolkit.
- The toolkit root is the first set variable among `CUDA_TOOLKIT_PATH` and
`CUDA_HOME`; when neither is set, the build searches the standard install
locations (on Linux `/usr/local/cuda-13.3`, `/usr/local/cuda-13.2`,
`/usr/local/cuda-13`, `/usr/local/cuda`; on Windows
`C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.3` and `v13.2`).
locations (on Linux `/usr/local/cuda-13.5` down through
`/usr/local/cuda-13.0`, then `/usr/local/cuda-13`, `/usr/local/cuda`; on
Windows `C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.5` down
through `v13.0`).
- Within the toolkit, both the standard `include/` layout and the
redistributable `targets/<dir>/include/` layouts (Jetson/Tegra, sbsa,
cross-builds, extracted redistributables) are probed for `cuda.h`.
Expand Down
8 changes: 8 additions & 0 deletions cuda-bindings/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -225,13 +225,21 @@ fn default_cuda_toolkit_candidates() -> &'static [PathBuf] {
CANDIDATES.get_or_init(|| {
#[cfg(windows)]
let candidates = [
r"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.5",
r"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.4",
r"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.3",
r"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.2",
r"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.1",
r"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.0",
];
#[cfg(not(windows))]
let candidates = [
"/usr/local/cuda-13.5",
"/usr/local/cuda-13.4",
"/usr/local/cuda-13.3",
"/usr/local/cuda-13.2",
"/usr/local/cuda-13.1",
"/usr/local/cuda-13.0",
"/usr/local/cuda-13",
"/usr/local/cuda",
"/opt/cuda",
Expand Down
8 changes: 8 additions & 0 deletions cuda-core/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,21 @@ const TOOLKIT_TARGET_DIR_ENV: &str = "CUDA_TOOLKIT_TARGET_DIR";
/// `cuda.h` than the one the bindings were generated from.
#[cfg(windows)]
const DEFAULT_TOOLKIT_DIRS: &[&str] = &[
r"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.5",
r"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.4",
r"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.3",
r"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.2",
r"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.1",
r"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.0",
];
#[cfg(not(windows))]
const DEFAULT_TOOLKIT_DIRS: &[&str] = &[
"/usr/local/cuda-13.5",
"/usr/local/cuda-13.4",
"/usr/local/cuda-13.3",
"/usr/local/cuda-13.2",
"/usr/local/cuda-13.1",
"/usr/local/cuda-13.0",
"/usr/local/cuda-13",
"/usr/local/cuda",
];
Expand Down
12 changes: 10 additions & 2 deletions cuda-oxide/crates/cargo-oxide/src/commands/doctor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -817,16 +817,24 @@ const TOOLKIT_ENV_VARS: [&str; 2] = ["CUDA_TOOLKIT_PATH", "CUDA_HOME"];
/// preference list, not a version sort, and `/usr/local/cuda` is its *last*
/// entry rather than the default.
#[cfg(not(windows))]
pub(super) const DEFAULT_TOOLKIT_CANDIDATES: [&str; 4] = [
pub(super) const DEFAULT_TOOLKIT_CANDIDATES: [&str; 8] = [
"/usr/local/cuda-13.5",
"/usr/local/cuda-13.4",
"/usr/local/cuda-13.3",
"/usr/local/cuda-13.2",
"/usr/local/cuda-13.1",
"/usr/local/cuda-13.0",
"/usr/local/cuda-13",
"/usr/local/cuda",
];
#[cfg(windows)]
pub(super) const DEFAULT_TOOLKIT_CANDIDATES: [&str; 2] = [
pub(super) const DEFAULT_TOOLKIT_CANDIDATES: [&str; 6] = [
r"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.5",
r"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.4",
r"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.3",
r"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.2",
r"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.1",
r"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.0",
];

/// The floor `cuda-bindings` enforces (`build.rs`, `MIN_CUDA_VERSION`):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ nvcc --version
```

:::{tip}
If you installed CUDA to a non-default location, set `CUDA_TOOLKIT_PATH` to its root directory (the one containing `include/cuda.h`). If neither `CUDA_TOOLKIT_PATH` nor `CUDA_HOME` is set, these roots are tried in order and the first one holding a `cuda.h` of CUDA 13.0 or newer wins: `/usr/local/cuda-13.3`, `/usr/local/cuda-13.2`, `/usr/local/cuda-13`, `/usr/local/cuda`. With more than one toolkit installed, that order decides — not the highest version, and not the `/usr/local/cuda` symlink, which is last. `cargo oxide doctor` reports which root it resolved and why any earlier one was turned down.
If you installed CUDA to a non-default location, set `CUDA_TOOLKIT_PATH` to its root directory (the one containing `include/cuda.h`). If neither `CUDA_TOOLKIT_PATH` nor `CUDA_HOME` is set, these roots are tried in order and the first one holding a `cuda.h` of CUDA 13.0 or newer wins: `/usr/local/cuda-13.5`, `/usr/local/cuda-13.4`, `/usr/local/cuda-13.3`, `/usr/local/cuda-13.2`, `/usr/local/cuda-13.1`, `/usr/local/cuda-13.0`, `/usr/local/cuda-13`, `/usr/local/cuda`. With more than one toolkit installed, that order decides — not the highest version, and not the `/usr/local/cuda` symlink, which is last. `cargo oxide doctor` reports which root it resolved and why any earlier one was turned down.
:::

(installation-toolkit-driver-compatibility)=
Expand Down