1use crate::Library;
6
7const fn files(
9 linux: &'static [&'static str],
10 windows: &'static [&'static str],
11) -> &'static [&'static str] {
12 if cfg!(target_os = "linux") {
13 linux
14 } else if cfg!(target_os = "windows") {
15 windows
16 } else {
17 &[]
18 }
19}
20
21impl Library {
22 #[must_use]
23 pub const fn cuda_driver() -> Self {
24 Self::new("the CUDA driver", files(&["libcuda.so.1"], &["nvcuda.dll"]))
25 }
26
27 #[must_use]
28 pub const fn cuda_runtime() -> Self {
29 Self::new(
30 "the CUDA runtime",
31 files(&["libcudart.so.13"], &["cudart64_13.dll"]),
32 )
33 }
34
35 #[must_use]
36 pub const fn nvrtc() -> Self {
37 Self::new("NVRTC", files(&["libnvrtc.so.13"], &["nvrtc64_130_0.dll"]))
38 }
39
40 #[must_use]
41 pub const fn nvjitlink() -> Self {
42 Self::new(
43 "nvJitLink",
44 files(&["libnvJitLink.so.13"], &["nvJitLink_130_0.dll"]),
45 )
46 }
47
48 #[must_use]
49 pub const fn nvvm() -> Self {
50 Self::new("NVVM", files(&["libnvvm.so.4"], &["nvvm64_40_0.dll"]))
51 }
52
53 #[must_use]
55 pub const fn nvtx() -> Self {
56 Self::new(
57 "NVTX",
58 files(&["libnvtx3interop.so.1"], &["nvtx3interop.dll"]),
59 )
60 }
61
62 #[must_use]
63 pub const fn nvml() -> Self {
64 Self::new("NVML", files(&["libnvidia-ml.so.1"], &["nvml.dll"]))
65 }
66
67 #[must_use]
68 pub const fn cublas() -> Self {
69 Self::new("cuBLAS", files(&["libcublas.so.13"], &["cublas64_13.dll"]))
70 }
71
72 #[must_use]
73 pub const fn cublas_lt() -> Self {
74 Self::new(
75 "cuBLASLt",
76 files(&["libcublasLt.so.13"], &["cublasLt64_13.dll"]),
77 )
78 }
79
80 #[must_use]
82 pub const fn cudnn() -> Self {
83 Self::new("cuDNN", files(&["libcudnn.so.9"], &["cudnn64_9.dll"]))
84 }
85
86 #[must_use]
87 pub const fn cudss() -> Self {
88 Self::new("cuDSS", files(&["libcudss.so.0"], &["cudss64_0.dll"]))
89 }
90
91 #[must_use]
92 pub const fn cufft() -> Self {
93 Self::new("cuFFT", files(&["libcufft.so.12"], &["cufft64_12.dll"]))
94 }
95
96 #[must_use]
98 pub const fn cufile() -> Self {
99 Self::new("cuFile", files(&["libcufile.so.0"], &[]))
100 }
101
102 #[must_use]
104 pub const fn cupti() -> Self {
105 Self::new("CUPTI", files(&["libcupti.so.13"], &[]))
106 }
107
108 #[must_use]
109 pub const fn curand() -> Self {
110 Self::new("cuRAND", files(&["libcurand.so.10"], &["curand64_10.dll"]))
111 }
112
113 #[must_use]
114 pub const fn cusolver() -> Self {
115 Self::new(
116 "cuSOLVER",
117 files(&["libcusolver.so.12"], &["cusolver64_12.dll"]),
118 )
119 }
120
121 #[must_use]
122 pub const fn cusparse() -> Self {
123 Self::new(
124 "cuSPARSE",
125 files(&["libcusparse.so.12"], &["cusparse64_12.dll"]),
126 )
127 }
128
129 #[must_use]
130 pub const fn cutensor() -> Self {
131 Self::new("cuTENSOR", files(&["libcutensor.so.2"], &["cutensor.dll"]))
132 }
133
134 #[must_use]
135 pub const fn cutensor_mg() -> Self {
136 Self::new(
137 "cuTENSORMg",
138 files(&["libcutensorMg.so.2"], &["cutensorMg.dll"]),
139 )
140 }
141
142 #[must_use]
144 pub const fn cutensor_mp() -> Self {
145 Self::new("cuTENSORMp", files(&["libcutensorMp.so.2"], &[]))
146 }
147
148 #[must_use]
150 pub const fn nccl() -> Self {
151 Self::new("NCCL", files(&["libnccl.so.2"], &[]))
152 }
153
154 #[must_use]
156 pub const fn npp() -> Self {
157 Self::new(
158 "NPP",
159 files(
160 &[
161 "libnppc.so.13",
162 "libnppial.so.13",
163 "libnppicc.so.13",
164 "libnppidei.so.13",
165 "libnppif.so.13",
166 "libnppig.so.13",
167 "libnppim.so.13",
168 "libnppist.so.13",
169 "libnppisu.so.13",
170 "libnppitc.so.13",
171 "libnpps.so.13",
172 ],
173 &[
174 "nppc64_13.dll",
175 "nppial64_13.dll",
176 "nppicc64_13.dll",
177 "nppidei64_13.dll",
178 "nppif64_13.dll",
179 "nppig64_13.dll",
180 "nppim64_13.dll",
181 "nppist64_13.dll",
182 "nppisu64_13.dll",
183 "nppitc64_13.dll",
184 "npps64_13.dll",
185 ],
186 ),
187 )
188 }
189
190 #[must_use]
191 pub const fn nvcomp() -> Self {
192 Self::new("nvCOMP", files(&["libnvcomp.so.6"], &["nvcomp64_6.dll"]))
193 }
194
195 #[must_use]
196 pub const fn nvimagecodec() -> Self {
197 Self::new(
198 "nvImageCodec",
199 files(&["libnvimgcodec.so.0"], &["nvimgcodec_0.dll"]),
200 )
201 }
202
203 #[must_use]
204 pub const fn nvjpeg() -> Self {
205 Self::new("nvJPEG", files(&["libnvjpeg.so.13"], &["nvjpeg64_13.dll"]))
206 }
207
208 #[must_use]
209 pub const fn nvjpeg2k() -> Self {
210 Self::new(
211 "nvJPEG2000",
212 files(&["libnvjpeg2k.so.0"], &["nvjpeg2k_0.dll"]),
213 )
214 }
215
216 #[must_use]
217 pub const fn nvtiff() -> Self {
218 Self::new("nvTIFF", files(&["libnvtiff.so.0"], &["nvtiff_0.dll"]))
219 }
220}