Browse Source

Make it possible to select the choice of kernel on the command line.

nfactor-troky
Con Kolivas 14 years ago
parent
commit
a9e1a25518
  1. 28
      main.c
  2. 7
      miner.h
  3. 25
      ocl.c

28
main.c

@ -225,6 +225,10 @@ static char current_block[37]; @@ -225,6 +225,10 @@ static char current_block[37];
static char datestamp[40];
static char blockdate[40];
static char *opt_kernel = NULL;
enum cl_kernel chosen_kernel;
struct sigaction termhandler, inthandler;
struct thread_q *getq;
@ -503,6 +507,9 @@ static struct opt_table opt_config_table[] = { @@ -503,6 +507,9 @@ static struct opt_table opt_config_table[] = {
OPT_WITH_ARG("--intensity|-I",
forced_int_1010, opt_show_intval, &scan_intensity,
"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
OPT_WITHOUT_ARG("--load-balance",
set_loadbalance, &pool_strategy,
@ -2488,10 +2495,15 @@ static void *gpuminer_thread(void *userdata) @@ -2488,10 +2495,15 @@ static void *gpuminer_thread(void *userdata)
bool requested = true;
uint32_t total_hashes = 0, hash_div = 1;
if (clState->hasBitAlign)
queue_kernel_parameters = &queue_phatk_kernel;
else
switch (chosen_kernel) {
case KL_POCLBM:
queue_kernel_parameters = &queue_poclbm_kernel;
break;
case KL_PHATK:
default:
queue_kernel_parameters = &queue_phatk_kernel;
break;
}
if (opt_dynamic) {
/* Minimise impact on desktop if we want dynamic mode */
@ -3233,6 +3245,16 @@ int main (int argc, char *argv[]) @@ -3233,6 +3245,16 @@ int main (int argc, char *argv[])
if (argc != 1)
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 > nDevs)
quit(1, "More devices specified than exist");

7
miner.h

@ -308,6 +308,12 @@ struct work { @@ -308,6 +308,12 @@ struct work {
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);
extern void kill_work(void);
@ -323,5 +329,6 @@ extern void tq_thaw(struct thread_q *tq); @@ -323,5 +329,6 @@ extern void tq_thaw(struct thread_q *tq);
extern bool test_and_set(bool *var);
extern bool test_and_clear(bool *var);
extern bool successful_connect;
extern enum cl_kernel chosen_kernel;
#endif /* __MINER_H__ */

25
ocl.c

@ -340,10 +340,25 @@ _clState *initCl(unsigned int gpu, char *name, size_t nameSize) @@ -340,10 +340,25 @@ _clState *initCl(unsigned int gpu, char *name, size_t nameSize)
char binaryfilename[255];
char numbuf[10];
char filename[16];
if (chosen_kernel == KL_NONE) {
if (clState->hasBitAlign)
strcpy(filename, "phatk110722.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;
size_t *binary_sizes;
char **binaries;
@ -368,12 +383,10 @@ _clState *initCl(unsigned int gpu, char *name, size_t nameSize) @@ -368,12 +383,10 @@ _clState *initCl(unsigned int gpu, char *name, size_t nameSize)
return NULL;
}
strcpy(binaryfilename, name);
if (clState->hasBitAlign) {
strcat(binaryfilename, "phatk110722");
strcat(binaryfilename, name);
if (clState->hasBitAlign)
strcat(binaryfilename, "bitalign");
} else
strcat(binaryfilename, "poclbm110717");
strcat(binaryfilename, "v");
sprintf(numbuf, "%d", clState->preferred_vwidth);
strcat(binaryfilename, numbuf);

Loading…
Cancel
Save