Skip to content

Commit

Permalink
Set bar1_total = 0 if it can't be determined
Browse files Browse the repository at this point in the history
  • Loading branch information
pentschev authored Aug 24, 2023
1 parent 5102d44 commit c9414fc
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions ucp/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,9 @@ def _is_mig_device(handle):
try:
bar1_total = pynvml.nvmlDeviceGetBAR1MemoryInfo(handle).bar1Total
except pynvml.nvml.NVMLError_NotSupported:
# Bar1 access not supported on this device. Skip
continue
# Bar1 access not supported on this device, set it to
# zero (always lower than device memory).
bar1_total = 0

total_memory = pynvml.nvmlDeviceGetMemoryInfo(handle).total
if total_memory <= bar1_total:
Expand Down

0 comments on commit c9414fc

Please sign in to comment.