Skip to content

Commit 7847d57

Browse files
Sergey TsimferSergey Tsimfer
authored andcommitted
Update to new cuda
1 parent 4a9199b commit 7847d57

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

nbtools/nbstat/resource_inspector.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,10 @@ def get_device_table(self, formatter=None, window=20):
7676
device_table, device_process_table = ResourceTable(), ResourceTable()
7777

7878
for device_id, handle in self.device_handles.items():
79+
device_name = nvidia_smi.nvmlDeviceGetName(handle)
80+
device_name = device_name.decode() if isinstance(device_name, bytes) else device_name
7981
common_info = {Resource.DEVICE_ID : device_id,
80-
Resource.DEVICE_NAME : nvidia_smi.nvmlDeviceGetName(handle).decode()}
82+
Resource.DEVICE_NAME : device_name}
8183

8284
# Inseparable device information like memory, temperature, power, etc. Request it only if needed
8385
if (formatter.get(Resource.DEVICE_UTIL, False) or
@@ -566,8 +568,14 @@ def add_supheader(self, lines, terminal, interval=None, underline=True, bold=Tru
566568
""" Add a supheader with info about current time, driver and CUDA versions. """
567569
timestamp = time.strftime('%Y-%m-%d %H:%M:%S')
568570
interval_info = f'Interval: {interval:2.1f}s' if interval is not None else ''
569-
driver_version = '.'.join(nvidia_smi.nvmlSystemGetDriverVersion().decode().split('.')[:-1])
570-
cuda_version = nvidia_smi.nvmlSystemGetNVMLVersion().decode()[:4]
571+
572+
driver_version = nvidia_smi.nvmlSystemGetDriverVersion()
573+
driver_version = driver_version.decode() if isinstance(driver_version, bytes) else driver_version
574+
driver_version = '.'.join(driver_version.split('.')[:-1])
575+
576+
cuda_version = nvidia_smi.nvmlSystemGetNVMLVersion()
577+
cuda_version = cuda_version.decode() if isinstance(cuda_version, bytes) else cuda_version
578+
cuda_version = cuda_version[:4]
571579

572580
parts = [
573581
timestamp,

0 commit comments

Comments
 (0)