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

Commit 276722c

Browse files
authoredFeb 19, 2019
Merge pull request #1843 from smurfy/fix-1841
Fix crash issue on latest nvidia windows drivers
2 parents 1a5b0d7 + 446e67a commit 276722c

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed
 

‎libhwmon/wrapnvml.cpp

+14-8
Original file line numberDiff line numberDiff line change
@@ -179,19 +179,25 @@ wrap_nvml_handle* wrap_nvml_create()
179179
#if ETH_ETHASHCL
180180
// Get and count OpenCL devices.
181181
std::vector<cl::Platform> platforms;
182-
cl::Platform::get(&platforms);
183182
std::vector<cl::Device> platdevs;
184-
for (unsigned p = 0; p < platforms.size(); p++)
183+
try
185184
{
186-
std::string platformName = platforms[p].getInfo<CL_PLATFORM_NAME>();
187-
if (platformName == "NVIDIA CUDA")
185+
cl::Platform::get(&platforms);
186+
for (unsigned p = 0; p < platforms.size(); p++)
188187
{
189-
platforms[p].getDevices(CL_DEVICE_TYPE_GPU | CL_DEVICE_TYPE_ACCELERATOR, &platdevs);
190-
nvmlh->opencl_gpucount = platdevs.size();
191-
break;
188+
std::string platformName = platforms[p].getInfo<CL_PLATFORM_NAME>();
189+
if (platformName == "NVIDIA CUDA")
190+
{
191+
platforms[p].getDevices(CL_DEVICE_TYPE_GPU | CL_DEVICE_TYPE_ACCELERATOR, &platdevs);
192+
nvmlh->opencl_gpucount = platdevs.size();
193+
break;
194+
}
192195
}
193196
}
194-
197+
catch (cl::Error)
198+
{
199+
}
200+
195201
nvmlh->opencl_nvml_device_id = (int*)calloc(nvmlh->opencl_gpucount, sizeof(int));
196202

197203
// Map NVML to opencl devices

0 commit comments

Comments
 (0)
This repository has been archived.