client: group new (non-NVIDIA, non-AMD, non-INTEL) OpenCL device types by vendor name string rather than by CL_DEVICE_VENDOR_ID. This assumes that OpenCL reports identical vendor name strings for all devices from the same vendor on a given host. I incorrectly thought CL_DEVICE_VENDOR_ID was a numeric ID of the vendor which would be the same for each device from that vendor, but it is actually a unique numeric ID assigned by a given vendor to each device on a particular host.

This commit is contained in:
Charlie Fenton 2014-07-18 04:25:45 -07:00
parent 786184b2d1
commit 98f4c461d0
2 changed files with 13 additions and 3 deletions

View File

@ -478,7 +478,9 @@ int COPROCS::read_coproc_info_file(vector<string> &warnings) {
if (other_opencls[vendor_index].size() == 0) {
continue; // Should never happen
}
if (other_opencls[vendor_index][0].vendor_id == other_opencl.vendor_id) {
// Assumes that OpenCL reports identical vendor name strings
// for all devices from the same vendor on a given host.
if (!strcmp(other_opencls[vendor_index][0].vendor, other_opencl.vendor)) {
break; // This vector contains coproc(s) from same vendor
}
}

View File

@ -373,7 +373,13 @@ void COPROCS::get_opencl(
// TODO: Eliminate this, or improve it
#if TEST_OTHER_COPROC_LOGIC
safe_strcpy(prop.vendor, "Some Other GPU");
if (is_NVIDIA(prop.vendor)) {
safe_strcpy(prop.vendor, "FAKE VENDOR X");
} else if (is_AMD(prop.vendor)) {
safe_strcpy(prop.vendor, "FAKE VENDOR Y");
} else {
safe_strcpy(prop.vendor, "FAKE VENDOR Z");
}
#endif
prop.is_used = COPROC_UNUSED;
@ -532,7 +538,9 @@ void COPROCS::get_opencl(
if (other_opencls[vendor_index].size() == 0) {
continue; // Should never happen
}
if (other_opencls[vendor_index][0].vendor_id == prop.vendor_id) {
// Assumes that OpenCL reports identical vendor name strings
// for all devices from the same vendor on a given host.
if (!strcmp(other_opencls[vendor_index][0].vendor, prop.vendor)) {
break; // This vector contains coproc(s) from same vendor
}
}