Repository navigation
Add UUID to CUDA devices - #6700
Conversation
This commit adds a `uuid` attribute to CUDA devices, which matches the UUID given by `nvidia-smi -L`. There are some minor grammatical fixes in the documentation, and removal of the redundant use `(object)` in class declaration in the simulator (which was used to declare the classes as new-style in Python 2).
# conda 4.9.2
$ conda config --add channels numba
$ conda create -n numbaenv python=3.8 llvmlite numpy scipy jinja2 cffi
$ conda activate numbaenv
$ git clone git@github.com:gmarkall/numba.git
$ cd numba
$ git checkout grm-get-uuid
$ python setup.py build_ext --inplace# test_uuid.py
from numba import cuda
with cuda.gpus[0]:
dev = cuda.get_current_device()
print(dev.get_uuid())
with cuda.gpus[1]:
dev = cuda.get_current_device()
print(dev.get_uuid())$ python test_uuid.pyTraceback (most recent call last):
File "/data/storage/berceanu/Development/numba/numba/cuda/cudadrv/driver.py", line 505, in __getattr__
code = DEVICE_ATTRIBUTES[attr]
KeyError: 'get_uuid'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "test_uuid.py", line 5, in <module>
print(dev.get_uuid())
File "/data/storage/berceanu/Development/numba/numba/cuda/cudadrv/driver.py", line 507, in __getattr__
raise AttributeError(attr)
AttributeError: get_uuid |
|
@berceanu Many thanks for testing out the PR! Since I provided the initial patch in gitter, I decided that the UUID should be obtained from an attribute rather than a method - so for this PR, the following should work: # test_uuid.py
from numba import cuda
with cuda.gpus[0]:
dev = cuda.get_current_device()
print(dev.uuid)
with cuda.gpus[1]:
dev = cuda.get_current_device()
print(dev.uuid)Could you please try this and let me know how it goes? |
|
Great success! |
|
@berceanu Many thanks for testing! |
|
|
||
| .. code-block:: python | ||
|
|
||
| dev = cuda.get_context().device |
There was a problem hiding this comment.
From OOB discussion: this should be cuda.get_context().device
stuartarchibald
left a comment
There was a problem hiding this comment.
Thanks for adding this, patch looks good.
|
@esc Could this have a buildfarm run please? |
|
@gmarkall I have added it to my queue of things to launch. The farm is still occupied at present building the merged from last night, due to some hiccups with the windows workers. |
|
Now running as: |
|
|
|
Many thanks @esc! |
This PR adds a
uuidattribute to CUDA devices, which matches the UUID given bynvidia-smi -L.There are some minor grammatical fixes in the documentation, and removal of the redundant use
(object)in class declaration in the simulator (which was used to declare the classes as new-style in Python 2).