Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GPU list: strip leading "AMD" or "NVIDIA" from model to avoid dups in list #4354

Merged
merged 2 commits into from
May 7, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion html/user/gpu_list.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,18 @@

require_once("../inc/util.inc");

// strip leading AMD or NVIDIA
//
function strip_vendor($model) {
foreach (array("AMD ", "NVIDIA ") as $maker) {
Copy link
Member

@AenBleidd AenBleidd May 1, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd suggest to add "ATI " and "Intel(R) " to this list

$n = strlen($maker);
if (substr($model, 0, $n) == $maker) {
return substr($model, $n);
}
}
return $model;
}

// take a host.serialnum field (which may encode several GPUs)
// and extract the model name for the given vendor
//
Expand All @@ -37,7 +49,7 @@ function get_gpu_model($x, $vendor) {
$d = explode("|", $desc);
if ($d[0] == "BOINC") continue;
if ($d[0] != $vendor) continue;
return $d[1];
return strip_vendor(trim($d[1]));
}
return null;
}
Expand Down