mirror of
https://github.com/GOSTSec/sgminer
synced 2025-03-13 06:01:03 +00:00
Allow multiple different kernels to be chosen per device.
This commit is contained in:
parent
a54f76061b
commit
93efb726bb
@ -201,8 +201,6 @@ static bool config_loaded = false;
|
|||||||
static char *opt_stderr_cmd = NULL;
|
static char *opt_stderr_cmd = NULL;
|
||||||
#endif // defined(unix)
|
#endif // defined(unix)
|
||||||
|
|
||||||
enum cl_kernels chosen_kernel;
|
|
||||||
|
|
||||||
bool ping = true;
|
bool ping = true;
|
||||||
|
|
||||||
struct sigaction termhandler, inthandler;
|
struct sigaction termhandler, inthandler;
|
||||||
@ -711,8 +709,8 @@ static struct opt_table opt_config_table[] = {
|
|||||||
opt_set_charp, opt_show_charp, &opt_kernel_path,
|
opt_set_charp, opt_show_charp, &opt_kernel_path,
|
||||||
"Specify a path to where the kernel .cl files are"),
|
"Specify a path to where the kernel .cl files are"),
|
||||||
OPT_WITH_ARG("--kernel|-k",
|
OPT_WITH_ARG("--kernel|-k",
|
||||||
opt_set_charp, NULL, &opt_kernel,
|
set_kernel, NULL, NULL,
|
||||||
"Select kernel to use (diablo, poclbm, phatk or diakgcn - default: auto)"),
|
"Override kernel to use (diablo, poclbm, phatk or diakgcn) - one value or comma separated"),
|
||||||
#endif
|
#endif
|
||||||
OPT_WITHOUT_ARG("--load-balance",
|
OPT_WITHOUT_ARG("--load-balance",
|
||||||
set_loadbalance, &pool_strategy,
|
set_loadbalance, &pool_strategy,
|
||||||
|
59
device-gpu.c
59
device-gpu.c
@ -41,7 +41,6 @@ extern int opt_g_threads;
|
|||||||
extern bool ping;
|
extern bool ping;
|
||||||
extern bool opt_loginput;
|
extern bool opt_loginput;
|
||||||
extern char *opt_kernel_path;
|
extern char *opt_kernel_path;
|
||||||
extern char *opt_kernel;
|
|
||||||
extern int gpur_thr_id;
|
extern int gpur_thr_id;
|
||||||
extern bool opt_noadl;
|
extern bool opt_noadl;
|
||||||
extern bool have_opencl;
|
extern bool have_opencl;
|
||||||
@ -123,6 +122,47 @@ char *set_worksize(char *arg)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static enum cl_kernels select_kernel(char *arg)
|
||||||
|
{
|
||||||
|
if (!strcmp(arg, "diablo"))
|
||||||
|
return KL_DIABLO;
|
||||||
|
if (!strcmp(arg, "diakgcn"))
|
||||||
|
return KL_DIAKGCN;
|
||||||
|
if (!strcmp(arg, "poclbm"))
|
||||||
|
return KL_POCLBM;
|
||||||
|
if (!strcmp(arg, "phatk"))
|
||||||
|
return KL_PHATK;
|
||||||
|
return KL_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
|
char *set_kernel(char *arg)
|
||||||
|
{
|
||||||
|
enum cl_kernels kern;
|
||||||
|
int i, device = 0;
|
||||||
|
char *nextptr;
|
||||||
|
|
||||||
|
nextptr = strtok(arg, ",");
|
||||||
|
if (nextptr == NULL)
|
||||||
|
return "Invalid parameters for set kernel";
|
||||||
|
kern = select_kernel(nextptr);
|
||||||
|
if (kern == KL_NONE)
|
||||||
|
return "Invalid parameter to set_kernel";
|
||||||
|
gpus[device++].kernel = kern;
|
||||||
|
|
||||||
|
while ((nextptr = strtok(NULL, ",")) != NULL) {
|
||||||
|
kern = select_kernel(nextptr);
|
||||||
|
if (kern == KL_NONE)
|
||||||
|
return "Invalid parameter to set_kernel";
|
||||||
|
|
||||||
|
gpus[device++].kernel = kern;
|
||||||
|
}
|
||||||
|
if (device == 1) {
|
||||||
|
for (i = device; i < MAX_GPUDEVICES; i++)
|
||||||
|
gpus[i].kernel = gpus[0].kernel;
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_ADL
|
#ifdef HAVE_ADL
|
||||||
@ -1054,23 +1094,6 @@ static void opencl_detect()
|
|||||||
if (!nDevs)
|
if (!nDevs)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (opt_kernel) {
|
|
||||||
if (strcmp(opt_kernel, "poclbm") &&
|
|
||||||
strcmp(opt_kernel, "phatk") &&
|
|
||||||
strcmp(opt_kernel, "diakgcn") &&
|
|
||||||
strcmp(opt_kernel, "diablo"))
|
|
||||||
quit(1, "Invalid kernel name specified - must be diablo, poclbm, phatk or diakgcn");
|
|
||||||
if (!strcmp(opt_kernel, "diakgcn"))
|
|
||||||
chosen_kernel = KL_DIAKGCN;
|
|
||||||
else if (!strcmp(opt_kernel, "poclbm"))
|
|
||||||
chosen_kernel = KL_POCLBM;
|
|
||||||
else if (!strcmp(opt_kernel, "diablo"))
|
|
||||||
chosen_kernel = KL_DIABLO;
|
|
||||||
else
|
|
||||||
chosen_kernel = KL_PHATK;
|
|
||||||
} else
|
|
||||||
chosen_kernel = KL_NONE;
|
|
||||||
|
|
||||||
for (i = 0; i < nDevs; ++i) {
|
for (i = 0; i < nDevs; ++i) {
|
||||||
struct cgpu_info *cgpu;
|
struct cgpu_info *cgpu;
|
||||||
|
|
||||||
|
@ -17,6 +17,7 @@ extern char *set_temp_target(char *arg);
|
|||||||
extern char *set_intensity(char *arg);
|
extern char *set_intensity(char *arg);
|
||||||
extern char *set_vector(char *arg);
|
extern char *set_vector(char *arg);
|
||||||
extern char *set_worksize(char *arg);
|
extern char *set_worksize(char *arg);
|
||||||
|
extern char *set_kernel(char *arg);
|
||||||
void manage_gpu(void);
|
void manage_gpu(void);
|
||||||
extern void pause_dynamic_threads(int gpu);
|
extern void pause_dynamic_threads(int gpu);
|
||||||
|
|
||||||
|
18
miner.h
18
miner.h
@ -213,6 +213,14 @@ enum dev_enable {
|
|||||||
DEV_RECOVER,
|
DEV_RECOVER,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum cl_kernels {
|
||||||
|
KL_NONE,
|
||||||
|
KL_POCLBM,
|
||||||
|
KL_PHATK,
|
||||||
|
KL_DIAKGCN,
|
||||||
|
KL_DIABLO,
|
||||||
|
};
|
||||||
|
|
||||||
struct cgpu_info {
|
struct cgpu_info {
|
||||||
int cgminer_id;
|
int cgminer_id;
|
||||||
struct device_api *api;
|
struct device_api *api;
|
||||||
@ -243,6 +251,7 @@ struct cgpu_info {
|
|||||||
bool dynamic;
|
bool dynamic;
|
||||||
cl_uint vwidth;
|
cl_uint vwidth;
|
||||||
size_t work_size;
|
size_t work_size;
|
||||||
|
enum cl_kernels kernel;
|
||||||
|
|
||||||
float temp;
|
float temp;
|
||||||
int cutofftemp;
|
int cutofftemp;
|
||||||
@ -587,14 +596,6 @@ struct work {
|
|||||||
UT_hash_handle hh;
|
UT_hash_handle hh;
|
||||||
};
|
};
|
||||||
|
|
||||||
enum cl_kernels {
|
|
||||||
KL_NONE,
|
|
||||||
KL_POCLBM,
|
|
||||||
KL_PHATK,
|
|
||||||
KL_DIAKGCN,
|
|
||||||
KL_DIABLO,
|
|
||||||
};
|
|
||||||
|
|
||||||
extern void get_datestamp(char *, struct timeval *);
|
extern void get_datestamp(char *, struct timeval *);
|
||||||
bool submit_nonce(struct thr_info *thr, struct work *work, uint32_t nonce);
|
bool submit_nonce(struct thr_info *thr, struct work *work, uint32_t nonce);
|
||||||
extern void tailsprintf(char *f, const char *fmt, ...);
|
extern void tailsprintf(char *f, const char *fmt, ...);
|
||||||
@ -614,7 +615,6 @@ extern void *tq_pop(struct thread_q *tq, const struct timespec *abstime);
|
|||||||
extern void tq_freeze(struct thread_q *tq);
|
extern void tq_freeze(struct thread_q *tq);
|
||||||
extern void tq_thaw(struct thread_q *tq);
|
extern void tq_thaw(struct thread_q *tq);
|
||||||
extern bool successful_connect;
|
extern bool successful_connect;
|
||||||
extern enum cl_kernels chosen_kernel;
|
|
||||||
extern void adl(void);
|
extern void adl(void);
|
||||||
|
|
||||||
#endif /* __MINER_H__ */
|
#endif /* __MINER_H__ */
|
||||||
|
4
ocl.c
4
ocl.c
@ -364,7 +364,7 @@ _clState *initCl(unsigned int gpu, char *name, size_t nameSize)
|
|||||||
char filename[255];
|
char filename[255];
|
||||||
char numbuf[10];
|
char numbuf[10];
|
||||||
|
|
||||||
if (chosen_kernel == KL_NONE) {
|
if (gpus[gpu].kernel == KL_NONE) {
|
||||||
/* If no binary is available, and we have a card that suffers with diablo
|
/* If no binary is available, and we have a card that suffers with diablo
|
||||||
* on SDK2.6, use the poclbm kernel instead if one has not been
|
* on SDK2.6, use the poclbm kernel instead if one has not been
|
||||||
* selected. */
|
* selected. */
|
||||||
@ -380,7 +380,7 @@ _clState *initCl(unsigned int gpu, char *name, size_t nameSize)
|
|||||||
clState->chosen_kernel = KL_DIABLO;
|
clState->chosen_kernel = KL_DIABLO;
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
clState->chosen_kernel = chosen_kernel;
|
clState->chosen_kernel = gpus[gpu].kernel;
|
||||||
|
|
||||||
switch (clState->chosen_kernel) {
|
switch (clState->chosen_kernel) {
|
||||||
case KL_POCLBM:
|
case KL_POCLBM:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user