From 98950663535ad4f02388670af8edeb0e45c759a3 Mon Sep 17 00:00:00 2001 From: Charlie Fenton Date: Wed, 14 May 2014 03:40:58 -0700 Subject: [PATCH] client: fix to commit 6b1a073 (don't try to run OpenCL jobs on non-OpenCL GPUs) For unknown reasons, testing opencl_device_ids[[i] works only for debug builds, so add a new array bool have_opencls[] to COPROC struct in which we record which devices are openCL-capable before we clear the ati_opencls and nvidia_opencls vectors. --- client/coproc_sched.cpp | 2 +- client/gpu_opencl.cpp | 2 ++ lib/coproc.h | 2 ++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/client/coproc_sched.cpp b/client/coproc_sched.cpp index 0ff91afadf..5459992c23 100644 --- a/client/coproc_sched.cpp +++ b/client/coproc_sched.cpp @@ -75,7 +75,7 @@ using std::vector; static inline bool can_use_gpu(RESULT* rp, COPROC* cp, int i) { if (gpu_excluded(rp->app, *cp, i)) return false; if (rp->avp->is_opencl()) { - if (cp->opencl_device_ids[i] == 0) return false; + if (!cp->have_opencls[i]) return false; } return true; } diff --git a/client/gpu_opencl.cpp b/client/gpu_opencl.cpp index 8e8572b88e..ba30333496 100644 --- a/client/gpu_opencl.cpp +++ b/client/gpu_opencl.cpp @@ -824,6 +824,7 @@ void COPROC::merge_opencl( opencls[j].is_used = COPROC_USED; opencl_device_indexes[opencl_device_count] = opencls[j].opencl_device_index; opencl_device_ids[opencl_device_count++] = opencls[j].device_id; + have_opencls[i] = true; } } } @@ -873,6 +874,7 @@ void COPROC::find_best_opencls( continue; } if (use_all || !opencl_compare(opencls[i], opencl_prop, true)) { + have_opencls[count] = true; device_nums[count++] = opencls[i].device_num; opencl_device_indexes[opencl_device_count] = opencls[i].opencl_device_index; opencl_device_ids[opencl_device_count++] = opencls[i].device_id; diff --git a/lib/coproc.h b/lib/coproc.h index 3f3539d793..8157cdf892 100644 --- a/lib/coproc.h +++ b/lib/coproc.h @@ -165,6 +165,7 @@ struct COPROC { // int device_nums[MAX_COPROC_INSTANCES]; int device_num; // temp used in scan process + bool have_opencls[MAX_COPROC_INSTANCES]; cl_device_id opencl_device_ids[MAX_COPROC_INSTANCES]; int opencl_device_count; int opencl_device_indexes[MAX_COPROC_INSTANCES]; @@ -205,6 +206,7 @@ struct COPROC { available_ram = 0; for (int i=0; i