1
0
mirror of https://github.com/GOSTSec/sgminer synced 2025-01-11 07:17:58 +00:00

Cope with the highest opencl platform not having usable devices.

This commit is contained in:
Con Kolivas 2013-03-09 16:19:00 +11:00
parent 8c65897d1b
commit 87b62bde43

9
ocl.c
View File

@ -78,9 +78,10 @@ int clDevicesNum(void) {
char pbuff[256];
cl_uint numDevices;
cl_uint numPlatforms;
int most_devices = -1;
cl_platform_id *platforms;
cl_platform_id platform = NULL;
unsigned int most_devices = 0, i, mdplatform = 0;
unsigned int i, mdplatform = 0;
status = clGetPlatformIDs(0, NULL, &numPlatforms);
/* If this fails, assume no GPUs. */
@ -118,12 +119,10 @@ int clDevicesNum(void) {
status = clGetDeviceIDs(platform, CL_DEVICE_TYPE_GPU, 0, NULL, &numDevices);
if (status != CL_SUCCESS) {
applog(LOG_ERR, "Error %d: Getting Device IDs (num)", status);
if (i < numPlatforms - 1)
continue;
return -1;
continue;
}
applog(LOG_INFO, "Platform %d devices: %d", i, numDevices);
if (numDevices > most_devices) {
if ((int)numDevices > most_devices) {
most_devices = numDevices;
mdplatform = i;
}