From b050deecf7fc327fa3e38a4ffaca02540590dce5 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Mon, 18 Jun 2012 20:41:37 +0000 Subject: [PATCH] - client: compile fixes svn path=/trunk/boinc/; revision=25773 --- checkin_notes | 10 +++++++ client/gpu_amd.cpp | 2 +- client/gpu_nvidia.cpp | 2 +- client/gpu_opencl.cpp | 2 +- lib/coproc.cpp | 70 ++++++++++++++++++++++++++++++------------- lib/coproc.h | 11 +++++-- 6 files changed, 70 insertions(+), 27 deletions(-) diff --git a/checkin_notes b/checkin_notes index 45cac2eeb2..b67ea734a5 100644 --- a/checkin_notes +++ b/checkin_notes @@ -4405,3 +4405,13 @@ David 18 June 2012 client/ gpu_detect.cpp,h Makefile.am + +David 18 June 2012 + - client: compile fixes + + client/ + gpu_opencl.cpp + gpu_amd.cpp + gpu_nvidia.cpp + lib/ + coproc.cpp,h diff --git a/client/gpu_amd.cpp b/client/gpu_amd.cpp index 021a836049..29595b08ec 100644 --- a/client/gpu_amd.cpp +++ b/client/gpu_amd.cpp @@ -43,7 +43,7 @@ using std::string; #include "util.h" #include "client_msgs.h" -#include "gpu.h" +#include "gpu_detect.h" // criteria: // diff --git a/client/gpu_nvidia.cpp b/client/gpu_nvidia.cpp index cc4c78e6a1..be35b58e12 100644 --- a/client/gpu_nvidia.cpp +++ b/client/gpu_nvidia.cpp @@ -39,7 +39,7 @@ using std::string; #include "util.h" #include "client_msgs.h" -#include "gpu.h" +#include "gpu_detect.h" // return 1/-1/0 if device 1 is more/less/same capable than device 2. // factors (decreasing priority): diff --git a/client/gpu_opencl.cpp b/client/gpu_opencl.cpp index a5c90335ee..7729b8bd9b 100644 --- a/client/gpu_opencl.cpp +++ b/client/gpu_opencl.cpp @@ -39,7 +39,7 @@ using std::string; #include "util.h" #include "client_msgs.h" -#include "gpu.h" +#include "gpu_detect.h" #ifdef _WIN32 diff --git a/lib/coproc.cpp b/lib/coproc.cpp index c5c339fafd..1df7d682c2 100644 --- a/lib/coproc.cpp +++ b/lib/coproc.cpp @@ -70,8 +70,34 @@ int COPROC_REQ::parse(XML_PARSER& xp) { return ERR_XML_PARSE; } +int PCI_INFO::parse(XML_PARSER& xp) { + present = false; + bus_id = device_id = domain_id = 0; + while (!xp.get_tag()) { + if (xp.match_tag("/pci_info")) { + return 0; + } + if (xp.parse_int("bus_id", bus_id)) continue; + if (xp.parse_int("device_id", device_id)) continue; + if (xp.parse_int("domain_id", domain_id)) continue; + } + return ERR_XML_PARSE; +} + #ifndef _USING_FCGI_ +void PCI_INFO::write(MIOFILE& f) { + f.printf( + "\n" + " %d\n" + " %d\n" + " %d\n", + bus_id, + device_id, + domain_id + ); +} + void COPROC::write_xml(MIOFILE& f) { f.printf( "\n" @@ -332,15 +358,15 @@ int COPROCS::parse(XML_PARSER& xp) { return ERR_XML_PARSE; } -void COPROCS::write_xml(MIOFILE& mf, bool include_request) { +void COPROCS::write_xml(MIOFILE& mf, bool scheduler_rpc) { #ifndef _USING_FCGI_ //TODO: Write coprocs[0] through coprocs[n_rsc] mf.printf(" \n"); if (nvidia.count) { - nvidia.write_xml(mf, include_request); + nvidia.write_xml(mf, scheduler_rpc); } if (ati.count) { - ati.write_xml(mf, include_request); + ati.write_xml(mf, scheduler_rpc); } mf.printf(" \n"); #endif @@ -376,7 +402,7 @@ void COPROC_NVIDIA::description(char* buf) { } #ifndef _USING_FCGI_ -void COPROC_NVIDIA::write_xml(MIOFILE& f, bool include_request) { +void COPROC_NVIDIA::write_xml(MIOFILE& f, bool scheduler_rpc) { f.printf( "\n" " %d\n" @@ -390,7 +416,7 @@ void COPROC_NVIDIA::write_xml(MIOFILE& f, bool include_request) { have_cuda ? 1 : 0, have_opencl ? 1 : 0 ); - if (include_request) { + if (scheduler_rpc) { write_request(f); } f.printf( @@ -411,10 +437,7 @@ void COPROC_NVIDIA::write_xml(MIOFILE& f, bool include_request) { " %d\n" " %u\n" " %d\n" - " %d\n" - " %d\n" - " %d\n" - " %d\n", + " %d\n", peak_flops, cuda_version, display_driver_version, @@ -432,15 +455,18 @@ void COPROC_NVIDIA::write_xml(MIOFILE& f, bool include_request) { prop.minor, (unsigned int)prop.textureAlignment, prop.deviceOverlap, - prop.multiProcessorCount, - prop.pciBusID, - prop.pciDeviceID, - prop.pciDomainID + prop.multiProcessorCount ); if (have_opencl) { opencl_prop.write_xml(f); } + + if (!scheduler_rpc) { + for (int i=0; i\n"); } @@ -473,14 +499,12 @@ void COPROC_NVIDIA::clear() { prop.textureAlignment = 0; prop.deviceOverlap = 0; prop.multiProcessorCount = 0; - prop.pciBusID = 0; - prop.pciDeviceID = 0; - prop.pciDomainID = 0; } int COPROC_NVIDIA::parse(XML_PARSER& xp) { char buf2[256]; int retval; + int ipci = 0; clear(); while (!xp.get_tag()) { @@ -548,9 +572,13 @@ int COPROC_NVIDIA::parse(XML_PARSER& xp) { if (xp.parse_int("textureAlignment", (int&)prop.textureAlignment)) continue; if (xp.parse_int("deviceOverlap", prop.deviceOverlap)) continue; if (xp.parse_int("multiProcessorCount", prop.multiProcessorCount)) continue; - if (xp.parse_int("pciBusID", prop.pciBusID)) continue; - if (xp.parse_int("pciDeviceID", prop.pciDeviceID)) continue; - if (xp.parse_int("pciDomainID", prop.pciDomainID)) continue; + if (xp.match_tag("pci_info")) { + PCI_INFO p; + p.parse(xp); + if (ipci < MAX_COPROC_INSTANCES) { + pci_infos[ipci++] = p; + } + } if (xp.match_tag("coproc_opencl")) { retval = opencl_prop.parse(xp); if (retval) return retval; @@ -637,7 +665,7 @@ void COPROC_NVIDIA::fake( ////////////////// ATI STARTS HERE ///////////////// #ifndef _USING_FCGI_ -void COPROC_ATI::write_xml(MIOFILE& f, bool include_request) { +void COPROC_ATI::write_xml(MIOFILE& f, bool scheduler_rpc) { f.printf( "\n" " %d\n" @@ -651,7 +679,7 @@ void COPROC_ATI::write_xml(MIOFILE& f, bool include_request) { have_cal ? 1 : 0, have_opencl ? 1 : 0 ); - if (include_request) { + if (scheduler_rpc) { write_request(f); } f.printf( diff --git a/lib/coproc.h b/lib/coproc.h index be38113c43..c89dfc52d6 100644 --- a/lib/coproc.h +++ b/lib/coproc.h @@ -105,9 +105,13 @@ struct COPROC_REQ { }; struct PCI_INFO { + bool present; int bus_id; int device_id; int domain_id; + + void write(MIOFILE&); + int parse(XML_PARSER&); }; // there's some duplication between the values in @@ -234,6 +238,7 @@ struct COPROC { running_graphics_app[i] = true; } memset(&opencl_prop, 0, sizeof(opencl_prop)); + memset(&pci_info, 0, sizeof(pci_info)); } inline void clear_usage() { for (int i=0; i &descs,