client: Fix OpenCL NVIDIA GPU detection when CUDA is not present

svn path=/trunk/boinc/; revision=25289
This commit is contained in:
Charlie Fenton 2012-02-18 11:41:08 +00:00
parent db928a240b
commit 71e75ee57e
2 changed files with 28 additions and 18 deletions

View File

@ -1859,3 +1859,9 @@ Charlie 17 Feb 2012
lib/ lib/
mac/ mac/
mac_backtrace.cpp mac_backtrace.cpp
Charlie 18 Feb 2012
- client: Fix OpenCL NVIDIA GPU detection when CUDA is not present.
client/
coproc_detect.cpp

View File

@ -368,26 +368,30 @@ strcpy(prop.opencl_driver_version, "CLH 1.0");
prop.get_device_version_int(); prop.get_device_version_int();
if (strstr(prop.vendor, GPU_TYPE_NVIDIA)) { if (strstr(prop.vendor, GPU_TYPE_NVIDIA)) {
// Mac OpenCL does not recognize all NVIDIA GPUs returned by if (nvidia.have_cuda) {
// CUDA but we assume that OpenCL and CUDA return devices in // Mac OpenCL does not recognize all NVIDIA GPUs returned by
// the same order and with identical model name strings // CUDA but we assume that OpenCL and CUDA return devices in
while(1) { // the same order and with identical model name strings
if (current_CUDA_index >= (int)(nvidia_gpus.size())) { while(1) {
if (log_flags.coproc_debug) { if (current_CUDA_index >= (int)(nvidia_gpus.size())) {
msg_printf(0, MSG_INFO, if (log_flags.coproc_debug) {
"[coproc] OpenCL NVIDIA index #%d does not match any CUDA device", msg_printf(0, MSG_INFO,
device_index "[coproc] OpenCL NVIDIA index #%d does not match any CUDA device",
); device_index
);
}
return; // Should never happen
} }
return; // Should never happen if (!strcmp(prop.name, nvidia_gpus[current_CUDA_index].prop.name)) {
break; // We have a match
}
// This CUDA GPU is not recognized by OpenCL, so try the next
++current_CUDA_index;
} }
if (!strcmp(prop.name, nvidia_gpus[current_CUDA_index].prop.name)) { prop.device_num = current_CUDA_index;
break; // We have a match } else {
} prop.device_num = device_index;
// This CUDA GPU is not recognized by OpenCL, so try the next
++current_CUDA_index;
} }
prop.device_num = current_CUDA_index;
prop.opencl_device_index = device_index; prop.opencl_device_index = device_index;
if (!nvidia.have_cuda) { if (!nvidia.have_cuda) {
@ -401,9 +405,9 @@ strcpy(prop.opencl_driver_version, "CLH 1.0");
prop.opencl_available_ram = nvidia_gpus[prop.device_num].available_ram; prop.opencl_available_ram = nvidia_gpus[prop.device_num].available_ram;
} else { } else {
prop.opencl_available_ram = prop.global_mem_size; prop.opencl_available_ram = prop.global_mem_size;
++current_CUDA_index;
} }
nvidia_opencls.push_back(prop); nvidia_opencls.push_back(prop);
++current_CUDA_index;
} }
if ((strstr(prop.vendor, GPU_TYPE_ATI)) || if ((strstr(prop.vendor, GPU_TYPE_ATI)) ||
(strstr(prop.vendor, "AMD")) || (strstr(prop.vendor, "AMD")) ||