diff --git a/src/runtime/opencl/opencl_device_api.cc b/src/runtime/opencl/opencl_device_api.cc index d5177fd9525afb22b1050626d3ef7902a44b4fd6..6bb0948bca9163d7c9d30736ae36898f2f81acea 100644 --- a/src/runtime/opencl/opencl_device_api.cc +++ b/src/runtime/opencl/opencl_device_api.cc @@ -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;