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

Add op paddle.device.cuda.get_device_name and paddle.device.cuda.get_device_capability. #35672

Merged
merged 28 commits into from
Sep 29, 2021

Conversation

liyagit21
Copy link
Contributor

@liyagit21 liyagit21 commented Sep 12, 2021

PR types

Others

PR changes

OPs

Describe

Add op paddle.device.cuda.get_device_name and paddle.device.cuda.get_device_capability.
截屏2021-09-28 下午2 54 26
截屏2021-09-28 下午4 46 10
截屏2021-09-28 下午2 54 09
截屏2021-09-28 下午4 45 50

@paddle-bot-old
Copy link

Thanks for your contribution!
Please wait for the result of CI firstly. See Paddle CI Manual for details.

PADDLE_ENFORCE_GT(id, -1, platform::errors::InvalidArgument(
"Device id must be greater than -1, "
"but received id is: %d. ",
id));
Copy link
Collaborator

Choose a reason for hiding this comment

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

I wonder whether hipGetDeviceProperties and cudaGetDeviceProperties can accept the case id = -1. In my experience, they cannot. So I prefer GetCUDADeviceName should not accept the case id = -1. Users should deal with the case id = -1 outside this function.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Sorry for my wrong understanding. PADDLE_ENFORCE_GT(id, -1) is right here. But I prefer PADDLE_ENFORCE_GE(id, 0) instead. The latter would be more clear.

python/paddle/device/cuda/__init__.py Outdated Show resolved Hide resolved
python/paddle/device/cuda/__init__.py Outdated Show resolved Hide resolved
python/paddle/device/cuda/__init__.py Outdated Show resolved Hide resolved
python/paddle/device/cuda/__init__.py Outdated Show resolved Hide resolved
@@ -229,6 +231,7 @@ def get_device_properties(device=None):
# required: gpu

import paddle

Copy link
Collaborator

Choose a reason for hiding this comment

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

NIT. Why change this?

@liyagit21 liyagit21 changed the title Add op paddle.device.cuda.get_device_name Add op paddle.device.cuda.get_device_name and paddle.device.cuda.get_device_capability. Sep 28, 2021
sneaxiy
sneaxiy previously approved these changes Sep 28, 2021
Copy link
Collaborator

@sneaxiy sneaxiy left a comment

Choose a reason for hiding this comment

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

LGTM.

Copy link
Collaborator

@jiangjiajun jiangjiajun left a comment

Choose a reason for hiding this comment

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

LGTM

@sneaxiy sneaxiy merged commit f703558 into PaddlePaddle:develop Sep 29, 2021
@liyagit21 liyagit21 deleted the get_device_name branch September 29, 2021 03:17
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

Successfully merging this pull request may close these issues.

5 participants