-
Notifications
You must be signed in to change notification settings - Fork 548
Ensure query and info functions do not fail if there is no device #2678
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you sure we can guarantee noexcept
for get***
functions as they seem to use std::string
extensively and it's constructor is not noexcept
and it can throw ?
Update: @umar456 My bad, I misunderstood expect
that it is an absolute guarantee that a function wouldn't fail. A non-throwing function can definitely call other throwing functions if the logic cannot handle such a failure such as alloc
failures in which case terminate will be called and we are fine for those cases.
AF_TRACE("Found {} CUDA devices", nDevices); | ||
if (nDevices == 0) { | ||
AF_ERROR("No CUDA capable devices found", AF_ERR_DRIVER); | ||
return; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: return
valid and won't hurt, but we can remove it.
for (int i = 0; i < nDevices; i++) { | ||
cudaDevice_t dev; | ||
CUDA_CHECK(cudaGetDeviceProperties(&dev.prop, i)); | ||
if (dev.prop.major < getMinSupportedCompute(cudaMajorVer)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we do a similar check in setDevice
?
"ICD from your device vendor. You can use the clinfo utility " | ||
"to debug OpenCL installation issues.", | ||
AF_ERR_RUNTIME); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Surprising that we didn't have any error reporting when no platforms are found.
cc5d067
to
ab24400
Compare
Some of the info and query functions failed when called on a system with no OpenCL runtime or graphics drivers installed. These functions should be resilient to these situations and provide feed back to the user about possible next steps. The following functions are able to function even if there is not device or driver installed. af_info af_info_string af_get_device_count af_get_size_of af_get_backend_count af_get_version af_get_revision This also includes their respective C++ functions. Added unit tests.
Some of the info and query functions failed when called on a system
with no OpenCL runtime or graphics drivers installed. These functions
should be resilient to these situations and provide feed back to the
user about possible next steps. The following functions are able to
function even if there is not device or driver installed.
af_info
af_info_string
af_get_device_count
af_get_size_of
af_get_backend_count
af_get_version
af_get_revision
This also includes their respective C++ functions.
Added unit tests.