Skip to content

Correct the logic to return device count.#623

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

Correct the logic to return device count.#623
oleksandr-pavlyk merged 4 commits intoIntelPython: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.

Comment thread dpctl-capi/source/dpctl_sycl_device_manager.cpp Outdated
@coveralls
Copy link
Copy Markdown
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.

Comment thread dpctl-capi/source/dpctl_sycl_device_manager.cpp Outdated
@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
Copy link
Copy Markdown
Contributor

@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