Commit 8eebf5f6 by Tianqi Chen Committed by GitHub

[RUNTIME] Fault tolerant vulkan init error (#1107)

parent dc62760e
......@@ -661,13 +661,18 @@ void VulkanWorkspace::Init() {
std::lock_guard<std::mutex> lock(this->mu);
if (initialized_) return;
initialized_ = true;
instance_ = CreateInstance();
context_ = GetContext(instance_);
LOG(INFO) << "Initialzie Vulkan with " << context_.size() << " devices..";
for (size_t i = 0; i < context_.size(); ++i) {
LOG(INFO) << "vulkan(" << i
<< ")=\'" << context_[i].phy_device_prop.deviceName
<< "\' phy_dev_id=" << context_[i].phy_device;
try {
instance_ = CreateInstance();
context_ = GetContext(instance_);
LOG(INFO) << "Initialzie Vulkan with " << context_.size() << " devices..";
for (size_t i = 0; i < context_.size(); ++i) {
LOG(INFO) << "vulkan(" << i
<< ")=\'" << context_[i].phy_device_prop.deviceName
<< "\' phy_dev_id=" << context_[i].phy_device;
}
} catch (const dmlc::Error& err) {
LOG(INFO) << "Cannot initialize vulkan: " << err.what() << "\n"
<< "You can still compile vulkan module but cannot run locally";
}
}
......
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