File tree Expand file tree Collapse file tree 1 file changed +19
-4
lines changed
Expand file tree Collapse file tree 1 file changed +19
-4
lines changed Original file line number Diff line number Diff line change 1414_NV_OK = False
1515pynvml = None
1616if not (os .environ .get ('LLM_BENCH_SKIP_GPU' ) == '1' ):
17+ # prefer newer package name if available
1718 try :
18- import pynvml
19+ import nvidia_ml_py as nvml_pkg # type: ignore
1920 try :
20- pynvml .nvmlInit ()
21+ nvml_pkg .nvmlInit ()
22+ pynvml = nvml_pkg
2123 _NV_OK = True
2224 except Exception :
2325 _NV_OK = False
2426 except Exception :
25- pynvml = None # type: ignore
26- _NV_OK = False
27+ try :
28+ # suppress deprecation FutureWarning from pynvml package if present
29+ import warnings
30+ with warnings .catch_warnings ():
31+ warnings .simplefilter ('ignore' , FutureWarning )
32+ import pynvml as nvml_pkg # type: ignore
33+ try :
34+ nvml_pkg .nvmlInit ()
35+ pynvml = nvml_pkg
36+ _NV_OK = True
37+ except Exception :
38+ _NV_OK = False
39+ except Exception :
40+ pynvml = None # type: ignore
41+ _NV_OK = False
2742
2843
2944@dataclass
You can’t perform that action at this time.
0 commit comments