From 6c7835849069119368809f2a476f3c9ba01f5860 Mon Sep 17 00:00:00 2001 From: Charlie Fenton Date: Tue, 17 Jan 2012 14:06:27 +0000 Subject: [PATCH] client: Save all CUDA and CAL GPU info until done with OpenCL detection for use in OpenCL GPU descriptions svn path=/trunk/boinc/; revision=25083 --- checkin_notes | 7 ++++ client/coproc_detect.cpp | 85 +++++++++++++++++++++++----------------- 2 files changed, 55 insertions(+), 37 deletions(-) diff --git a/checkin_notes b/checkin_notes index 862344d2f7..61b167d66d 100644 --- a/checkin_notes +++ b/checkin_notes @@ -629,3 +629,10 @@ Charlie 17 Jan 2012 BOINCGUIApp.cpp mac_installer/ PosInstall.cpp + +Charlie 17 Jan 2012 + - client: Save all CUDA and CAL GPU info until done with OpenCL detection + so we have available GPU RAM for all OpenCL GPU descriptions. + + client/ + coproc_detect.cpp diff --git a/client/coproc_detect.cpp b/client/coproc_detect.cpp index 05ddc93569..66fdc32519 100644 --- a/client/coproc_detect.cpp +++ b/client/coproc_detect.cpp @@ -62,6 +62,9 @@ void segv_handler(int) { } #endif +vector ati_gpus; +vector nvidia_gpus; + void COPROCS::get( bool use_all, vector&descs, vector&warnings, @@ -109,6 +112,9 @@ void COPROCS::get( } signal(SIGSEGV, old_sig); #endif + + ati_gpus.clear(); + nvidia_gpus.clear(); } @@ -281,7 +287,6 @@ void COPROCS::get_opencl( if (strstr(prop.vendor, GPU_TYPE_NVIDIA)) { prop.device_num = (int)(nvidia_opencls.size()); - prop.opencl_available_ram = prop.global_mem_size; // CUDA info may overwrite this if (!nvidia.have_cuda) { COPROC_NVIDIA c; @@ -289,6 +294,12 @@ void COPROCS::get_opencl( c.set_peak_flops(); prop.peak_flops = c.peak_flops; } + if (nvidia_gpus.size()) { + // Assumes OpenCL and CAL return the same device with the same index + prop.opencl_available_ram = nvidia_gpus[prop.device_num].available_ram; + } else { + prop.opencl_available_ram = prop.global_mem_size; + } nvidia_opencls.push_back(prop); } if ((strstr(prop.vendor, GPU_TYPE_ATI)) || @@ -311,7 +322,6 @@ void COPROCS::get_opencl( prop.global_mem_size *= 2; } #endif - prop.opencl_available_ram = prop.global_mem_size; // CAL info may overwrite this if (!ati.have_cal) { COPROC_ATI c; @@ -319,6 +329,12 @@ void COPROCS::get_opencl( c.set_peak_flops(); prop.peak_flops = c.peak_flops; } + if (ati_gpus.size()) { + // Assumes OpenCL and CAL return the same device with the same index + prop.opencl_available_ram = ati_gpus[prop.device_num].available_ram; + } else { + prop.opencl_available_ram = prop.global_mem_size; + } ati_opencls.push_back(prop); } } @@ -548,7 +564,6 @@ void COPROC::merge_opencl( if (device_num == opencls[i].device_num) { opencl_prop = opencls[i]; opencl_device_ids[0] = opencls[i].device_id; - opencls[i].opencl_available_ram = available_ram; have_opencl = true; break; } @@ -556,8 +571,6 @@ void COPROC::merge_opencl( // Fill in info for other GPUs which CAL or CUDA found equivalent to best for (i=0; i<(unsigned int)count; ++i) { - opencl_device_ids[i] = opencls[device_nums[i]].device_id; - opencls[i].opencl_available_ram = available_ram; opencls[device_nums[i]].is_used = COPROC_USED; } opencl_device_count = count; @@ -845,7 +858,6 @@ void COPROC_NVIDIA::get( return; } - vector gpus; retval = (*__cuDeviceGetCount)(&cuda_ndevs); if (retval) { sprintf(buf, "cuDeviceGetCount() returned %d", retval); @@ -908,10 +920,10 @@ void COPROC_NVIDIA::get( cc.device_num = j; cc.set_peak_flops(); cc.get_available_ram(); - gpus.push_back(cc); + nvidia_gpus.push_back(cc); } - if (!gpus.size()) { + if (!nvidia_gpus.size()) { warnings.push_back("No CUDA-capable NVIDIA GPUs found"); return; } @@ -919,13 +931,13 @@ void COPROC_NVIDIA::get( // identify the most capable non-ignored instance // bool first = true; - for (i=0; i 0) { - *this = gpus[i]; + } else if (nvidia_compare(nvidia_gpus[i], *this, false) > 0) { + *this = nvidia_gpus[i]; } } @@ -933,17 +945,17 @@ void COPROC_NVIDIA::get( // and set the "count" and "device_nums" fields // count = 0; - for (i=0; i gpus; for (CALuint i=0; i 0) { - *this = gpus[i]; + } else if (ati_compare(ati_gpus[i], *this, false) > 0) { + *this = ati_gpus[i]; } } @@ -1378,17 +1389,17 @@ void COPROC_ATI::get( // and set the "count" and "device_nums" fields // count = 0; - for (i=0; i