mirror of
https://github.com/GOSTSec/sgminer
synced 2025-01-27 06:54:36 +00:00
Find the gpu platform with the most devices and use that if no platform option is passed.
This commit is contained in:
parent
f99ac0ca78
commit
ffd21f8db3
11
ocl.c
11
ocl.c
@ -33,7 +33,7 @@
|
||||
#include "findnonce.h"
|
||||
#include "ocl.h"
|
||||
|
||||
int opt_platform_id;
|
||||
int opt_platform_id = -1;
|
||||
|
||||
char *file_contents(const char *filename, int *length)
|
||||
{
|
||||
@ -80,7 +80,7 @@ int clDevicesNum(void) {
|
||||
cl_uint numPlatforms;
|
||||
cl_platform_id *platforms;
|
||||
cl_platform_id platform = NULL;
|
||||
unsigned int most_devices = 0, i;
|
||||
unsigned int most_devices = 0, i, mdplatform;
|
||||
|
||||
status = clGetPlatformIDs(0, NULL, &numPlatforms);
|
||||
/* If this fails, assume no GPUs. */
|
||||
@ -123,8 +123,10 @@ int clDevicesNum(void) {
|
||||
return -1;
|
||||
}
|
||||
applog(LOG_INFO, "Platform %d devices: %d", i, numDevices);
|
||||
if (numDevices > most_devices)
|
||||
if (numDevices > most_devices) {
|
||||
most_devices = numDevices;
|
||||
mdplatform = i;
|
||||
}
|
||||
if (numDevices) {
|
||||
unsigned int j;
|
||||
char pbuff[256];
|
||||
@ -139,6 +141,9 @@ int clDevicesNum(void) {
|
||||
}
|
||||
}
|
||||
|
||||
if (opt_platform_id < 0)
|
||||
opt_platform_id = mdplatform;;
|
||||
|
||||
return most_devices;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user