From 99bbddf467d7a34b749d6bfc87ed21696d83768b Mon Sep 17 00:00:00 2001 From: Charlie Fenton Date: Fri, 25 Mar 2011 14:08:50 +0000 Subject: [PATCH] client: Continue adding OpenCL support svn path=/trunk/boinc/; revision=23260 --- client/coproc_detect.cpp | 30 ++++++++++++++++++++---------- lib/coproc.h | 5 ++++- 2 files changed, 24 insertions(+), 11 deletions(-) diff --git a/client/coproc_detect.cpp b/client/coproc_detect.cpp index fdfef8eded..616ddc55d4 100644 --- a/client/coproc_detect.cpp +++ b/client/coproc_detect.cpp @@ -206,23 +206,33 @@ void COPROCS::get_opencl(vector&warnings) { if (ciErrNum != CL_SUCCESS) return; if (!strcmp(prop.vendor, "NVIDIA")) { - if (!nvidia.opencl_prop.name[0]) { // If not already merged - if (nvidia.matches(prop)) { - nvidia.opencl_prop = prop; - return; + if (nvidia.matches(prop)) { + nvidia.opencl_prop = prop; + nvidia.opencl_device_ids[nvidia.opencl_device_num++] = prop.device_id; + } else { + if (!nvidia.cuda_version) { // If CUDA did not find any previously + nvidia.opencl_prop = prop; // fill in what info we have + nvidia.opencl_device_ids[nvidia.opencl_device_num++] = prop.device_id; + strcpy(nvidia.prop.name, prop.name); + nvidia.prop.totalGlobalMem = prop.global_RAM; + nvidia.prop.clockRate = prop.max_clock_freq * 1000; } -//TODO: Create a new entry if not already in CUDA list? } return; } if (!(strcmp(prop.vendor, "ATI") || strcmp(prop.vendor, "AMD"))) { - if (!ati.opencl_prop.name[0]) { // If not already merged - if (ati.matches(prop)) { - ati.opencl_prop = prop; - return; + if (ati.matches(prop)) { + ati.opencl_prop = prop; + ati.opencl_device_ids[ati.opencl_device_num++] = prop.device_id; + } else { + if (! (ati.atirt_detected || ati.amdrt_detected)) { // If ATI did not find any previously + ati.opencl_prop = prop; // fill in what info we have + ati.opencl_device_ids[ati.opencl_device_num++] = prop.device_id; + strcpy(ati.name, prop.name); + ati.attribs.localRAM = prop.local_RAM; + ati.attribs.engineClock = prop.max_clock_freq; } -//TODO: Create a new entry if not already in ATI list due from CAL? } return; } diff --git a/lib/coproc.h b/lib/coproc.h index e634c8a769..88f946dff8 100644 --- a/lib/coproc.h +++ b/lib/coproc.h @@ -153,8 +153,9 @@ struct COPROC { // These are not sequential if we omit instances (see above) // int device_nums[MAX_COPROC_INSTANCES]; - int open_device_ids[MAX_COPROC_INSTANCES]; int device_num; // temp used in scan process + cl_device_id opencl_device_ids[MAX_COPROC_INSTANCES]; + int opencl_device_num; bool running_graphics_app[MAX_COPROC_INSTANCES]; // is this GPU running a graphics app (NVIDIA only) double available_ram[MAX_COPROC_INSTANCES]; @@ -178,9 +179,11 @@ struct COPROC { used = 0; req_secs = 0; req_instances = 0; + opencl_device_num = 0; estimated_delay = 0; for (int i=0; i