Allow writing of multiple kernels to the configuration file.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
diff --git a/cgminer.c b/cgminer.c
index a57c25d..03a9b4d 100644
--- a/cgminer.c
+++ b/cgminer.c
@@ -191,7 +191,6 @@ struct block {
static struct block *blocks = NULL;
-char *opt_kernel = NULL;
char *opt_socks_proxy = NULL;
static const char def_conf[] = "cgminer.conf";
@@ -2334,6 +2333,26 @@ void write_config(FILE *fcfg)
for(i = 0; i < nDevs; i++)
fprintf(fcfg, "%s%d", i > 0 ? "," : "", gpus[i].adl.targettemp);
#endif
+ fputs("\",\n\"kernel\" : \"", fcfg);
+ for(i = 0; i < nDevs; i++) {
+ fprintf(fcfg, "%s", i > 0 ? "," : "");
+ switch (gpus[i].kernel) {
+ case KL_NONE: // Shouldn't happen
+ break;
+ case KL_POCLBM:
+ fprintf(fcfg, "poclbm");
+ break;
+ case KL_PHATK:
+ fprintf(fcfg, "phatk");
+ break;
+ case KL_DIAKGCN:
+ fprintf(fcfg, "diakgcn");
+ break;
+ case KL_DIABLO:
+ fprintf(fcfg, "diablo");
+ break;
+ }
+ }
fputs("\"", fcfg);
#ifdef WANT_CPUMINE
fputs(",\n", fcfg);
@@ -2380,8 +2399,6 @@ void write_config(FILE *fcfg)
if (opt_stderr_cmd && *opt_stderr_cmd)
fprintf(fcfg, ",\n\"monitor\" : \"%s\"", opt_stderr_cmd);
#endif // defined(unix)
- if (opt_kernel && *opt_kernel)
- fprintf(fcfg, ",\n\"kernel\" : \"%s\"", opt_kernel);
if (opt_kernel_path && *opt_kernel_path) {
char *kpath = strdup(opt_kernel_path);
if (kpath[strlen(kpath)-1] == '/')
diff --git a/ocl.c b/ocl.c
index a9d048d..d84d15a 100644
--- a/ocl.c
+++ b/ocl.c
@@ -379,6 +379,7 @@ _clState *initCl(unsigned int gpu, char *name, size_t nameSize)
applog(LOG_INFO, "Selecting diablo kernel");
clState->chosen_kernel = KL_DIABLO;
}
+ gpus[gpu].kernel = clState->chosen_kernel;
} else
clState->chosen_kernel = gpus[gpu].kernel;