@@ -23,11 +23,8 @@ use winapi::um::{
23
23
use winapi:: um:: winbase:: { INFINITE , WAIT_FAILED } ;
24
24
25
25
static REDIRECT_DLL : & ' static str = "zluda_redirect.dll" ;
26
- static CUBLAS_DLL : & ' static str = "cublas.dll" ;
27
- static CUDNN_DLL : & ' static str = "cudnn.dll" ;
28
- static CUFFT_DLL : & ' static str = "cufft.dll" ;
29
- static CUSPARSE_DLL : & ' static str = "cusparse.dll" ;
30
26
static NCCL_DLL : & ' static str = "nccl.dll" ;
27
+ static NVRTC_DLL : & ' static str = "nvrtc.dll" ;
31
28
static NVCUDA_DLL : & ' static str = "nvcuda.dll" ;
32
29
static NVML_DLL : & ' static str = "nvml.dll" ;
33
30
static NVAPI_DLL : & ' static str = "nvapi64.dll" ;
@@ -38,26 +35,14 @@ include!("../../zluda_redirect/src/payload_guid.rs");
38
35
#[ derive( FromArgs ) ]
39
36
/// Launch application with custom CUDA libraries
40
37
struct ProgramArguments {
41
- /// DLL to be injected instead of system cublas.dll. If not provided {0}, will use cublas.dll from its own directory
42
- #[ argh( option) ]
43
- cublas : Option < PathBuf > ,
44
-
45
- /// DLL to be injected instead of system cudnn.dll. If not provided {0}, will use cudnn.dll from its own directory
46
- #[ argh( option) ]
47
- cudnn : Option < PathBuf > ,
48
-
49
- /// DLL to be injected instead of system cufft.dll. If not provided {0}, will use cufft.dll from its own directory
50
- #[ argh( option) ]
51
- cufft : Option < PathBuf > ,
52
-
53
- /// DLL to be injected instead of system cusparse.dll. If not provided {0}, will use cusparse.dll from its own directory
54
- #[ argh( option) ]
55
- cusparse : Option < PathBuf > ,
56
-
57
38
/// DLL to be injected instead of system nccl.dll. If not provided {0}, will use nccl.dll from its own directory
58
39
#[ argh( option) ]
59
40
nccl : Option < PathBuf > ,
60
41
42
+ /// DLL to be injected instead of system nvrtc.dll. If not provided {0}, will use nvrtc.dll from its own directory
43
+ #[ argh( option) ]
44
+ nvrtc : Option < PathBuf > ,
45
+
61
46
/// DLL to be injected instead of system nvcuda.dll. If not provided {0}, will use nvcuda.dll from its own directory
62
47
#[ argh( option) ]
63
48
nvcuda : Option < PathBuf > ,
@@ -90,11 +75,8 @@ pub fn main_impl() -> Result<(), Box<dyn Error>> {
90
75
let mut startup_info = unsafe { mem:: zeroed :: < detours_sys:: _STARTUPINFOW > ( ) } ;
91
76
let mut proc_info = unsafe { mem:: zeroed :: < detours_sys:: _PROCESS_INFORMATION > ( ) } ;
92
77
let mut dlls_to_inject = vec ! [
93
- environment. cublas_path_zero_terminated. as_ptr( ) as _,
94
- //environment.cudnn_path_zero_terminated.as_ptr() as _,
95
- environment. cufft_path_zero_terminated. as_ptr( ) as _,
96
- environment. cusparse_path_zero_terminated. as_ptr( ) as _,
97
78
environment. nccl_path_zero_terminated. as_ptr( ) as _,
79
+ environment. nvrtc_path_zero_terminated. as_ptr( ) as _,
98
80
environment. nvcuda_path_zero_terminated. as_ptr( ) as _,
99
81
environment. nvml_path_zero_terminated. as_ptr( ) as * const i8 ,
100
82
environment. redirect_path_zero_terminated. as_ptr( ) as _,
@@ -176,11 +158,8 @@ pub fn main_impl() -> Result<(), Box<dyn Error>> {
176
158
}
177
159
178
160
struct NormalizedArguments {
179
- cublas_path : PathBuf ,
180
- cudnn_path : PathBuf ,
181
- cufft_path : PathBuf ,
182
- cusparse_path : PathBuf ,
183
161
nccl_path : PathBuf ,
162
+ nvrtc_path : PathBuf ,
184
163
nvcuda_path : PathBuf ,
185
164
nvml_path : PathBuf ,
186
165
nvapi_path : Option < PathBuf > ,
@@ -192,16 +171,10 @@ struct NormalizedArguments {
192
171
impl NormalizedArguments {
193
172
fn new ( prog_args : ProgramArguments ) -> Result < Self , Box < dyn Error > > {
194
173
let current_exe = env:: current_exe ( ) ?;
195
- let cublas_path =
196
- Self :: get_absolute_path_or_default ( & current_exe, prog_args. cublas , CUBLAS_DLL ) ?;
197
- let cudnn_path =
198
- Self :: get_absolute_path_or_default ( & current_exe, prog_args. cudnn , CUDNN_DLL ) ?;
199
- let cufft_path =
200
- Self :: get_absolute_path_or_default ( & current_exe, prog_args. cufft , CUFFT_DLL ) ?;
201
- let cusparse_path =
202
- Self :: get_absolute_path_or_default ( & current_exe, prog_args. cusparse , CUSPARSE_DLL ) ?;
203
174
let nccl_path =
204
175
Self :: get_absolute_path_or_default ( & current_exe, prog_args. nccl , NCCL_DLL ) ?;
176
+ let nvrtc_path =
177
+ Self :: get_absolute_path_or_default ( & current_exe, prog_args. nvrtc , NVRTC_DLL ) ?;
205
178
let nvcuda_path =
206
179
Self :: get_absolute_path_or_default ( & current_exe, prog_args. nvcuda , NVCUDA_DLL ) ?;
207
180
let nvml_path = Self :: get_absolute_path_or_default ( & current_exe, prog_args. nvml , NVML_DLL ) ?;
@@ -212,11 +185,8 @@ impl NormalizedArguments {
212
185
let mut redirect_path = current_exe. parent ( ) . unwrap ( ) . to_path_buf ( ) ;
213
186
redirect_path. push ( REDIRECT_DLL ) ;
214
187
Ok ( Self {
215
- cublas_path,
216
- cudnn_path,
217
- cufft_path,
218
- cusparse_path,
219
188
nccl_path,
189
+ nvrtc_path,
220
190
nvcuda_path,
221
191
nvml_path,
222
192
nvapi_path,
@@ -274,11 +244,8 @@ impl NormalizedArguments {
274
244
}
275
245
276
246
struct Environment {
277
- cublas_path_zero_terminated : String ,
278
- cudnn_path_zero_terminated : String ,
279
- cufft_path_zero_terminated : String ,
280
- cusparse_path_zero_terminated : String ,
281
247
nccl_path_zero_terminated : String ,
248
+ nvrtc_path_zero_terminated : String ,
282
249
nvcuda_path_zero_terminated : String ,
283
250
nvml_path_zero_terminated : String ,
284
251
nvapi_path_zero_terminated : Option < String > ,
@@ -294,31 +261,16 @@ struct Environment {
294
261
impl Environment {
295
262
fn setup ( args : NormalizedArguments ) -> io:: Result < Self > {
296
263
let _temp_dir = TempDir :: new ( ) ?;
297
- let cublas_path_zero_terminated = Self :: zero_terminate ( Self :: copy_to_correct_name (
298
- args. cublas_path ,
299
- & _temp_dir,
300
- CUBLAS_DLL ,
301
- ) ?) ;
302
- let cudnn_path_zero_terminated = Self :: zero_terminate ( Self :: copy_to_correct_name (
303
- args. cudnn_path ,
304
- & _temp_dir,
305
- CUDNN_DLL ,
306
- ) ?) ;
307
- let cufft_path_zero_terminated = Self :: zero_terminate ( Self :: copy_to_correct_name (
308
- args. cufft_path ,
309
- & _temp_dir,
310
- CUFFT_DLL ,
311
- ) ?) ;
312
- let cusparse_path_zero_terminated = Self :: zero_terminate ( Self :: copy_to_correct_name (
313
- args. cusparse_path ,
314
- & _temp_dir,
315
- CUSPARSE_DLL ,
316
- ) ?) ;
317
264
let nccl_path_zero_terminated = Self :: zero_terminate ( Self :: copy_to_correct_name (
318
265
args. nccl_path ,
319
266
& _temp_dir,
320
267
NCCL_DLL ,
321
268
) ?) ;
269
+ let nvrtc_path_zero_terminated = Self :: zero_terminate ( Self :: copy_to_correct_name (
270
+ args. nvrtc_path ,
271
+ & _temp_dir,
272
+ NVRTC_DLL ,
273
+ ) ?) ;
322
274
let nvcuda_path_zero_terminated = Self :: zero_terminate ( Self :: copy_to_correct_name (
323
275
args. nvcuda_path ,
324
276
& _temp_dir,
@@ -349,11 +301,8 @@ impl Environment {
349
301
. transpose ( ) ?;
350
302
let redirect_path_zero_terminated = Self :: zero_terminate ( args. redirect_path ) ;
351
303
Ok ( Self {
352
- cublas_path_zero_terminated,
353
- cudnn_path_zero_terminated,
354
- cufft_path_zero_terminated,
355
- cusparse_path_zero_terminated,
356
304
nccl_path_zero_terminated,
305
+ nvrtc_path_zero_terminated,
357
306
nvcuda_path_zero_terminated,
358
307
nvml_path_zero_terminated,
359
308
nvapi_path_zero_terminated,
0 commit comments