From 06480f57ea92e138cb8d30fb236ede3c570c8977 Mon Sep 17 00:00:00 2001 From: tqchen Date: Thu, 29 Mar 2018 20:07:24 -0700 Subject: [PATCH] temp fix opencl runtime for docker --- src/runtime/opencl/opencl_device_api.cc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/runtime/opencl/opencl_device_api.cc b/src/runtime/opencl/opencl_device_api.cc index 6341c9f4b83d..ae650cbd7b06 100644 --- a/src/runtime/opencl/opencl_device_api.cc +++ b/src/runtime/opencl/opencl_device_api.cc @@ -145,6 +145,11 @@ std::string GetDeviceInfo( } std::vector GetPlatformIDs() { + // Trigger CUDA initialziation when it exists + // on some NV platform opencl depends on CUDA to be loaded first + if (const PackedFunc* query = runtime::Registry::Get("_GetDeviceAttr")) { + (*query)(static_cast(kDLGPU), 0, static_cast(kExist)); + } cl_uint ret_size; cl_int code = clGetPlatformIDs(0, nullptr, &ret_size); std::vector ret;