Commit 32ebdde2 by lixiaoquan Committed by Tianqi Chen

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

parent dd5722d3
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment