mirror of
https://github.com/GOSTSec/sgminer
synced 2025-02-02 01:44:23 +00:00
HAVE_OPENCL is mandatory, remove checks form code an build system.
This commit is contained in:
parent
75e0cfc847
commit
199cb10e18
65
api.c
65
api.c
@ -138,19 +138,15 @@ static const char GPUSEP = ',';
|
||||
|
||||
static const char *APIVERSION = "1.32";
|
||||
static const char *DEAD = "Dead";
|
||||
#if defined(HAVE_OPENCL) || defined(HAVE_AN_FPGA) || defined(HAVE_AN_ASIC)
|
||||
static const char *SICK = "Sick";
|
||||
static const char *NOSTART = "NoStart";
|
||||
static const char *INIT = "Initialising";
|
||||
#endif
|
||||
static const char *DISABLED = "Disabled";
|
||||
static const char *ALIVE = "Alive";
|
||||
static const char *REJECTING = "Rejecting";
|
||||
static const char *UNKNOWN = "Unknown";
|
||||
#define _DYNAMIC "D"
|
||||
#ifdef HAVE_OPENCL
|
||||
static const char *DYNAMIC = _DYNAMIC;
|
||||
#endif
|
||||
|
||||
static __maybe_unused const char *NONE = "None";
|
||||
|
||||
@ -164,11 +160,7 @@ static const char *FALSESTR = "false";
|
||||
static const char *SCRYPTSTR = "scrypt";
|
||||
static const char *SHA256STR = "sha256";
|
||||
|
||||
static const char *DEVICECODE = ""
|
||||
#ifdef HAVE_OPENCL
|
||||
"GPU "
|
||||
#endif
|
||||
"";
|
||||
static const char *DEVICECODE = "GPU ";
|
||||
|
||||
static const char *OSINFO =
|
||||
#if defined(__linux)
|
||||
@ -381,43 +373,25 @@ struct CODES {
|
||||
const enum code_parameters params;
|
||||
const char *description;
|
||||
} codes[] = {
|
||||
#ifdef HAVE_OPENCL
|
||||
{ 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_ALRDIS, PARAM_GPU, "GPU %d already disabled" },
|
||||
{ SEVERITY_WARN, MSG_GPUMRE, PARAM_GPU, "GPU %d must be restarted first" },
|
||||
{ SEVERITY_INFO, MSG_GPUREN, PARAM_GPU, "GPU %d sent enable message" },
|
||||
#endif
|
||||
{ SEVERITY_ERR, MSG_GPUNON, PARAM_NONE, "No GPUs" },
|
||||
{ SEVERITY_SUCC, MSG_POOL, PARAM_PMAX, "%d Pool(s)" },
|
||||
{ SEVERITY_ERR, MSG_NOPOOL, PARAM_NONE, "No pools" },
|
||||
|
||||
{ SEVERITY_SUCC, MSG_DEVS, PARAM_DMAX,
|
||||
#ifdef HAVE_OPENCL
|
||||
"%d GPU(s)"
|
||||
#endif
|
||||
#if defined(HAVE_OPENCL)
|
||||
" - "
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_OPENCL)
|
||||
" - "
|
||||
#endif
|
||||
},
|
||||
|
||||
{ SEVERITY_SUCC, MSG_DEVS, PARAM_DMAX, "%d GPU(s)" },
|
||||
{ SEVERITY_ERR, MSG_NODEVS, PARAM_NONE, "No GPUs"
|
||||
},
|
||||
|
||||
{ SEVERITY_SUCC, MSG_SUMM, PARAM_NONE, "Summary" },
|
||||
#ifdef HAVE_OPENCL
|
||||
{ SEVERITY_INFO, MSG_GPUDIS, PARAM_GPU, "GPU %d set disable flag" },
|
||||
{ SEVERITY_INFO, MSG_GPUREI, PARAM_GPU, "GPU %d restart attempted" },
|
||||
#endif
|
||||
{ SEVERITY_ERR, MSG_INVCMD, PARAM_NONE, "Invalid command" },
|
||||
{ SEVERITY_ERR, MSG_MISID, PARAM_NONE, "Missing device id parameter" },
|
||||
#ifdef HAVE_OPENCL
|
||||
{ SEVERITY_SUCC, MSG_GPUDEV, PARAM_GPU, "GPU%d" },
|
||||
#endif
|
||||
{ SEVERITY_SUCC, MSG_NUMGPU, PARAM_NONE, "GPU count" },
|
||||
{ SEVERITY_SUCC, MSG_VERSION, PARAM_NONE, "CGMiner versions" },
|
||||
{ SEVERITY_ERR, MSG_INVJSON, PARAM_NONE, "Invalid JSON" },
|
||||
@ -431,7 +405,6 @@ struct CODES {
|
||||
{ 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_SUCC, MSG_MINECONFIG,PARAM_NONE, "CGMiner config" },
|
||||
#ifdef HAVE_OPENCL
|
||||
{ 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_ERR, MSG_GPUEERR, PARAM_BOTH, "Setting GPU %d clock to (%s) reported failure" },
|
||||
@ -440,7 +413,6 @@ struct CODES {
|
||||
{ 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_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_BADFN, PARAM_STR, "Can't open or create save file '%s'" },
|
||||
{ SEVERITY_SUCC, MSG_SAVED, PARAM_STR, "Configuration saved to file '%s'" },
|
||||
@ -1145,11 +1117,9 @@ static void message(struct io_data *io_data, int messageid, int paramid, char *p
|
||||
case PARAM_POOL:
|
||||
sprintf(buf, codes[i].description, paramid, pools[paramid]->rpc_url);
|
||||
break;
|
||||
#ifdef HAVE_OPENCL
|
||||
case PARAM_GPUMAX:
|
||||
sprintf(buf, codes[i].description, paramid, nDevs - 1);
|
||||
break;
|
||||
#endif
|
||||
case PARAM_PMAX:
|
||||
sprintf(buf, codes[i].description, total_pools);
|
||||
break;
|
||||
@ -1157,12 +1127,7 @@ static void message(struct io_data *io_data, int messageid, int paramid, char *p
|
||||
sprintf(buf, codes[i].description, paramid, total_pools - 1);
|
||||
break;
|
||||
case PARAM_DMAX:
|
||||
|
||||
sprintf(buf, codes[i].description
|
||||
#ifdef HAVE_OPENCL
|
||||
, nDevs
|
||||
#endif
|
||||
);
|
||||
sprintf(buf, codes[i].description, nDevs);
|
||||
break;
|
||||
case PARAM_CMD:
|
||||
sprintf(buf, codes[i].description, JSON_COMMAND);
|
||||
@ -1646,9 +1611,7 @@ static void minerconfig(struct io_data *io_data, __maybe_unused SOCKETTYPE c, __
|
||||
const char *adl = NO;
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_OPENCL
|
||||
gpucount = nDevs;
|
||||
#endif
|
||||
|
||||
message(io_data, MSG_MINECONFIG, 0, NULL, isjson);
|
||||
io_open = io_add(io_data, isjson ? COMSTR JSON_MINECONFIG : _MINECONFIG COMSTR);
|
||||
@ -1672,7 +1635,6 @@ static void minerconfig(struct io_data *io_data, __maybe_unused SOCKETTYPE c, __
|
||||
io_close(io_data);
|
||||
}
|
||||
|
||||
#if defined(HAVE_OPENCL)
|
||||
static const char *status2str(enum alive status)
|
||||
{
|
||||
switch (status) {
|
||||
@ -1690,9 +1652,7 @@ static const char *status2str(enum alive status)
|
||||
return UNKNOWN;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_OPENCL
|
||||
static void gpustatus(struct io_data *io_data, int gpu, bool isjson, bool precom)
|
||||
{
|
||||
struct api_data *root = NULL;
|
||||
@ -1768,7 +1728,6 @@ static void gpustatus(struct io_data *io_data, int gpu, bool isjson, bool precom
|
||||
io_add(io_data, buf);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
static void devstatus(struct io_data *io_data, __maybe_unused SOCKETTYPE c, __maybe_unused char *param, bool isjson, __maybe_unused char group)
|
||||
{
|
||||
@ -1776,10 +1735,7 @@ static void devstatus(struct io_data *io_data, __maybe_unused SOCKETTYPE c, __ma
|
||||
int devcount = 0;
|
||||
int numgpu = 0;
|
||||
int i;
|
||||
|
||||
#ifdef HAVE_OPENCL
|
||||
numgpu = nDevs;
|
||||
#endif
|
||||
|
||||
if (numgpu == 0) {
|
||||
message(io_data, MSG_NODEVS, 0, NULL, isjson);
|
||||
@ -1791,18 +1747,15 @@ static void devstatus(struct io_data *io_data, __maybe_unused SOCKETTYPE c, __ma
|
||||
if (isjson)
|
||||
io_open = io_add(io_data, COMSTR JSON_DEVS);
|
||||
|
||||
#ifdef HAVE_OPENCL
|
||||
for (i = 0; i < nDevs; i++) {
|
||||
gpustatus(io_data, i, isjson, isjson && devcount > 0);
|
||||
|
||||
devcount++;
|
||||
}
|
||||
#endif
|
||||
if (isjson && io_open)
|
||||
io_close(io_data);
|
||||
}
|
||||
|
||||
#ifdef HAVE_OPENCL
|
||||
static void gpudev(struct io_data *io_data, __maybe_unused SOCKETTYPE c, char *param, bool isjson, __maybe_unused char group)
|
||||
{
|
||||
bool io_open = false;
|
||||
@ -1834,7 +1787,6 @@ static void gpudev(struct io_data *io_data, __maybe_unused SOCKETTYPE c, char *p
|
||||
if (isjson && io_open)
|
||||
io_close(io_data);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void poolstatus(struct io_data *io_data, __maybe_unused SOCKETTYPE c, __maybe_unused char *param, bool isjson, __maybe_unused char group)
|
||||
{
|
||||
@ -1995,7 +1947,6 @@ static void summary(struct io_data *io_data, __maybe_unused SOCKETTYPE c, __mayb
|
||||
io_close(io_data);
|
||||
}
|
||||
|
||||
#ifdef HAVE_OPENCL
|
||||
static void gpuenable(struct io_data *io_data, __maybe_unused SOCKETTYPE c, char *param, bool isjson, __maybe_unused char group)
|
||||
{
|
||||
struct thr_info *thr;
|
||||
@ -2101,7 +2052,6 @@ static void gpurestart(struct io_data *io_data, __maybe_unused SOCKETTYPE c, cha
|
||||
|
||||
message(io_data, MSG_GPUREI, id, NULL, isjson);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void gpucount(struct io_data *io_data, __maybe_unused SOCKETTYPE c, __maybe_unused char *param, bool isjson, __maybe_unused char group)
|
||||
{
|
||||
@ -2109,10 +2059,7 @@ static void gpucount(struct io_data *io_data, __maybe_unused SOCKETTYPE c, __may
|
||||
char buf[TMPBUFSIZ];
|
||||
bool io_open;
|
||||
int numgpu = 0;
|
||||
|
||||
#ifdef HAVE_OPENCL
|
||||
numgpu = nDevs;
|
||||
#endif
|
||||
|
||||
message(io_data, MSG_NUMGPU, 0, NULL, isjson);
|
||||
io_open = io_add(io_data, isjson ? COMSTR JSON_GPUS : _GPUS COMSTR);
|
||||
@ -2474,7 +2421,6 @@ static void removepool(struct io_data *io_data, __maybe_unused SOCKETTYPE c, cha
|
||||
rpc_url = NULL;
|
||||
}
|
||||
|
||||
#ifdef HAVE_OPENCL
|
||||
static bool splitgpuvalue(struct io_data *io_data, char *param, int *gpu, char **value, bool isjson)
|
||||
{
|
||||
int id;
|
||||
@ -2622,7 +2568,6 @@ static void gpuvddc(struct io_data *io_data, __maybe_unused SOCKETTYPE c, __mayb
|
||||
message(io_data, MSG_NOADL, 0, NULL, isjson);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
void doquit(struct io_data *io_data, __maybe_unused SOCKETTYPE c, __maybe_unused char *param, bool isjson, __maybe_unused char group)
|
||||
{
|
||||
@ -3116,12 +3061,10 @@ struct CMDS {
|
||||
{ "devs", devstatus, false },
|
||||
{ "pools", poolstatus, false },
|
||||
{ "summary", summary, false },
|
||||
#ifdef HAVE_OPENCL
|
||||
{ "gpuenable", gpuenable, true },
|
||||
{ "gpudisable", gpudisable, true },
|
||||
{ "gpurestart", gpurestart, true },
|
||||
{ "gpu", gpudev, false },
|
||||
#endif
|
||||
{ "gpucount", gpucount, false },
|
||||
{ "switchpool", switchpool, true },
|
||||
{ "addpool", addpool, true },
|
||||
@ -3130,13 +3073,11 @@ struct CMDS {
|
||||
{ "enablepool", enablepool, true },
|
||||
{ "disablepool", disablepool, true },
|
||||
{ "removepool", removepool, true },
|
||||
#ifdef HAVE_OPENCL
|
||||
{ "gpuintensity", gpuintensity, true },
|
||||
{ "gpumem", gpumem, true },
|
||||
{ "gpuengine", gpuengine, true },
|
||||
{ "gpufan", gpufan, true },
|
||||
{ "gpuvddc", gpuvddc, true },
|
||||
#endif
|
||||
{ "save", dosave, true },
|
||||
{ "quit", doquit, true },
|
||||
{ "privileged", privileged, true },
|
||||
|
56
cgminer.c
56
cgminer.c
@ -90,14 +90,10 @@ static const bool opt_time = true;
|
||||
unsigned long long global_hashrate;
|
||||
unsigned long global_quota_gcd = 1;
|
||||
|
||||
#if defined(HAVE_OPENCL)
|
||||
int nDevs;
|
||||
#endif
|
||||
#ifdef HAVE_OPENCL
|
||||
int opt_dynamic_interval = 7;
|
||||
int opt_g_threads = -1;
|
||||
int gpu_threads;
|
||||
#endif
|
||||
bool opt_restart = true;
|
||||
bool opt_nogpu;
|
||||
|
||||
@ -1009,14 +1005,6 @@ static struct opt_table opt_config_table[] = {
|
||||
OPT_WITH_ARG("--device|-d",
|
||||
set_devices, NULL, NULL,
|
||||
"Select device to use, one value, range and/or comma separated (e.g. 0-2,4) default: all"),
|
||||
OPT_WITHOUT_ARG("--disable-gpu|-G",
|
||||
opt_set_bool, &opt_nogpu,
|
||||
#ifdef HAVE_OPENCL
|
||||
"Disable GPU mining even if suitable devices exist"
|
||||
#else
|
||||
opt_hidden
|
||||
#endif
|
||||
),
|
||||
OPT_WITHOUT_ARG("--disable-rejecting",
|
||||
opt_set_bool, &opt_disable_pool,
|
||||
"Automatically disable pools that continually reject shares"),
|
||||
@ -1029,7 +1017,6 @@ static struct opt_table opt_config_table[] = {
|
||||
OPT_WITHOUT_ARG("--fix-protocol",
|
||||
opt_set_bool, &opt_fix_protocol,
|
||||
"Do not redirect to a different getwork protocol (eg. stratum)"),
|
||||
#ifdef HAVE_OPENCL
|
||||
OPT_WITH_ARG("--gpu-dyninterval",
|
||||
set_int_1_to_65535, opt_show_intval, &opt_dynamic_interval,
|
||||
"Set the refresh interval in ms for GPUs using dynamic intensity"),
|
||||
@ -1073,17 +1060,12 @@ static struct opt_table opt_config_table[] = {
|
||||
"Intensity of GPU scanning (d or " MIN_INTENSITY_STR
|
||||
" -> " MAX_INTENSITY_STR
|
||||
",default: d to maintain desktop interactivity)"),
|
||||
#endif
|
||||
#if defined(HAVE_OPENCL)
|
||||
OPT_WITH_ARG("--kernel-path|-K",
|
||||
opt_set_charp, opt_show_charp, &opt_kernel_path,
|
||||
"Specify a path to where kernel files are"),
|
||||
#endif
|
||||
#ifdef HAVE_OPENCL
|
||||
OPT_WITH_ARG("--kernel|-k",
|
||||
set_kernel, NULL, NULL,
|
||||
"Override kernel to use - one value or comma separated"),
|
||||
#endif
|
||||
OPT_WITHOUT_ARG("--load-balance",
|
||||
set_loadbalance, &pool_strategy,
|
||||
"Change multipool strategy from failover to quota based balance"),
|
||||
@ -1114,12 +1096,7 @@ static struct opt_table opt_config_table[] = {
|
||||
opt_hidden),
|
||||
OPT_WITHOUT_ARG("--no-restart",
|
||||
opt_set_invbool, &opt_restart,
|
||||
#ifdef HAVE_OPENCL
|
||||
"Do not attempt to restart GPUs that hang"
|
||||
#else
|
||||
opt_hidden
|
||||
#endif
|
||||
),
|
||||
"Do not attempt to restart GPUs that hang"),
|
||||
OPT_WITHOUT_ARG("--no-submit-stale",
|
||||
opt_set_invbool, &opt_submit_stale,
|
||||
"Don't submit shares if they are detected as stale"),
|
||||
@ -1223,19 +1200,15 @@ static struct opt_table opt_config_table[] = {
|
||||
OPT_WITH_ARG("--user|-u",
|
||||
set_user, NULL, NULL,
|
||||
"Username for bitcoin JSON-RPC server"),
|
||||
#ifdef HAVE_OPENCL
|
||||
OPT_WITH_ARG("--vectors|-v",
|
||||
set_vector, NULL, NULL,
|
||||
"Override detected optimal vector (1, 2 or 4) - one value or comma separated list"),
|
||||
#endif
|
||||
OPT_WITHOUT_ARG("--verbose",
|
||||
opt_set_bool, &opt_log_output,
|
||||
"Log verbose output to stderr as well as status output"),
|
||||
#ifdef HAVE_OPENCL
|
||||
OPT_WITH_ARG("--worksize|-w",
|
||||
set_worksize, NULL, NULL,
|
||||
"Override detected optimal worksize - one value or comma separated list"),
|
||||
#endif
|
||||
OPT_WITH_ARG("--userpass|-O",
|
||||
set_userpass, NULL, NULL,
|
||||
"Username:Password pair for bitcoin JSON-RPC server"),
|
||||
@ -1387,25 +1360,18 @@ extern const char *opt_argv0;
|
||||
|
||||
static char *opt_verusage_and_exit(const char *extra)
|
||||
{
|
||||
printf("%s\nBuilt with "
|
||||
#ifdef HAVE_OPENCL // FIXME: true always
|
||||
"GPU "
|
||||
#endif
|
||||
"scrypt mining support.\n"
|
||||
, packagename);
|
||||
printf("%s\n", packagename);
|
||||
printf("%s", opt_usage(opt_argv0, extra));
|
||||
fflush(stdout);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
#if defined(HAVE_OPENCL)
|
||||
char *display_devs(int *ndevs)
|
||||
{
|
||||
*ndevs = 0;
|
||||
print_ndevs(ndevs);
|
||||
exit(*ndevs);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* These options are available from commandline only */
|
||||
static struct opt_table opt_cmdline_table[] = {
|
||||
@ -1420,12 +1386,10 @@ static struct opt_table opt_cmdline_table[] = {
|
||||
OPT_WITHOUT_ARG("--help|-h",
|
||||
opt_verusage_and_exit, NULL,
|
||||
"Print this message"),
|
||||
#if defined(HAVE_OPENCL)
|
||||
OPT_WITHOUT_ARG("--ndevs|-n",
|
||||
display_devs, &nDevs,
|
||||
"Display number of detected GPUs, OpenCL platform "
|
||||
"information, and exit"),
|
||||
#endif
|
||||
OPT_WITHOUT_ARG("--version|-V",
|
||||
opt_version_and_exit, packagename,
|
||||
"Display version and exit"),
|
||||
@ -1889,9 +1853,7 @@ static int devcursor, logstart, logcursor;
|
||||
/* statusy is where the status window goes up to in cases where it won't fit at startup */
|
||||
static int statusy;
|
||||
#endif
|
||||
#ifdef HAVE_OPENCL
|
||||
struct cgpu_info gpus[MAX_GPUDEVICES]; /* Maximum number apparently possible */
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CURSES
|
||||
static inline void unlock_curses(void)
|
||||
@ -4151,7 +4113,6 @@ void write_config(FILE *fcfg)
|
||||
}
|
||||
fputs("\n]\n", fcfg);
|
||||
|
||||
#ifdef HAVE_OPENCL
|
||||
if (nDevs) {
|
||||
/* Write GPU device values */
|
||||
fputs(",\n\"intensity\" : \"", fcfg);
|
||||
@ -4219,7 +4180,6 @@ void write_config(FILE *fcfg)
|
||||
#endif
|
||||
fputs("\"", fcfg);
|
||||
}
|
||||
#endif
|
||||
#ifdef HAVE_ADL
|
||||
if (opt_reorder)
|
||||
fprintf(fcfg, ",\n\"gpu-reorder\" : true");
|
||||
@ -4772,10 +4732,8 @@ static void *input_thread(void __maybe_unused *userdata)
|
||||
display_pools();
|
||||
else if (!strncasecmp(&input, "s", 1))
|
||||
set_options();
|
||||
#if HAVE_OPENCL
|
||||
else if (have_opencl && !strncasecmp(&input, "g", 1))
|
||||
manage_gpu();
|
||||
#endif
|
||||
if (opt_realquiet) {
|
||||
disable_curses();
|
||||
break;
|
||||
@ -7063,7 +7021,7 @@ void print_summary(void)
|
||||
|
||||
static void clean_up(bool restarting)
|
||||
{
|
||||
#ifdef HAVE_OPENCL
|
||||
#ifdef HAVE_ADL
|
||||
clear_adl(nDevs);
|
||||
#endif
|
||||
cgtime(&total_tv_end);
|
||||
@ -7448,11 +7406,9 @@ void enable_device(struct cgpu_info *cgpu)
|
||||
adj_width(mining_threads, &dev_width);
|
||||
#endif
|
||||
}
|
||||
#ifdef HAVE_OPENCL
|
||||
if (cgpu->drv->drv_id == DRIVER_opencl) {
|
||||
gpu_threads += cgpu->threads;
|
||||
}
|
||||
#endif
|
||||
rwlock_init(&cgpu->qlock);
|
||||
cgpu->queued_work = NULL;
|
||||
}
|
||||
@ -7611,11 +7567,9 @@ int main(int argc, char *argv[])
|
||||
|
||||
INIT_LIST_HEAD(&scan_devices);
|
||||
|
||||
#ifdef HAVE_OPENCL
|
||||
memset(gpus, 0, sizeof(gpus));
|
||||
for (i = 0; i < MAX_GPUDEVICES; i++)
|
||||
gpus[i].dynamic = true;
|
||||
#endif
|
||||
|
||||
/* parse command line */
|
||||
opt_register_table(opt_config_table,
|
||||
@ -7895,11 +7849,9 @@ begin_bench:
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef HAVE_OPENCL
|
||||
applog(LOG_INFO, "%d gpu miner threads started", gpu_threads);
|
||||
for (i = 0; i < nDevs; i++)
|
||||
pause_dynamic_threads(i);
|
||||
#endif
|
||||
|
||||
cgtime(&total_tv_start);
|
||||
cgtime(&total_tv_end);
|
||||
@ -7918,7 +7870,6 @@ begin_bench:
|
||||
quit(1, "watchdog thread create failed");
|
||||
pthread_detach(thr->pth);
|
||||
|
||||
#ifdef HAVE_OPENCL
|
||||
/* Create reinit gpu thread */
|
||||
gpur_thr_id = 5;
|
||||
thr = &control_thr[gpur_thr_id];
|
||||
@ -7927,7 +7878,6 @@ begin_bench:
|
||||
quit(1, "tq_new failed for gpur_thr_id");
|
||||
if (thr_info_create(thr, NULL, reinit_gpu, thr))
|
||||
quit(1, "reinit_gpu thread create failed");
|
||||
#endif
|
||||
|
||||
/* Create API socket thread */
|
||||
api_thr_id = 6;
|
||||
|
@ -158,7 +158,6 @@ if test "x$opencl" != xno; then
|
||||
]],
|
||||
[[return clSetKernelArg(0, 0, 0, 0); ]])],
|
||||
[AC_MSG_RESULT(yes)
|
||||
AC_DEFINE([HAVE_OPENCL], [1], [Defined to 1 if OpenCL is present on the system.])
|
||||
found_opencl=1
|
||||
],
|
||||
[AC_MSG_RESULT(no)
|
||||
|
@ -62,7 +62,6 @@ extern int gpu_fanspeed(int gpu);
|
||||
extern int gpu_fanpercent(int gpu);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_OPENCL
|
||||
char *set_vector(char *arg)
|
||||
{
|
||||
int i, val = 0, device = 0;
|
||||
@ -235,7 +234,6 @@ char *set_kernel(char *arg)
|
||||
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_ADL
|
||||
/* This function allows us to map an adl device to an opencl device for when
|
||||
@ -522,7 +520,7 @@ char *set_temp_target(char *arg)
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
#ifdef HAVE_OPENCL
|
||||
|
||||
char *set_intensity(char *arg)
|
||||
{
|
||||
int i, device = 0, *tt;
|
||||
@ -575,13 +573,10 @@ void print_ndevs(int *ndevs)
|
||||
clear_adl(*ndevs);
|
||||
applog(LOG_INFO, "%i GPU devices max detected", *ndevs);
|
||||
}
|
||||
#endif
|
||||
|
||||
struct cgpu_info gpus[MAX_GPUDEVICES]; /* Maximum number apparently possible */
|
||||
struct cgpu_info *cpus;
|
||||
|
||||
#ifdef HAVE_OPENCL
|
||||
|
||||
/* In dynamic mode, only the first thread of each device will be in use.
|
||||
* This potentially could start a thread that was stopped with the start-stop
|
||||
* options if one were to disable dynamic from the menu on a paused GPU */
|
||||
@ -605,9 +600,7 @@ void pause_dynamic_threads(int gpu)
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* HAVE_OPENCL */
|
||||
|
||||
#if defined(HAVE_OPENCL) && defined(HAVE_CURSES)
|
||||
#if defined(HAVE_CURSES)
|
||||
void manage_gpu(void)
|
||||
{
|
||||
struct thr_info *thr;
|
||||
@ -832,8 +825,6 @@ void manage_gpu(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef HAVE_OPENCL
|
||||
static _clState *clStates[MAX_GPUDEVICES];
|
||||
|
||||
#define CL_SET_BLKARG(blkvar) status |= clSetKernelArg(*kernel, num++, sizeof(uint), (void *)&blk->blkvar)
|
||||
@ -880,10 +871,7 @@ static void set_threads_hashes(unsigned int vectors,int64_t *hashes, size_t *glo
|
||||
*globalThreads = threads;
|
||||
*hashes = threads * vectors;
|
||||
}
|
||||
#endif /* HAVE_OPENCL */
|
||||
|
||||
|
||||
#ifdef HAVE_OPENCL
|
||||
/* We have only one thread that ever re-initialises GPUs, thus if any GPU
|
||||
* init command fails due to a completely wedged GPU, the thread will never
|
||||
* return, unable to harm other GPUs. If it does return, it means we only had
|
||||
@ -990,15 +978,7 @@ select_cgpu:
|
||||
out:
|
||||
return NULL;
|
||||
}
|
||||
#else
|
||||
void *reinit_gpu(__maybe_unused void *userdata)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef HAVE_OPENCL
|
||||
static void opencl_detect(bool hotplug)
|
||||
{
|
||||
int i;
|
||||
@ -1322,4 +1302,3 @@ struct device_drv opencl_drv = {
|
||||
.scanhash = opencl_scanhash,
|
||||
.thread_shutdown = opencl_thread_shutdown,
|
||||
};
|
||||
#endif
|
||||
|
@ -9,7 +9,6 @@
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#ifdef HAVE_OPENCL
|
||||
|
||||
#include <stdio.h>
|
||||
#include <inttypes.h>
|
||||
@ -233,4 +232,3 @@ void postcalc_hash_async(struct thr_info *thr, struct work *work, uint32_t *res)
|
||||
return;
|
||||
}
|
||||
}
|
||||
#endif /* HAVE_OPENCL */
|
||||
|
@ -9,8 +9,6 @@
|
||||
#define BUFFERSIZE (sizeof(uint32_t) * MAXBUFFERS)
|
||||
#define FOUND (0xFF)
|
||||
|
||||
#ifdef HAVE_OPENCL
|
||||
extern void precalc_hash(dev_blk_ctx *blk, uint32_t *state, uint32_t *data);
|
||||
extern void postcalc_hash_async(struct thr_info *thr, struct work *work, uint32_t *res);
|
||||
#endif /* HAVE_OPENCL */
|
||||
#endif /*__FINDNONCE_H__*/
|
||||
|
10
miner.h
10
miner.h
@ -31,13 +31,11 @@ extern char *curly;
|
||||
# include <netdb.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_OPENCL
|
||||
#ifdef __APPLE_CC__
|
||||
#include <OpenCL/opencl.h>
|
||||
#else
|
||||
#include <CL/cl.h>
|
||||
#endif
|
||||
#endif /* HAVE_OPENCL */
|
||||
|
||||
#ifdef STDC_HEADERS
|
||||
# include <stdlib.h>
|
||||
@ -460,7 +458,6 @@ struct cgpu_info {
|
||||
int64_t max_hashes;
|
||||
|
||||
const char *kname;
|
||||
#ifdef HAVE_OPENCL
|
||||
bool mapped;
|
||||
int virtual_gpu;
|
||||
int virtual_adl;
|
||||
@ -477,7 +474,6 @@ struct cgpu_info {
|
||||
size_t shaders;
|
||||
struct timeval tv_gpustart;
|
||||
int intervals;
|
||||
#endif
|
||||
|
||||
bool new_work;
|
||||
|
||||
@ -1092,7 +1088,6 @@ extern uint64_t best_diff;
|
||||
extern struct timeval block_timeval;
|
||||
extern char *workpadding;
|
||||
|
||||
#ifdef HAVE_OPENCL
|
||||
typedef struct {
|
||||
cl_uint ctx_a; cl_uint ctx_b; cl_uint ctx_c; cl_uint ctx_d;
|
||||
cl_uint ctx_e; cl_uint ctx_f; cl_uint ctx_g; cl_uint ctx_h;
|
||||
@ -1119,11 +1114,6 @@ typedef struct {
|
||||
|
||||
struct work *work;
|
||||
} dev_blk_ctx;
|
||||
#else
|
||||
typedef struct {
|
||||
uint32_t nonce;
|
||||
} dev_blk_ctx;
|
||||
#endif
|
||||
|
||||
struct curl_ent {
|
||||
CURL *curl;
|
||||
|
2
ocl.c
2
ocl.c
@ -8,7 +8,6 @@
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#ifdef HAVE_OPENCL
|
||||
|
||||
#include <signal.h>
|
||||
#include <stdlib.h>
|
||||
@ -772,5 +771,4 @@ built:
|
||||
|
||||
return clState;
|
||||
}
|
||||
#endif /* HAVE_OPENCL */
|
||||
|
||||
|
2
ocl.h
2
ocl.h
@ -4,7 +4,6 @@
|
||||
#include "config.h"
|
||||
|
||||
#include <stdbool.h>
|
||||
#ifdef HAVE_OPENCL
|
||||
#ifdef __APPLE_CC__
|
||||
#include <OpenCL/opencl.h>
|
||||
#else
|
||||
@ -36,5 +35,4 @@ typedef struct {
|
||||
extern char *file_contents(const char *filename, int *length);
|
||||
extern int clDevicesNum(void);
|
||||
extern _clState *initCl(unsigned int gpu, char *name, size_t nameSize);
|
||||
#endif /* HAVE_OPENCL */
|
||||
#endif /* __OCL_H__ */
|
||||
|
Loading…
x
Reference in New Issue
Block a user