File tree Expand file tree Collapse file tree 1 file changed +23
-10
lines changed
crates/worker/src/checks/hardware Expand file tree Collapse file tree 1 file changed +23
-10
lines changed Original file line number Diff line number Diff line change @@ -47,18 +47,31 @@ fn get_gpu_status() -> Vec<GpuDevice> {
4747
4848 // Initialize NVML if not already initialized
4949 if nvml_guard. is_none ( ) {
50- match Nvml :: builder ( )
51- . lib_path ( std:: ffi:: OsStr :: new (
52- "/usr/lib/x86_64-linux-gnu/libnvidia-ml.so.1" ,
53- ) )
54- . init ( )
55- {
56- Ok ( nvml) => * nvml_guard = Some ( nvml) ,
57- Err ( e) => {
58- Console :: user_error ( & format ! ( "Failed to initialize NVML: {e}" ) ) ;
59- return vec ! [ ] ;
50+ // Try to load the NVIDIA management library dynamically
51+ let lib_paths = [
52+ "libnvidia-ml.so.1" , // Standard Linux path
53+ "/usr/lib/x86_64-linux-gnu/libnvidia-ml.so.1" , // Explicit path as fallback
54+ "/usr/lib/libnvidia-ml.so.1" , // CUDA installation path
55+ ] ;
56+
57+ let mut success = false ;
58+ for path in lib_paths {
59+ match Nvml :: builder ( ) . lib_path ( std:: ffi:: OsStr :: new ( path) ) . init ( ) {
60+ Ok ( nvml) => {
61+ * nvml_guard = Some ( nvml) ;
62+ success = true ;
63+ break ;
64+ }
65+ Err ( _) => continue ,
6066 }
6167 }
68+
69+ if !success {
70+ Console :: user_error (
71+ "Failed to initialize NVML: could not load NVIDIA management library (libnvidia-ml.so.1)" ,
72+ ) ;
73+ return vec ! [ ] ;
74+ }
6275 }
6376
6477 let nvml = nvml_guard. as_ref ( ) . unwrap ( ) ;
You can’t perform that action at this time.
0 commit comments