Skip to content
This repository was archived by the owner on Apr 24, 2022. It is now read-only.

Fix crash issue on latest nvidia windows drivers #1843

Merged
merged 1 commit into from
Feb 19, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 14 additions & 8 deletions libhwmon/wrapnvml.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -179,19 +179,25 @@ wrap_nvml_handle* wrap_nvml_create()
#if ETH_ETHASHCL
// Get and count OpenCL devices.
std::vector<cl::Platform> platforms;
cl::Platform::get(&platforms);
std::vector<cl::Device> platdevs;
for (unsigned p = 0; p < platforms.size(); p++)
try
{
std::string platformName = platforms[p].getInfo<CL_PLATFORM_NAME>();
if (platformName == "NVIDIA CUDA")
cl::Platform::get(&platforms);
for (unsigned p = 0; p < platforms.size(); p++)
{
platforms[p].getDevices(CL_DEVICE_TYPE_GPU | CL_DEVICE_TYPE_ACCELERATOR, &platdevs);
nvmlh->opencl_gpucount = platdevs.size();
break;
std::string platformName = platforms[p].getInfo<CL_PLATFORM_NAME>();
if (platformName == "NVIDIA CUDA")
{
platforms[p].getDevices(CL_DEVICE_TYPE_GPU | CL_DEVICE_TYPE_ACCELERATOR, &platdevs);
nvmlh->opencl_gpucount = platdevs.size();
break;
}
}
}

catch (cl::Error)
{
}

nvmlh->opencl_nvml_device_id = (int*)calloc(nvmlh->opencl_gpucount, sizeof(int));

// Map NVML to opencl devices
Expand Down