Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When failing on NVMLError exception, bug in handling #37

Open
qwertAsc opened this issue May 20, 2021 · 5 comments
Open

When failing on NVMLError exception, bug in handling #37

qwertAsc opened this issue May 20, 2021 · 5 comments

Comments

@qwertAsc
Copy link

When failing on this line in smi.py with exception
nvmlDeviceGetSupportedMemoryClocks(handle)

following line fails with this error - "TypeError: list indices must be integers or slices, not str"
except NVMLError as err:
supportedClocks['Error'] = nvidia_smi.__handleError(err)

because supportedClocks defines as list

@rjzamora
Copy link
Collaborator

Thanks for raising an issue @qwertAsc - Can you provide a full reproducer here? How are you getting the handle?

For example, here is how I would expect someone to use nvmlDeviceGetSupportedMemoryClocks:

In [1]: import pynvml

In [2]: pynvml.nvmlInit()

In [3]: handle = pynvml.nvmlDeviceGetHandleByIndex(0)

In [4]: pynvml.nvmlDeviceGetSupportedMemoryClocks(handle)
Out[4]: [7001, 6501, 5001, 810, 405]

@qwertAsc
Copy link
Author

Thanks @rjzamora
I am just calling the following
from pynvml.smi import nvidia_smi
nvidia_smi.getInstance().DeviceQuery()
and receiving this error
supportedClocks['Error'] = nvidia_smi.__handleError(err)
TypeError: list indices must be integers or slices, not str

when runnning your example I get the following
pynvml.nvmlDeviceGetSupportedMemoryClocks(handle)
File "/home/.../env/lib/python3.6/site-packages/pynvml/nvml.py", line 1135, in nvmlDeviceGetSupportedMemoryClocks
raise NVMLError(ret)
pynvml.nvml.NVMLError_NotSupported: Not Supported

@rjzamora
Copy link
Collaborator

Thanks for the info! Are you passing a query string to DeviceQuery (e.g. nvidia_smi.getInstance().DeviceQuery('memory.free') ?)

Also, can you specify the version of CUDA you are using and wheter you happen to be using MIG support?

@qwertAsc
Copy link
Author

No, i am not passing any query string
I am using CUDA version 11.0
Also I am less bothered that the clock query fails, and more that except doesn't catch the error
(Not sure regarding MIG)

@danielbraun89
Copy link

have the same issue while running nvidia_smi.getInstance().DeviceQuery()

supportedClocks['Error'] = nvidia_smi.__handleError(err)
TypeError: list indices must be integers or slices, not str

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants