Skip to content

Add UUID to CUDA devices - #6700

Merged
sklam merged 2 commits into
numba:masterfrom
gmarkall:grm-get-uuid
Feb 16, 2021
Merged

sklam merged 2 commits into
numba:masterfrom
gmarkall:grm-get-uuid

Conversation

@gmarkall

@gmarkall gmarkall commented Feb 8, 2021

Copy link
Copy Markdown
Member

This PR 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).

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).
@berceanu

berceanu commented Feb 8, 2021 •

Copy link
Copy Markdown
# 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.py
Traceback (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

@gmarkall

gmarkall commented Feb 8, 2021

Copy link
Copy Markdown
Member Author

@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?

@berceanu

berceanu commented Feb 8, 2021

Copy link
Copy Markdown

Great success!

GPU-c55b3036-d54d-a885-7c6c-4238840c836e
GPU-618947d4-f719-3af8-6f9a-5ad6c10717d9

@gmarkall

gmarkall commented Feb 8, 2021

Copy link
Copy Markdown
Member Author

@berceanu Many thanks for testing!

Comment thread docs/source/cuda/device-management.rst Outdated

.. code-block:: python

dev = cuda.get_context().device

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From OOB discussion: this should be cuda.get_context().device

@stuartarchibald stuartarchibald left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding this, patch looks good.

@stuartarchibald stuartarchibald added 4 - Waiting on CI Review etc done, waiting for CI to finish Pending BuildFarm For PRs that have been reviewed but pending a push through our buildfarm and removed 3 - Ready for Review labels Feb 10, 2021
@gmarkall

Copy link
Copy Markdown
Member Author

@esc Could this have a buildfarm run please?

@esc

esc commented Feb 11, 2021

Copy link
Copy Markdown
Member

@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.

@esc

esc commented Feb 11, 2021

Copy link
Copy Markdown
Member

Now running as: numba_smoketest_cuda_yaml_12.

@esc

esc commented Feb 11, 2021

Copy link
Copy Markdown
Member

numba_smoketest_cuda_yaml_12 passed.

@esc esc added BuildFarm Passed For PRs that have been through the buildfarm and passed and removed Pending BuildFarm For PRs that have been reviewed but pending a push through our buildfarm labels Feb 11, 2021
@gmarkall gmarkall removed the 4 - Waiting on CI Review etc done, waiting for CI to finish label Feb 11, 2021
@gmarkall

Copy link
Copy Markdown
Member Author

Many thanks @esc!

@stuartarchibald stuartarchibald added the 5 - Ready to merge Review and testing done, is ready to merge label Feb 15, 2021
@sklam
sklam merged commit fdf463a into numba:master Feb 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

5 - Ready to merge Review and testing done, is ready to merge BuildFarm Passed For PRs that have been through the buildfarm and passed CUDA CUDA related issue/PR Effort - short Short size effort needed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants