mirror of
https://github.com/GOSTSec/sgminer
synced 2025-01-11 07:17:58 +00:00
Make it possible to select the choice of kernel on the command line.
This commit is contained in:
parent
116a9dc025
commit
a9e1a25518
30
main.c
30
main.c
@ -225,6 +225,10 @@ static char current_block[37];
|
|||||||
static char datestamp[40];
|
static char datestamp[40];
|
||||||
static char blockdate[40];
|
static char blockdate[40];
|
||||||
|
|
||||||
|
static char *opt_kernel = NULL;
|
||||||
|
|
||||||
|
enum cl_kernel chosen_kernel;
|
||||||
|
|
||||||
struct sigaction termhandler, inthandler;
|
struct sigaction termhandler, inthandler;
|
||||||
|
|
||||||
struct thread_q *getq;
|
struct thread_q *getq;
|
||||||
@ -503,6 +507,9 @@ static struct opt_table opt_config_table[] = {
|
|||||||
OPT_WITH_ARG("--intensity|-I",
|
OPT_WITH_ARG("--intensity|-I",
|
||||||
forced_int_1010, opt_show_intval, &scan_intensity,
|
forced_int_1010, opt_show_intval, &scan_intensity,
|
||||||
"Intensity of GPU scanning (-10 -> 10, default: dynamic to maintain desktop interactivity)"),
|
"Intensity of GPU scanning (-10 -> 10, default: dynamic to maintain desktop interactivity)"),
|
||||||
|
OPT_WITH_ARG("--kernel|-k",
|
||||||
|
opt_set_charp, NULL, &opt_kernel,
|
||||||
|
"Select kernel to use (poclbm or phatk - default: auto)"),
|
||||||
#endif
|
#endif
|
||||||
OPT_WITHOUT_ARG("--load-balance",
|
OPT_WITHOUT_ARG("--load-balance",
|
||||||
set_loadbalance, &pool_strategy,
|
set_loadbalance, &pool_strategy,
|
||||||
@ -2488,10 +2495,15 @@ static void *gpuminer_thread(void *userdata)
|
|||||||
bool requested = true;
|
bool requested = true;
|
||||||
uint32_t total_hashes = 0, hash_div = 1;
|
uint32_t total_hashes = 0, hash_div = 1;
|
||||||
|
|
||||||
if (clState->hasBitAlign)
|
switch (chosen_kernel) {
|
||||||
queue_kernel_parameters = &queue_phatk_kernel;
|
case KL_POCLBM:
|
||||||
else
|
queue_kernel_parameters = &queue_poclbm_kernel;
|
||||||
queue_kernel_parameters = &queue_poclbm_kernel;
|
break;
|
||||||
|
case KL_PHATK:
|
||||||
|
default:
|
||||||
|
queue_kernel_parameters = &queue_phatk_kernel;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if (opt_dynamic) {
|
if (opt_dynamic) {
|
||||||
/* Minimise impact on desktop if we want dynamic mode */
|
/* Minimise impact on desktop if we want dynamic mode */
|
||||||
@ -3233,6 +3245,16 @@ int main (int argc, char *argv[])
|
|||||||
if (argc != 1)
|
if (argc != 1)
|
||||||
quit(1, "Unexpected extra commandline arguments");
|
quit(1, "Unexpected extra commandline arguments");
|
||||||
|
|
||||||
|
if (opt_kernel) {
|
||||||
|
if (strcmp(opt_kernel, "poclbm") && strcmp(opt_kernel, "phatk"))
|
||||||
|
quit(1, "Invalid kernel name specified - must be poclbm or phatk");
|
||||||
|
if (!strcmp(opt_kernel, "poclbm"))
|
||||||
|
chosen_kernel = KL_POCLBM;
|
||||||
|
else
|
||||||
|
chosen_kernel = KL_PHATK;
|
||||||
|
} else
|
||||||
|
chosen_kernel = KL_NONE;
|
||||||
|
|
||||||
if (total_devices) {
|
if (total_devices) {
|
||||||
if (total_devices > nDevs)
|
if (total_devices > nDevs)
|
||||||
quit(1, "More devices specified than exist");
|
quit(1, "More devices specified than exist");
|
||||||
|
7
miner.h
7
miner.h
@ -308,6 +308,12 @@ struct work {
|
|||||||
struct pool *pool;
|
struct pool *pool;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum cl_kernel {
|
||||||
|
KL_NONE,
|
||||||
|
KL_POCLBM,
|
||||||
|
KL_PHATK,
|
||||||
|
};
|
||||||
|
|
||||||
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 kill_work(void);
|
extern void kill_work(void);
|
||||||
@ -323,5 +329,6 @@ extern void tq_thaw(struct thread_q *tq);
|
|||||||
extern bool test_and_set(bool *var);
|
extern bool test_and_set(bool *var);
|
||||||
extern bool test_and_clear(bool *var);
|
extern bool test_and_clear(bool *var);
|
||||||
extern bool successful_connect;
|
extern bool successful_connect;
|
||||||
|
extern enum cl_kernel chosen_kernel;
|
||||||
|
|
||||||
#endif /* __MINER_H__ */
|
#endif /* __MINER_H__ */
|
||||||
|
31
ocl.c
31
ocl.c
@ -340,10 +340,25 @@ _clState *initCl(unsigned int gpu, char *name, size_t nameSize)
|
|||||||
char binaryfilename[255];
|
char binaryfilename[255];
|
||||||
char numbuf[10];
|
char numbuf[10];
|
||||||
char filename[16];
|
char filename[16];
|
||||||
if (clState->hasBitAlign)
|
|
||||||
strcpy(filename, "phatk110722.cl");
|
if (chosen_kernel == KL_NONE) {
|
||||||
else
|
if (clState->hasBitAlign)
|
||||||
strcpy(filename, "poclbm110717.cl");
|
chosen_kernel = KL_PHATK;
|
||||||
|
else
|
||||||
|
chosen_kernel = KL_POCLBM;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (chosen_kernel) {
|
||||||
|
case KL_POCLBM:
|
||||||
|
strcpy(filename, "poclbm110717.cl");
|
||||||
|
strcpy(binaryfilename, "poclbm110717");
|
||||||
|
break;
|
||||||
|
case KL_PHATK:
|
||||||
|
strcpy(filename, "phatk110722.cl");
|
||||||
|
strcpy(binaryfilename, "phatk110722");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
FILE *binaryfile;
|
FILE *binaryfile;
|
||||||
size_t *binary_sizes;
|
size_t *binary_sizes;
|
||||||
char **binaries;
|
char **binaries;
|
||||||
@ -368,12 +383,10 @@ _clState *initCl(unsigned int gpu, char *name, size_t nameSize)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
strcpy(binaryfilename, name);
|
strcat(binaryfilename, name);
|
||||||
if (clState->hasBitAlign) {
|
if (clState->hasBitAlign)
|
||||||
strcat(binaryfilename, "phatk110722");
|
|
||||||
strcat(binaryfilename, "bitalign");
|
strcat(binaryfilename, "bitalign");
|
||||||
} else
|
|
||||||
strcat(binaryfilename, "poclbm110717");
|
|
||||||
strcat(binaryfilename, "v");
|
strcat(binaryfilename, "v");
|
||||||
sprintf(numbuf, "%d", clState->preferred_vwidth);
|
sprintf(numbuf, "%d", clState->preferred_vwidth);
|
||||||
strcat(binaryfilename, numbuf);
|
strcat(binaryfilename, numbuf);
|
||||||
|
Loading…
Reference in New Issue
Block a user