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.
This commit is contained in:
Charlie Fenton 2014-05-14 03:40:58 -07:00
parent 4004ad913b
commit 9895066353
3 changed files with 5 additions and 1 deletions

View File

@ -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;
}

View File

@ -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;

View File

@ -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<MAX_COPROC_INSTANCES; i++) {
device_nums[i] = 0;
have_opencls[i] = false;
opencl_device_ids[i] = 0;
opencl_device_indexes[i] = 0;
running_graphics_app[i] = true;