Skip to content

Correct the logic to return device count. - #623

Merged
oleksandr-pavlyk merged 4 commits into
IntelPython:masterfrom
diptorupd:fix/issue_601
Oct 10, 2021
Merged

oleksandr-pavlyk merged 4 commits into
IntelPython:masterfrom
diptorupd:fix/issue_601

Conversation

@diptorupd

Copy link
Copy Markdown
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
Copy Markdown
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

coveralls commented Oct 6, 2021 •

Copy link
Copy Markdown
Collaborator

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
Copy Markdown
Contributor

Is the PR ready to graduate out of draft status?

@diptorupd

Copy link
Copy Markdown
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

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

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