Browse Source

Merge pull request #228 from pshep/disable_ocl

Disable OpenCL code when not available.
nfactor-troky
Con Kolivas 13 years ago
parent
commit
0c8eb166bc
  1. 74
      api.c
  2. 26
      cgminer.c
  3. 4
      miner.h

74
api.c

@ -399,21 +399,32 @@ struct CODES {
const enum code_parameters params; const enum code_parameters params;
const char *description; const char *description;
} codes[] = { } codes[] = {
#ifdef HAVE_OPENCL
{ SEVERITY_ERR, MSG_INVGPU, PARAM_GPUMAX, "Invalid GPU id %d - range is 0 - %d" }, { SEVERITY_ERR, MSG_INVGPU, PARAM_GPUMAX, "Invalid GPU id %d - range is 0 - %d" },
{ SEVERITY_INFO, MSG_ALRENA, PARAM_GPU, "GPU %d already enabled" }, { SEVERITY_INFO, MSG_ALRENA, PARAM_GPU, "GPU %d already enabled" },
{ SEVERITY_INFO, MSG_ALRDIS, PARAM_GPU, "GPU %d already disabled" }, { SEVERITY_INFO, MSG_ALRDIS, PARAM_GPU, "GPU %d already disabled" },
{ SEVERITY_WARN, MSG_GPUMRE, PARAM_GPU, "GPU %d must be restarted first" }, { SEVERITY_WARN, MSG_GPUMRE, PARAM_GPU, "GPU %d must be restarted first" },
{ SEVERITY_INFO, MSG_GPUREN, PARAM_GPU, "GPU %d sent enable message" }, { SEVERITY_INFO, MSG_GPUREN, PARAM_GPU, "GPU %d sent enable message" },
#endif
{ SEVERITY_ERR, MSG_GPUNON, PARAM_NONE, "No GPUs" }, { SEVERITY_ERR, MSG_GPUNON, PARAM_NONE, "No GPUs" },
{ SEVERITY_SUCC, MSG_POOL, PARAM_PMAX, "%d Pool(s)" }, { SEVERITY_SUCC, MSG_POOL, PARAM_PMAX, "%d Pool(s)" },
{ SEVERITY_ERR, MSG_NOPOOL, PARAM_NONE, "No pools" }, { SEVERITY_ERR, MSG_NOPOOL, PARAM_NONE, "No pools" },
{ SEVERITY_SUCC, MSG_DEVS, PARAM_DMAX, "%d GPU(s)" { SEVERITY_SUCC, MSG_DEVS, PARAM_DMAX,
#ifdef HAVE_OPENCL
"%d GPU(s)"
#endif
#if defined(HAVE_AN_FPGA) && defined(HAVE_OPENCL)
" - "
#endif
#ifdef HAVE_AN_FPGA #ifdef HAVE_AN_FPGA
" - %d PGA(s)" "%d PGA(s)"
#endif
#if defined(WANT_CPUMINE) && (defined(HAVE_OPENCL) || defined(HAVE_AN_FPGA))
" - "
#endif #endif
#ifdef WANT_CPUMINE #ifdef WANT_CPUMINE
" - %d CPU(s)" "%d CPU(s)"
#endif #endif
}, },
@ -427,11 +438,15 @@ struct CODES {
}, },
{ SEVERITY_SUCC, MSG_SUMM, PARAM_NONE, "Summary" }, { SEVERITY_SUCC, MSG_SUMM, PARAM_NONE, "Summary" },
#ifdef HAVE_OPENCL
{ SEVERITY_INFO, MSG_GPUDIS, PARAM_GPU, "GPU %d set disable flag" }, { SEVERITY_INFO, MSG_GPUDIS, PARAM_GPU, "GPU %d set disable flag" },
{ SEVERITY_INFO, MSG_GPUREI, PARAM_GPU, "GPU %d restart attempted" }, { SEVERITY_INFO, MSG_GPUREI, PARAM_GPU, "GPU %d restart attempted" },
#endif
{ SEVERITY_ERR, MSG_INVCMD, PARAM_NONE, "Invalid command" }, { SEVERITY_ERR, MSG_INVCMD, PARAM_NONE, "Invalid command" },
{ SEVERITY_ERR, MSG_MISID, PARAM_NONE, "Missing device id parameter" }, { SEVERITY_ERR, MSG_MISID, PARAM_NONE, "Missing device id parameter" },
#ifdef HAVE_OPENCL
{ SEVERITY_SUCC, MSG_GPUDEV, PARAM_GPU, "GPU%d" }, { SEVERITY_SUCC, MSG_GPUDEV, PARAM_GPU, "GPU%d" },
#endif
#ifdef HAVE_AN_FPGA #ifdef HAVE_AN_FPGA
{ SEVERITY_ERR, MSG_PGANON, PARAM_NONE, "No PGAs" }, { SEVERITY_ERR, MSG_PGANON, PARAM_NONE, "No PGAs" },
{ SEVERITY_SUCC, MSG_PGADEV, PARAM_PGA, "PGA%d" }, { SEVERITY_SUCC, MSG_PGADEV, PARAM_PGA, "PGA%d" },
@ -462,6 +477,7 @@ struct CODES {
{ SEVERITY_ERR, MSG_INVINT, PARAM_STR, "Invalid intensity (%s) - must be '" _DYNAMIC "' or range " _MIN_INTENSITY_STR " - " _MAX_INTENSITY_STR }, { SEVERITY_ERR, MSG_INVINT, PARAM_STR, "Invalid intensity (%s) - must be '" _DYNAMIC "' or range " _MIN_INTENSITY_STR " - " _MAX_INTENSITY_STR },
{ SEVERITY_INFO, MSG_GPUINT, PARAM_BOTH, "GPU %d set new intensity to %s" }, { SEVERITY_INFO, MSG_GPUINT, PARAM_BOTH, "GPU %d set new intensity to %s" },
{ SEVERITY_SUCC, MSG_MINECON, PARAM_NONE, "CGMiner config" }, { SEVERITY_SUCC, MSG_MINECON, PARAM_NONE, "CGMiner config" },
#ifdef HAVE_OPENCL
{ SEVERITY_ERR, MSG_GPUMERR, PARAM_BOTH, "Setting GPU %d memoryclock to (%s) reported failure" }, { SEVERITY_ERR, MSG_GPUMERR, PARAM_BOTH, "Setting GPU %d memoryclock to (%s) reported failure" },
{ SEVERITY_SUCC, MSG_GPUMEM, PARAM_BOTH, "Setting GPU %d memoryclock to (%s) reported success" }, { SEVERITY_SUCC, MSG_GPUMEM, PARAM_BOTH, "Setting GPU %d memoryclock to (%s) reported success" },
{ SEVERITY_ERR, MSG_GPUEERR, PARAM_BOTH, "Setting GPU %d clock to (%s) reported failure" }, { SEVERITY_ERR, MSG_GPUEERR, PARAM_BOTH, "Setting GPU %d clock to (%s) reported failure" },
@ -470,6 +486,7 @@ struct CODES {
{ SEVERITY_SUCC, MSG_GPUVDDC, PARAM_BOTH, "Setting GPU %d vddc to (%s) reported success" }, { SEVERITY_SUCC, MSG_GPUVDDC, PARAM_BOTH, "Setting GPU %d vddc to (%s) reported success" },
{ SEVERITY_ERR, MSG_GPUFERR, PARAM_BOTH, "Setting GPU %d fan to (%s) reported failure" }, { SEVERITY_ERR, MSG_GPUFERR, PARAM_BOTH, "Setting GPU %d fan to (%s) reported failure" },
{ SEVERITY_SUCC, MSG_GPUFAN, PARAM_BOTH, "Setting GPU %d fan to (%s) reported success" }, { SEVERITY_SUCC, MSG_GPUFAN, PARAM_BOTH, "Setting GPU %d fan to (%s) reported success" },
#endif
{ SEVERITY_ERR, MSG_MISFN, PARAM_NONE, "Missing save filename parameter" }, { SEVERITY_ERR, MSG_MISFN, PARAM_NONE, "Missing save filename parameter" },
{ SEVERITY_ERR, MSG_BADFN, PARAM_STR, "Can't open or create save file '%s'" }, { SEVERITY_ERR, MSG_BADFN, PARAM_STR, "Can't open or create save file '%s'" },
{ SEVERITY_SUCC, MSG_SAVED, PARAM_STR, "Configuration saved to file '%s'" }, { SEVERITY_SUCC, MSG_SAVED, PARAM_STR, "Configuration saved to file '%s'" },
@ -697,9 +714,11 @@ static char *message(int messageid, int paramid, char *param2, bool isjson)
case PARAM_POOL: case PARAM_POOL:
sprintf(ptr, codes[i].description, paramid, pools[paramid]->rpc_url); sprintf(ptr, codes[i].description, paramid, pools[paramid]->rpc_url);
break; break;
#ifdef HAVE_OPENCL
case PARAM_GPUMAX: case PARAM_GPUMAX:
sprintf(ptr, codes[i].description, paramid, nDevs - 1); sprintf(ptr, codes[i].description, paramid, nDevs - 1);
break; break;
#endif
#ifdef HAVE_AN_FPGA #ifdef HAVE_AN_FPGA
case PARAM_PGAMAX: case PARAM_PGAMAX:
pga = numpgas(); pga = numpgas();
@ -732,7 +751,10 @@ static char *message(int messageid, int paramid, char *param2, bool isjson)
cpu = 0; cpu = 0;
#endif #endif
sprintf(ptr, codes[i].description, nDevs sprintf(ptr, codes[i].description
#ifdef HAVE_OPENCL
, nDevs
#endif
#ifdef HAVE_AN_FPGA #ifdef HAVE_AN_FPGA
, pga , pga
#endif #endif
@ -786,6 +808,7 @@ static void apiversion(__maybe_unused SOCKETTYPE c, __maybe_unused char *param,
static void minerconfig(__maybe_unused SOCKETTYPE c, __maybe_unused char *param, bool isjson) static void minerconfig(__maybe_unused SOCKETTYPE c, __maybe_unused char *param, bool isjson)
{ {
char buf[TMPBUFSIZ]; char buf[TMPBUFSIZ];
int gpucount = 0;
int pgacount = 0; int pgacount = 0;
int cpucount = 0; int cpucount = 0;
char *adlinuse = (char *)NO; char *adlinuse = (char *)NO;
@ -803,6 +826,10 @@ static void minerconfig(__maybe_unused SOCKETTYPE c, __maybe_unused char *param,
const char *adl = NO; const char *adl = NO;
#endif #endif
#ifdef HAVE_OPENCL
gpucount = nDevs;
#endif
#ifdef HAVE_AN_FPGA #ifdef HAVE_AN_FPGA
pgacount = numpgas(); pgacount = numpgas();
#endif #endif
@ -817,12 +844,12 @@ static void minerconfig(__maybe_unused SOCKETTYPE c, __maybe_unused char *param,
? "," JSON_MINECON "{\"GPU Count\":%d,\"PGA Count\":%d,\"CPU Count\":%d,\"Pool Count\":%d,\"ADL\":\"%s\",\"ADL in use\":\"%s\",\"Strategy\":\"%s\",\"Log Interval\":%d,\"Device Code\":\"%s\",\"OS\":\"%s\"}" JSON_CLOSE ? "," JSON_MINECON "{\"GPU Count\":%d,\"PGA Count\":%d,\"CPU Count\":%d,\"Pool Count\":%d,\"ADL\":\"%s\",\"ADL in use\":\"%s\",\"Strategy\":\"%s\",\"Log Interval\":%d,\"Device Code\":\"%s\",\"OS\":\"%s\"}" JSON_CLOSE
: _MINECON ",GPU Count=%d,PGA Count=%d,CPU Count=%d,Pool Count=%d,ADL=%s,ADL in use=%s,Strategy=%s,Log Interval=%d,Device Code=%s,OS=%s" SEPSTR, : _MINECON ",GPU Count=%d,PGA Count=%d,CPU Count=%d,Pool Count=%d,ADL=%s,ADL in use=%s,Strategy=%s,Log Interval=%d,Device Code=%s,OS=%s" SEPSTR,
nDevs, pgacount, cpucount, total_pools, adl, adlinuse, gpucount, pgacount, cpucount, total_pools, adl, adlinuse,
strategies[pool_strategy].s, opt_log_interval, DEVICECODE, OSINFO); strategies[pool_strategy].s, opt_log_interval, DEVICECODE, OSINFO);
strcat(io_buffer, buf); strcat(io_buffer, buf);
} }
#ifdef HAVE_OPENCL
static void gpustatus(int gpu, bool isjson) static void gpustatus(int gpu, bool isjson)
{ {
char intensity[20]; char intensity[20];
@ -874,7 +901,7 @@ static void gpustatus(int gpu, bool isjson)
strcat(io_buffer, buf); strcat(io_buffer, buf);
} }
} }
#endif
#ifdef HAVE_AN_FPGA #ifdef HAVE_AN_FPGA
static void pgastatus(int pga, bool isjson) static void pgastatus(int pga, bool isjson)
{ {
@ -979,14 +1006,19 @@ static void cpustatus(int cpu, bool isjson)
static void devstatus(__maybe_unused SOCKETTYPE c, __maybe_unused char *param, bool isjson) static void devstatus(__maybe_unused SOCKETTYPE c, __maybe_unused char *param, bool isjson)
{ {
int devcount = 0; int devcount = 0;
int numgpu = 0;
int numpga = 0; int numpga = 0;
int i; int i;
#ifdef HAVE_OPENCL
numgpu = nDevs;
#endif
#ifdef HAVE_AN_FPGA #ifdef HAVE_AN_FPGA
numpga = numpgas(); numpga = numpgas();
#endif #endif
if (nDevs == 0 && opt_n_threads == 0 && numpga == 0) { if (numgpu == 0 && opt_n_threads == 0 && numpga == 0) {
strcpy(io_buffer, message(MSG_NODEVS, 0, NULL, isjson)); strcpy(io_buffer, message(MSG_NODEVS, 0, NULL, isjson));
return; return;
} }
@ -998,6 +1030,7 @@ static void devstatus(__maybe_unused SOCKETTYPE c, __maybe_unused char *param, b
strcat(io_buffer, JSON_DEVS); strcat(io_buffer, JSON_DEVS);
} }
#ifdef HAVE_OPENCL
for (i = 0; i < nDevs; i++) { for (i = 0; i < nDevs; i++) {
if (isjson && devcount > 0) if (isjson && devcount > 0)
strcat(io_buffer, COMMA); strcat(io_buffer, COMMA);
@ -1006,7 +1039,7 @@ static void devstatus(__maybe_unused SOCKETTYPE c, __maybe_unused char *param, b
devcount++; devcount++;
} }
#endif
#ifdef HAVE_AN_FPGA #ifdef HAVE_AN_FPGA
if (numpga > 0) if (numpga > 0)
for (i = 0; i < numpga; i++) { for (i = 0; i < numpga; i++) {
@ -1035,6 +1068,7 @@ static void devstatus(__maybe_unused SOCKETTYPE c, __maybe_unused char *param, b
strcat(io_buffer, JSON_CLOSE); strcat(io_buffer, JSON_CLOSE);
} }
#ifdef HAVE_OPENCL
static void gpudev(__maybe_unused SOCKETTYPE c, char *param, bool isjson) static void gpudev(__maybe_unused SOCKETTYPE c, char *param, bool isjson)
{ {
int id; int id;
@ -1067,7 +1101,7 @@ static void gpudev(__maybe_unused SOCKETTYPE c, char *param, bool isjson)
if (isjson) if (isjson)
strcat(io_buffer, JSON_CLOSE); strcat(io_buffer, JSON_CLOSE);
} }
#endif
#ifdef HAVE_AN_FPGA #ifdef HAVE_AN_FPGA
static void pgadev(__maybe_unused SOCKETTYPE c, char *param, bool isjson) static void pgadev(__maybe_unused SOCKETTYPE c, char *param, bool isjson)
{ {
@ -1342,7 +1376,7 @@ static void summary(__maybe_unused SOCKETTYPE c, __maybe_unused char *param, boo
total_go, local_work, total_ro, new_blocks, total_mhashes_done); total_go, local_work, total_ro, new_blocks, total_mhashes_done);
#endif #endif
} }
#ifdef HAVE_OPENCL
static void gpuenable(__maybe_unused SOCKETTYPE c, char *param, bool isjson) static void gpuenable(__maybe_unused SOCKETTYPE c, char *param, bool isjson)
{ {
struct thr_info *thr; struct thr_info *thr;
@ -1443,21 +1477,27 @@ static void gpurestart(__maybe_unused SOCKETTYPE c, char *param, bool isjson)
strcpy(io_buffer, message(MSG_GPUREI, id, NULL, isjson)); strcpy(io_buffer, message(MSG_GPUREI, id, NULL, isjson));
} }
#endif
static void gpucount(__maybe_unused SOCKETTYPE c, __maybe_unused char *param, bool isjson) static void gpucount(__maybe_unused SOCKETTYPE c, __maybe_unused char *param, bool isjson)
{ {
char buf[TMPBUFSIZ]; char buf[TMPBUFSIZ];
int numgpu = 0;
#ifdef HAVE_OPENCL
numgpu = nDevs;
#endif
strcpy(io_buffer, message(MSG_NUMGPU, 0, NULL, isjson)); strcpy(io_buffer, message(MSG_NUMGPU, 0, NULL, isjson));
sprintf(buf, isjson sprintf(buf, isjson
? "," JSON_GPUS "{\"Count\":%d}" JSON_CLOSE ? "," JSON_GPUS "{\"Count\":%d}" JSON_CLOSE
: _GPUS ",Count=%d" SEPSTR, : _GPUS ",Count=%d" SEPSTR,
nDevs); numgpu);
strcat(io_buffer, buf); strcat(io_buffer, buf);
} }
static void pgacount(__maybe_unused SOCKETTYPE c, __maybe_unused char *param, bool isjson) static void pgacount(__maybe_unused SOCKETTYPE c, __maybe_unused char *param, bool isjson)
{ {
char buf[TMPBUFSIZ]; char buf[TMPBUFSIZ];
@ -1732,6 +1772,7 @@ static void removepool(__maybe_unused SOCKETTYPE c, char *param, bool isjson)
rpc_url = NULL; rpc_url = NULL;
} }
#ifdef HAVE_OPENCL
static bool splitgpuvalue(char *param, int *gpu, char **value, bool isjson) static bool splitgpuvalue(char *param, int *gpu, char **value, bool isjson)
{ {
int id; int id;
@ -1766,7 +1807,6 @@ static bool splitgpuvalue(char *param, int *gpu, char **value, bool isjson)
return true; return true;
} }
static void gpuintensity(__maybe_unused SOCKETTYPE c, char *param, bool isjson) static void gpuintensity(__maybe_unused SOCKETTYPE c, char *param, bool isjson)
{ {
int id; int id;
@ -1879,7 +1919,7 @@ static void gpuvddc(__maybe_unused SOCKETTYPE c, __maybe_unused char *param, boo
strcpy(io_buffer, message(MSG_NOADL, 0, NULL, isjson)); strcpy(io_buffer, message(MSG_NOADL, 0, NULL, isjson));
#endif #endif
} }
#endif
void doquit(__maybe_unused SOCKETTYPE c, __maybe_unused char *param, bool isjson) void doquit(__maybe_unused SOCKETTYPE c, __maybe_unused char *param, bool isjson)
{ {
if (isjson) if (isjson)
@ -2144,10 +2184,12 @@ struct CMDS {
{ "devs", devstatus, false }, { "devs", devstatus, false },
{ "pools", poolstatus, false }, { "pools", poolstatus, false },
{ "summary", summary, false }, { "summary", summary, false },
#ifdef HAVE_OPENCL
{ "gpuenable", gpuenable, true }, { "gpuenable", gpuenable, true },
{ "gpudisable", gpudisable, true }, { "gpudisable", gpudisable, true },
{ "gpurestart", gpurestart, true }, { "gpurestart", gpurestart, true },
{ "gpu", gpudev, false }, { "gpu", gpudev, false },
#endif
#ifdef HAVE_AN_FPGA #ifdef HAVE_AN_FPGA
{ "pga", pgadev, false }, { "pga", pgadev, false },
{ "pgaenable", pgaenable, true }, { "pgaenable", pgaenable, true },
@ -2164,11 +2206,13 @@ struct CMDS {
{ "enablepool", enablepool, true }, { "enablepool", enablepool, true },
{ "disablepool", disablepool, true }, { "disablepool", disablepool, true },
{ "removepool", removepool, true }, { "removepool", removepool, true },
#ifdef HAVE_OPENCL
{ "gpuintensity", gpuintensity, true }, { "gpuintensity", gpuintensity, true },
{ "gpumem", gpumem, true }, { "gpumem", gpumem, true },
{ "gpuengine", gpuengine, true }, { "gpuengine", gpuengine, true },
{ "gpufan", gpufan, true }, { "gpufan", gpufan, true },
{ "gpuvddc", gpuvddc, true }, { "gpuvddc", gpuvddc, true },
#endif
{ "save", dosave, true }, { "save", dosave, true },
{ "quit", doquit, true }, { "quit", doquit, true },
{ "privileged", privileged, true }, { "privileged", privileged, true },

26
cgminer.c

@ -84,8 +84,6 @@ struct strategies strategies[] = {
static char packagename[255]; static char packagename[255];
int gpu_threads;
bool opt_protocol; bool opt_protocol;
static bool opt_benchmark; static bool opt_benchmark;
static bool have_longpoll; static bool have_longpoll;
@ -107,19 +105,19 @@ static const bool opt_time = true;
#ifdef HAVE_OPENCL #ifdef HAVE_OPENCL
int opt_dynamic_interval = 7; int opt_dynamic_interval = 7;
int nDevs;
int opt_g_threads = 2;
int gpu_threads;
#endif #endif
bool opt_restart = true; bool opt_restart = true;
static bool opt_nogpu; static bool opt_nogpu;
struct list_head scan_devices; struct list_head scan_devices;
int nDevs;
int opt_g_threads = 2;
static signed int devices_enabled; static signed int devices_enabled;
static bool opt_removedisabled; static bool opt_removedisabled;
int total_devices; int total_devices;
struct cgpu_info *devices[MAX_DEVICES]; struct cgpu_info *devices[MAX_DEVICES];
bool have_opencl; bool have_opencl;
int gpu_threads;
int opt_n_threads = -1; int opt_n_threads = -1;
int mining_threads; int mining_threads;
int num_processors; int num_processors;
@ -1289,7 +1287,9 @@ static char statusline[256];
static int devcursor, logstart, logcursor; static int devcursor, logstart, logcursor;
/* statusy is where the status window goes up to in cases where it won't fit at startup */ /* statusy is where the status window goes up to in cases where it won't fit at startup */
static int statusy; static int statusy;
#ifdef HAVE_OPENCL
struct cgpu_info gpus[MAX_GPUDEVICES]; /* Maximum number apparently possible */ struct cgpu_info gpus[MAX_GPUDEVICES]; /* Maximum number apparently possible */
#endif
struct cgpu_info *cpus; struct cgpu_info *cpus;
#ifdef HAVE_CURSES #ifdef HAVE_CURSES
@ -2705,12 +2705,12 @@ void write_config(FILE *fcfg)
} }
fputs("\n]\n", fcfg); fputs("\n]\n", fcfg);
#ifdef HAVE_OPENCL
if (nDevs) { if (nDevs) {
/* Write GPU device values */ /* Write GPU device values */
fputs(",\n\"intensity\" : \"", fcfg); fputs(",\n\"intensity\" : \"", fcfg);
for(i = 0; i < nDevs; i++) for(i = 0; i < nDevs; i++)
fprintf(fcfg, gpus[i].dynamic ? "%sd" : "%s%d", i > 0 ? "," : "", gpus[i].intensity); fprintf(fcfg, gpus[i].dynamic ? "%sd" : "%s%d", i > 0 ? "," : "", gpus[i].intensity);
#ifdef HAVE_OPENCL
fputs("\",\n\"vectors\" : \"", fcfg); fputs("\",\n\"vectors\" : \"", fcfg);
for(i = 0; i < nDevs; i++) for(i = 0; i < nDevs; i++)
fprintf(fcfg, "%s%d", i > 0 ? "," : "", fprintf(fcfg, "%s%d", i > 0 ? "," : "",
@ -2767,10 +2767,10 @@ void write_config(FILE *fcfg)
fputs("\",\n\"temp-target\" : \"", fcfg); fputs("\",\n\"temp-target\" : \"", fcfg);
for(i = 0; i < nDevs; i++) for(i = 0; i < nDevs; i++)
fprintf(fcfg, "%s%d", i > 0 ? "," : "", gpus[i].adl.targettemp); fprintf(fcfg, "%s%d", i > 0 ? "," : "", gpus[i].adl.targettemp);
#endif
#endif #endif
fputs("\"", fcfg); fputs("\"", fcfg);
} }
#endif
#ifdef HAVE_ADL #ifdef HAVE_ADL
if (opt_reorder) if (opt_reorder)
fprintf(fcfg, ",\n\"gpu-reorder\" : true"); fprintf(fcfg, ",\n\"gpu-reorder\" : true");
@ -2824,6 +2824,7 @@ void write_config(FILE *fcfg)
fprintf(fcfg, ",\n\"stop-time\" : \"%d:%d\"", schedstop.tm.tm_hour, schedstop.tm.tm_min); fprintf(fcfg, ",\n\"stop-time\" : \"%d:%d\"", schedstop.tm.tm_hour, schedstop.tm.tm_min);
if (opt_socks_proxy && *opt_socks_proxy) if (opt_socks_proxy && *opt_socks_proxy)
fprintf(fcfg, ",\n\"socks-proxy\" : \"%s\"", opt_socks_proxy); fprintf(fcfg, ",\n\"socks-proxy\" : \"%s\"", opt_socks_proxy);
#ifdef HAVE_OPENCL
for(i = 0; i < nDevs; i++) for(i = 0; i < nDevs; i++)
if (gpus[i].deven == DEV_DISABLED) if (gpus[i].deven == DEV_DISABLED)
break; break;
@ -2831,6 +2832,7 @@ void write_config(FILE *fcfg)
for (i = 0; i < nDevs; i++) for (i = 0; i < nDevs; i++)
if (gpus[i].deven != DEV_DISABLED) if (gpus[i].deven != DEV_DISABLED)
fprintf(fcfg, ",\n\"device\" : \"%d\"", i); fprintf(fcfg, ",\n\"device\" : \"%d\"", i);
#endif
if (opt_api_allow) if (opt_api_allow)
fprintf(fcfg, ",\n\"api-allow\" : \"%s\"", opt_api_allow); fprintf(fcfg, ",\n\"api-allow\" : \"%s\"", opt_api_allow);
if (strcmp(opt_api_description, PACKAGE_STRING) != 0) if (strcmp(opt_api_description, PACKAGE_STRING) != 0)
@ -4893,9 +4895,11 @@ int main(int argc, char *argv[])
INIT_LIST_HEAD(&scan_devices); INIT_LIST_HEAD(&scan_devices);
#ifdef HAVE_OPENCL
memset(gpus, 0, sizeof(gpus)); memset(gpus, 0, sizeof(gpus));
for (i = 0; i < MAX_GPUDEVICES; i++) for (i = 0; i < MAX_GPUDEVICES; i++)
gpus[i].dynamic = true; gpus[i].dynamic = true;
#endif
memset(devices, 0, sizeof(devices)); memset(devices, 0, sizeof(devices));
@ -5002,6 +5006,7 @@ int main(int argc, char *argv[])
#ifdef HAVE_OPENCL #ifdef HAVE_OPENCL
if (!opt_nogpu) if (!opt_nogpu)
opencl_api.api_detect(); opencl_api.api_detect();
gpu_threads = 0;
#endif #endif
#ifdef USE_ICARUS #ifdef USE_ICARUS
@ -5037,7 +5042,6 @@ int main(int argc, char *argv[])
} }
mining_threads = 0; mining_threads = 0;
gpu_threads = 0;
if (devices_enabled) { if (devices_enabled) {
for (i = 0; i < (int)(sizeof(devices_enabled) * 8) - 1; ++i) { for (i = 0; i < (int)(sizeof(devices_enabled) * 8) - 1; ++i) {
if (devices_enabled & (1 << i)) { if (devices_enabled & (1 << i)) {
@ -5221,10 +5225,6 @@ begin_bench:
gettimeofday(&total_tv_end, NULL); gettimeofday(&total_tv_end, NULL);
get_datestamp(datestamp, &total_tv_start); get_datestamp(datestamp, &total_tv_start);
#ifndef HAVE_OPENCL
opt_g_threads = 0;
#endif
// Start threads // Start threads
k = 0; k = 0;
for (i = 0; i < total_devices; ++i) { for (i = 0; i < total_devices; ++i) {
@ -5292,6 +5292,7 @@ begin_bench:
quit(1, "watchdog thread create failed"); quit(1, "watchdog thread create failed");
pthread_detach(thr->pth); pthread_detach(thr->pth);
#ifdef HAVE_OPENCL
/* Create reinit gpu thread */ /* Create reinit gpu thread */
gpur_thr_id = mining_threads + 4; gpur_thr_id = mining_threads + 4;
thr = &thr_info[gpur_thr_id]; thr = &thr_info[gpur_thr_id];
@ -5300,6 +5301,7 @@ begin_bench:
quit(1, "tq_new failed for gpur_thr_id"); quit(1, "tq_new failed for gpur_thr_id");
if (thr_info_create(thr, NULL, reinit_gpu, thr)) if (thr_info_create(thr, NULL, reinit_gpu, thr))
quit(1, "reinit_gpu thread create failed"); quit(1, "reinit_gpu thread create failed");
#endif
/* Create API socket thread */ /* Create API socket thread */
api_thr_id = mining_threads + 5; api_thr_id = mining_threads + 5;

4
miner.h

@ -331,13 +331,13 @@ struct cgpu_info {
unsigned int max_hashes; unsigned int max_hashes;
const char *kname;
#ifdef HAVE_OPENCL
bool mapped; bool mapped;
int virtual_gpu; int virtual_gpu;
int virtual_adl; int virtual_adl;
int intensity; int intensity;
bool dynamic; bool dynamic;
const char *kname;
#ifdef HAVE_OPENCL
cl_uint vwidth; cl_uint vwidth;
size_t work_size; size_t work_size;
enum cl_kernels kernel; enum cl_kernels kernel;

Loading…
Cancel
Save