This repository was archived by the owner on Apr 24, 2022. It is now read-only.
File tree 1 file changed +14
-8
lines changed
1 file changed +14
-8
lines changed Original file line number Diff line number Diff line change @@ -179,19 +179,25 @@ wrap_nvml_handle* wrap_nvml_create()
179
179
#if ETH_ETHASHCL
180
180
// Get and count OpenCL devices.
181
181
std::vector<cl::Platform> platforms;
182
- cl::Platform::get (&platforms);
183
182
std::vector<cl::Device> platdevs;
184
- for ( unsigned p = 0 ; p < platforms. size (); p++)
183
+ try
185
184
{
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++ )
188
187
{
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
+ }
192
195
}
193
196
}
194
-
197
+ catch (cl::Error)
198
+ {
199
+ }
200
+
195
201
nvmlh->opencl_nvml_device_id = (int *)calloc (nvmlh->opencl_gpucount , sizeof (int ));
196
202
197
203
// Map NVML to opencl devices
You can’t perform that action at this time.
0 commit comments