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/
mac/
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();
if (strstr(prop.vendor, GPU_TYPE_NVIDIA)) {
// Mac OpenCL does not recognize all NVIDIA GPUs returned by
// CUDA but we assume that OpenCL and CUDA return devices in
// the same order and with identical model name strings
while(1) {
if (current_CUDA_index >= (int)(nvidia_gpus.size())) {
if (log_flags.coproc_debug) {
msg_printf(0, MSG_INFO,
"[coproc] OpenCL NVIDIA index #%d does not match any CUDA device",
device_index
);
if (nvidia.have_cuda) {
// Mac OpenCL does not recognize all NVIDIA GPUs returned by
// CUDA but we assume that OpenCL and CUDA return devices in
// the same order and with identical model name strings
while(1) {
if (current_CUDA_index >= (int)(nvidia_gpus.size())) {
if (log_flags.coproc_debug) {
msg_printf(0, MSG_INFO,
"[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)) {
break; // We have a match
}
// This CUDA GPU is not recognized by OpenCL, so try the next
++current_CUDA_index;
prop.device_num = current_CUDA_index;
} else {
prop.device_num = device_index;
}
prop.device_num = current_CUDA_index;
prop.opencl_device_index = device_index;
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;
} else {
prop.opencl_available_ram = prop.global_mem_size;
++current_CUDA_index;
}
nvidia_opencls.push_back(prop);
++current_CUDA_index;
}
if ((strstr(prop.vendor, GPU_TYPE_ATI)) ||
(strstr(prop.vendor, "AMD")) ||