#![cfg_attr(feature = "no-std", no_std)]
#[cfg(feature = "no-std")]
extern crate alloc;
#[cfg(feature = "no-std")]
extern crate no_std_compat as std;
#[cfg(feature = "cublas")]
pub mod cublas;
#[cfg(feature = "cublaslt")]
pub mod cublaslt;
#[cfg(feature = "cudnn")]
pub mod cudnn;
#[cfg(feature = "cufile")]
pub mod cufile;
#[cfg(feature = "curand")]
pub mod curand;
#[cfg(feature = "cusolver")]
pub mod cusolver;
#[cfg(feature = "cusolvermg")]
pub mod cusolvermg;
#[cfg(feature = "cusparse")]
pub mod cusparse;
#[cfg(feature = "driver")]
pub mod driver;
#[cfg(feature = "nccl")]
pub mod nccl;
#[cfg(feature = "nvrtc")]
pub mod nvrtc;
#[cfg(feature = "runtime")]
pub mod runtime;
pub mod types;
#[cfg(feature = "dynamic-loading")]
pub(crate) fn panic_no_lib_found<S: std::fmt::Debug>(lib_name: &str, choices: &[S]) -> ! {
panic!("Unable to dynamically load the \"{lib_name}\" shared library - searched for library names: {choices:?}. Ensure that `LD_LIBRARY_PATH` has the correct path to the installed library. If the shared library is present on the system under a different name than one of those listed above, please open a GitHub issue.");
}
#[cfg(feature = "dynamic-loading")]
pub(crate) fn get_lib_name_candidates(lib_name: &str) -> std::vec::Vec<std::string::String> {
use std::env::consts::{DLL_PREFIX, DLL_SUFFIX};
let pointer_width = if cfg!(target_pointer_width = "32") {
"32"
} else if cfg!(target_pointer_width = "64") {
"64"
} else {
panic!("Unsupported target pointer width")
};
let major = env!("CUDA_MAJOR_VERSION");
let minor = env!("CUDA_MINOR_VERSION");
[
std::format!("{DLL_PREFIX}{lib_name}{DLL_SUFFIX}"),
std::format!("{DLL_PREFIX}{lib_name}{pointer_width}{DLL_SUFFIX}"),
std::format!("{DLL_PREFIX}{lib_name}{pointer_width}_{major}{DLL_SUFFIX}"),
std::format!("{DLL_PREFIX}{lib_name}{pointer_width}_{major}{minor}{DLL_SUFFIX}"),
std::format!("{DLL_PREFIX}{lib_name}{pointer_width}_{major}{minor}_0{DLL_SUFFIX}"),
std::format!("{DLL_PREFIX}{lib_name}{pointer_width}_{major}0_{minor}{DLL_SUFFIX}"),
std::format!("{DLL_PREFIX}{lib_name}{pointer_width}_10{DLL_SUFFIX}"),
std::format!("{DLL_PREFIX}{lib_name}{pointer_width}_{major}0_0{DLL_SUFFIX}"),
std::format!("{DLL_PREFIX}{lib_name}{pointer_width}_9{DLL_SUFFIX}"),
std::format!("{DLL_PREFIX}{lib_name}{DLL_SUFFIX}.{major}"),
std::format!("{DLL_PREFIX}{lib_name}{DLL_SUFFIX}.11"),
std::format!("{DLL_PREFIX}{lib_name}{DLL_SUFFIX}.10"),
std::format!("{DLL_PREFIX}{lib_name}{DLL_SUFFIX}.1"),
]
.into()
}