Commit db743028 by haolongzhangm Committed by Tianqi Chen

Compat for opencl mode between cpu mode and gpu mode (#655)

some host opencl runtime may at cpu mode, but remote

client opencl runtime at gpu mode, compat it
parent 7d620be4
......@@ -35,3 +35,4 @@ List of Contributors
- [Qiao Zhang](https://github.com/zhangqiaorjc)
- [Jian Weng](https://github.com/were)
- [Masahiro Masuda](https://github.com/masahi)
- [Haolong Zhang](https://github.com/haolongzhangm)
......@@ -197,8 +197,13 @@ void OpenCLWorkspace::Init() {
std::vector<cl_device_id> devices_matched =
cl::GetDeviceIDs(this->platform_id, "gpu");
if (devices_matched.size() == 0) {
LOG(WARNING) << "No OpenCL device any device matched given the options";
return;
LOG(WARNING) << "No OpenCL device any device matched given the options: gpu mode";
LOG(WARNING) << "Now try OpenCL cpu mode";
devices_matched = cl::GetDeviceIDs(this->platform_id, "cpu");
if (devices_matched.size() == 0) {
LOG(WARNING) << "No OpenCL device any device matched given the options: cpu mode";
return;
}
}
this->devices = devices_matched;
cl_int err_code;
......
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