Skip to content

[SYCL][CUDA] Avoid failure when no devices available #1210

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

Closed
wants to merge 1 commit into from

Conversation

Ruyk
Copy link
Contributor

@Ruyk Ruyk commented Feb 27, 2020

cuInit fails when there are no CUDA devices, but this
is not an error for the SYCL runtime.
This patch converts the error into a platform with no devices.

`cuInit` fails when there are no CUDA devices, but this
is not an error for the SYCL runtime.
This patch converts the error into a platform with no devices.

Signed-off-by: Ruyman Reyes <ruyman@codeplay.com>
@Ruyk Ruyk force-pushed the avoid-abort-when-no-device branch from ff4606c to bca4d9d Compare February 27, 2020 21:18
@fwyzard
Copy link
Contributor

fwyzard commented Feb 27, 2020

According to the latest SYCL specification (4.6.2 Platform clas)

A SYCL platform is also associated with one or more SYCL devices

So, would it make more sense not to return the platform at all, rather than a platform without any device ?

@fwyzard
Copy link
Contributor

fwyzard commented Feb 28, 2020

See #1212 for an alternative fix.

@Ruyk
Copy link
Contributor Author

Ruyk commented Feb 28, 2020

According to the latest SYCL specification (4.6.2 Platform clas)

A SYCL platform is also associated with one or more SYCL devices

So, would it make more sense not to return the platform at all, rather than a platform without any device ?

That may change in the future with the backend model, since you may want to differentiate when a backend is active but there are no devices (hence, empty platform) from when the backend is not active (so, no platform from that backend appears).
But, this is a SYCL 1.2.1 implementation so you are correct, your fix in #1212 is better, thanks!

@Ruyk Ruyk closed this Feb 28, 2020
@Ruyk Ruyk deleted the avoid-abort-when-no-device branch February 28, 2020 08:35
@bader bader added the cuda CUDA back-end label Feb 28, 2020
@keryell
Copy link
Contributor

keryell commented Feb 28, 2020

That may change in the future with the backend model, since you may want to differentiate when a backend is active but there are no devices (hence, empty platform) from when the backend is not active (so, no platform from that backend appears).

Good idea. Keep track of this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cuda CUDA back-end
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants