Skip to content
Snippets Groups Projects
Commit 32ebdde2 authored by lixiaoquan's avatar lixiaoquan Committed by Tianqi Chen
Browse files

[OPENCL] Make use of cpu device when gpu device doesn't exist. (#2076)

parent dd5722d3
No related branches found
No related tags found
No related merge requests found
......@@ -245,6 +245,10 @@ void OpenCLWorkspace::Init(const std::string& type_key, const std::string& devic
continue;
}
std::vector<cl_device_id> devices_matched = cl::GetDeviceIDs(platform_id, device_type);
if ((devices_matched.size() == 0) && (device_type == "gpu")) {
LOG(WARNING) << "Using CPU OpenCL device";
devices_matched = cl::GetDeviceIDs(platform_id, "cpu");
}
if (devices_matched.size() > 0) {
this->type_key = type_key;
this->platform_id = platform_id;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment