From 7fb69fe92412122b3a039cc08ff789e3514c0f22 Mon Sep 17 00:00:00 2001 From: Charlie Fenton Date: Thu, 17 Jul 2014 02:22:26 -0700 Subject: [PATCH] client: generalize naming scheme for OpenCL devices, add more general have_rsrc() functions --- client/gpu_detect.cpp | 4 +-- lib/coproc.cpp | 62 ++++++++++++++++++++++++++++++------------- lib/coproc.h | 33 ++++++++++++++++++----- 3 files changed, 71 insertions(+), 28 deletions(-) diff --git a/client/gpu_detect.cpp b/client/gpu_detect.cpp index 20aee1df9f..1eb668fcae 100644 --- a/client/gpu_detect.cpp +++ b/client/gpu_detect.cpp @@ -261,8 +261,8 @@ void COPROCS::correlate_gpus( // Create descriptions for other OpenCL GPUs // for (j=0; j= NPROC_TYPES) { + return "unknown"; } - return "unknown"; + return proc_type_names_xml[pt]; } const char* proc_type_name(int pt) { - switch(pt) { - case PROC_TYPE_CPU: return "CPU"; - case PROC_TYPE_NVIDIA_GPU: return "NVIDIA GPU"; - case PROC_TYPE_AMD_GPU: return "AMD/ATI GPU"; - case PROC_TYPE_INTEL_GPU: return "Intel GPU"; - case PROC_TYPE_OTHER_COPROC: return "OTHER COPROC"; + if (pt >= NPROC_TYPES) { + return "unknown"; } - return "unknown"; + return proc_type_names[pt]; } int coproc_type_name_to_num(const char* name) { - if (!strcmp(name, "CUDA")) return PROC_TYPE_NVIDIA_GPU; - if (!strcmp(name, "NVIDIA")) return PROC_TYPE_NVIDIA_GPU; - if (!strcmp(name, "ATI")) return PROC_TYPE_AMD_GPU; - if (!strcmp(name, "intel_gpu")) return PROC_TYPE_INTEL_GPU; - if (!strcmp(name, "OTHER_COPROC")) return PROC_TYPE_OTHER_COPROC; + int i; + for (i=1; i elements in an @@ -456,6 +473,8 @@ struct COPROCS { inline bool have_intel_gpu() { return (intel_gpu.count > 0); } + bool have_rsrc(int typeIndex); + bool have_rsrc(char* typeName); int add(COPROC& c) { if (n_rsc >= MAX_RSC) return ERR_BUFFER_OVERFLOW; for (int i=1; i