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

Correct the logic to return device count. #623

Merged
merged 4 commits into from
Oct 10, 2021

Conversation

diptorupd
Copy link
Contributor

We were not handling the cases where a device identifier
does not provide a backend or a device type. Changed the logic
to count all devices of a given type if no backend is specified.
Similarly, all devices in a backend are counted if no device
type is provided.

Fixes #601

@diptorupd diptorupd marked this pull request as draft October 6, 2021 02:17
@diptorupd
Copy link
Contributor Author

@oleksandr-pavlyk I found what the issue was. The existing logic returned zero for a device type if no backend was specified. I fixed that. However, we need some good way of testing it n both C API and Python.

DPCTLDeviceMgr_GetPositionInDevices also suffers from the same problem.

@coveralls
Copy link
Collaborator

coveralls commented Oct 6, 2021

Coverage Status

Coverage decreased (-0.005%) to 74.419% when pulling 32a2425 on diptorupd:fix/issue_601 into 711f868 on IntelPython:master.

@oleksandr-pavlyk
Copy link
Collaborator

Is the PR ready to graduate out of draft status?

@diptorupd
Copy link
Contributor Author

Is the PR ready to graduate out of draft status?

Need to add C API tests. Will do it later today.

We were not handling the cases where a device identifier
does not provide a backend or a device type. Changed the logic
to count all devices of a given type if no backend is specified.
Similarly, all devices in a backend are counted if no device
type is provided.
@diptorupd diptorupd marked this pull request as ready for review October 8, 2021 19:48
Copy link
Collaborator

@oleksandr-pavlyk oleksandr-pavlyk left a comment

Choose a reason for hiding this comment

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

Looks good to me, and CI agrees :)

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.

dpctl.has_gpu_devices() returns False even when GPU devices are present
3 participants