diff --git a/client/gpu_opencl.cpp b/client/gpu_opencl.cpp index 62e7a441ef..d128aec482 100644 --- a/client/gpu_opencl.cpp +++ b/client/gpu_opencl.cpp @@ -36,10 +36,11 @@ using std::vector; using std::string; #include "coproc.h" -#include "util.h" #include "str_replace.h" +#include "util.h" #include "client_msgs.h" +#include "client_state.h" #include "gpu_detect.h" #ifdef _WIN32 @@ -410,7 +411,11 @@ void COPROCS::get_opencl( warnings.push_back("clGetDeviceInfo failed to get device type for Intel device"); continue; } - if (device_type == CL_DEVICE_TYPE_CPU) continue; + if (device_type == CL_DEVICE_TYPE_CPU) { + gstate.host_info.have_cpu_opencl = true; + gstate.host_info.cpu_opencl_prop = prop; + continue; + } prop.device_num = (int)(intel_gpu_opencls.size()); prop.opencl_device_index = device_index; @@ -429,7 +434,7 @@ void COPROCS::get_opencl( intel_gpu_opencls.push_back(prop); // At present Intel GPUs only support OpenCL and do not have a native - // GPGPU framework, so treat each detected Intel OpenCL GPU device as + // GPGPU framework, so treat each detected Intel OpenCL GPU device as // a native device. intel_gpus.push_back(c); } @@ -438,7 +443,7 @@ void COPROCS::get_opencl( #ifdef __APPLE__ - // Work around a bug in OpenCL which returns only + // Work around a bug in OpenCL which returns only // 1/2 of total global RAM size. // This bug applies only to ATI GPUs, not to NVIDIA // This has already been fixed on latest Catalyst diff --git a/lib/coproc.cpp b/lib/coproc.cpp index 40f5476ced..38cdbdd53a 100644 --- a/lib/coproc.cpp +++ b/lib/coproc.cpp @@ -120,9 +120,9 @@ void COPROC::write_request(MIOFILE& f) { ); } -void OPENCL_DEVICE_PROP::write_xml(MIOFILE& f) { +void OPENCL_DEVICE_PROP::write_xml(MIOFILE& f, const char* tag) { f.printf( - " \n" + " <%s>\n" " %s\n" " %s\n" " %lu\n" @@ -140,7 +140,8 @@ void OPENCL_DEVICE_PROP::write_xml(MIOFILE& f) { " %s\n" " %s\n" " %s\n" - " \n", + " \n", + tag, name, vendor, vendor_id, @@ -157,7 +158,8 @@ void OPENCL_DEVICE_PROP::write_xml(MIOFILE& f) { max_compute_units, opencl_platform_version, opencl_device_version, - opencl_driver_version + opencl_driver_version, + tag ); } @@ -192,12 +194,12 @@ int COPROC::parse(XML_PARSER& xp) { #endif -int OPENCL_DEVICE_PROP::parse(XML_PARSER& xp) { +int OPENCL_DEVICE_PROP::parse(XML_PARSER& xp, const char* end_tag) { int n; unsigned long long ull; while (!xp.get_tag()) { - if (xp.match_tag("/coproc_opencl")) { + if (xp.match_tag(end_tag)) { get_device_version_int(); get_opencl_driver_revision(); return 0; @@ -507,7 +509,7 @@ void COPROC_NVIDIA::write_xml(MIOFILE& f, bool scheduler_rpc) { ); if (have_opencl) { - opencl_prop.write_xml(f); + opencl_prop.write_xml(f, "coproc_opencl"); } if (!scheduler_rpc) { @@ -626,7 +628,7 @@ int COPROC_NVIDIA::parse(XML_PARSER& xp) { } } if (xp.match_tag("coproc_opencl")) { - retval = opencl_prop.parse(xp); + retval = opencl_prop.parse(xp, "/coproc_opencl"); if (retval) return retval; continue; } @@ -776,7 +778,7 @@ void COPROC_ATI::write_xml(MIOFILE& f, bool scheduler_rpc) { } if (have_opencl) { - opencl_prop.write_xml(f); + opencl_prop.write_xml(f, "coproc_opencl"); } f.printf("\n"); @@ -889,7 +891,7 @@ int COPROC_ATI::parse(XML_PARSER& xp) { continue; } if (xp.match_tag("coproc_opencl")) { - retval = opencl_prop.parse(xp); + retval = opencl_prop.parse(xp, "/coproc_opencl"); if (retval) return retval; continue; } @@ -966,7 +968,7 @@ void COPROC_INTEL::write_xml(MIOFILE& f, bool scheduler_rpc) { ); if (have_opencl) { - opencl_prop.write_xml(f); + opencl_prop.write_xml(f, "coproc_opencl"); } f.printf("\n"); @@ -1007,7 +1009,7 @@ int COPROC_INTEL::parse(XML_PARSER& xp) { if (xp.parse_str("version", version, sizeof(version))) continue; if (xp.match_tag("coproc_opencl")) { - retval = opencl_prop.parse(xp); + retval = opencl_prop.parse(xp, "/coproc_opencl"); if (retval) return retval; continue; } diff --git a/lib/coproc.h b/lib/coproc.h index c329289885..99a05a83c9 100644 --- a/lib/coproc.h +++ b/lib/coproc.h @@ -164,9 +164,9 @@ struct OPENCL_DEVICE_PROP { int opencl_device_index; // temp used in scan process #ifndef _USING_FCGI_ - void write_xml(MIOFILE&); + void write_xml(MIOFILE&, const char* tag); #endif - int parse(XML_PARSER&); + int parse(XML_PARSER&, const char* end_tag); void description(char* buf, const char* type); }; diff --git a/lib/hostinfo.cpp b/lib/hostinfo.cpp index 874e693fc0..72b292bbe9 100644 --- a/lib/hostinfo.cpp +++ b/lib/hostinfo.cpp @@ -70,6 +70,7 @@ void HOST_INFO::clear_host_info() { strcpy(os_version, ""); strcpy(virtualbox_version, ""); + have_cpu_opencl = false; } int HOST_INFO::parse(XML_PARSER& xp, bool benchmarks_only) { @@ -118,6 +119,10 @@ int HOST_INFO::parse(XML_PARSER& xp, bool benchmarks_only) { if (xp.match_tag("coprocs")) { this->coprocs.parse(xp); } + if (xp.match_tag("cpu_opencl_prop")) { + int retval = cpu_opencl_prop.parse(xp, "/cpu_opencl_prop"); + if (!retval) have_cpu_opencl = true; + } } return ERR_XML_PARSE; } @@ -200,6 +205,9 @@ int HOST_INFO::write( if (include_coprocs) { this->coprocs.write_xml(out, false); } + if (have_cpu_opencl) { + cpu_opencl_prop.write_xml(out, "cpu_opencl_prop"); + } out.printf( "\n" ); diff --git a/lib/hostinfo.h b/lib/hostinfo.h index 4b5fcbfc5f..36f4884217 100644 --- a/lib/hostinfo.h +++ b/lib/hostinfo.h @@ -67,6 +67,9 @@ public: COPROCS coprocs; + bool have_cpu_opencl; + OPENCL_DEVICE_PROP cpu_opencl_prop; + #ifdef ANDROID int battery_charge_pct; int battery_state;