Add verbose message when a GPU fails to initialise, and disable the correct GPU.
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
diff --git a/main.c b/main.c
index 106c303..98edf71 100644
--- a/main.c
+++ b/main.c
@@ -5007,6 +5007,8 @@ int main (int argc, char *argv[])
get_datestamp(datestamp, &total_tv_start);
#ifdef HAVE_OPENCL
+ bool failmessage = false;
+
/* start GPU mining threads */
for (i = 0; i < nDevs * opt_g_threads; i++) {
int gpu = i % nDevs;
@@ -5036,8 +5038,21 @@ int main (int argc, char *argv[])
applog(LOG_INFO, "Init GPU thread %i", i);
clStates[i] = initCl(gpu, name, sizeof(name));
if (!clStates[i]) {
- applog(LOG_ERR, "Failed to init GPU thread %d", i);
- gpu_devices[i] = false;
+ enable_curses();
+ applog(LOG_ERR, "Failed to init GPU thread %d, disabling device %d", i, gpu);
+ if (!failmessage) {
+ char *buf;
+
+ applog(LOG_ERR, "The most common reason for this failure is cgminer being unable to read the kernel .cl files");
+ applog(LOG_ERR, "You must either CD into the directory you are running cgminer from,");
+ applog(LOG_ERR, "or run it from a 'make install'ed location. ");
+ applog(LOG_ERR, "Alternatively if it has failed on different GPUs, restarting might help.");
+ failmessage = true;
+ buf = curses_input("Press enter to continue");
+ if (buf)
+ free(buf);
+ }
+ gpu_devices[gpu] = false;
continue;
}
applog(LOG_INFO, "initCl() finished. Found %s", name);