#![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(any(
feature = "cudnn-08009",
feature = "cudnn-09010",
feature = "cudnn-09021",
))]
pub mod cudnn;
#[cfg(all(
feature = "cufft",
not(any(
feature = "cuda-11040",
feature = "cuda-11050",
feature = "cuda-11060",
feature = "cuda-11070",
feature = "cuda-11080",
))
))]
pub mod cufft;
#[cfg(feature = "cufile")]
pub mod cufile;
#[cfg(feature = "cupti")]
pub mod cupti;
#[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(all(
any(
feature = "cutensor-02003",
feature = "cutensor-02004",
feature = "cutensor-02005",
feature = "cutensor-02006",
),
not(any(
feature = "cuda-11040",
feature = "cuda-11050",
feature = "cuda-11060",
feature = "cuda-11070",
feature = "cuda-11080",
))
))]
pub mod cutensor;
#[cfg(feature = "driver")]
pub mod driver;
#[cfg(any(
feature = "nccl-02022",
feature = "nccl-02024",
feature = "nccl-02025",
feature = "nccl-02026",
feature = "nccl-02027",
feature = "nccl-02028",
feature = "nccl-02029",
feature = "nccl-02030",
))]
pub mod nccl;
#[cfg(feature = "nvrtc")]
pub mod nvrtc;
#[cfg(feature = "nvtx")]
pub mod nvtx;
#[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 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}_11{DLL_SUFFIX}"),
std::format!("{DLL_PREFIX}{lib_name}{pointer_width}_12{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}.12"),
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}.9"),
std::format!("{DLL_PREFIX}{lib_name}{DLL_SUFFIX}.1"),
]
.into()
}