Commit 9cf1b620 by MORITA Kazutaka Committed by Tianqi Chen

[RUNTIME][OPENCL] set type_key even when platform is not available (#2741)

parent 21e8dfac
......@@ -237,6 +237,7 @@ void OpenCLWorkspace::Init(const std::string& type_key, const std::string& devic
std::lock_guard<std::mutex> lock(this->mu);
if (initialized_) return;
if (context != nullptr) return;
this->type_key = type_key;
// matched platforms
std::vector<cl_platform_id> platform_ids = cl::GetPlatformIDs();
if (platform_ids.size() == 0) {
......@@ -254,7 +255,6 @@ void OpenCLWorkspace::Init(const std::string& type_key, const std::string& devic
devices_matched = cl::GetDeviceIDs(platform_id, "cpu");
}
if (devices_matched.size() > 0) {
this->type_key = type_key;
this->platform_id = platform_id;
this->platform_name = cl::GetPlatformInfo(platform_id, CL_PLATFORM_NAME);
this->device_type = device_type;
......
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