Skip to content

Commit

Permalink
Merge pull request #4354 from BOINC/dpa_gpu_list
Browse files Browse the repository at this point in the history
GPU list: strip leading "AMD" or "NVIDIA" from model to avoid dups in list
  • Loading branch information
AenBleidd authored May 7, 2021
2 parents 53e5e6d + 508a22b commit 5f68764
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion html/user/gpu_list.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,19 @@

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

// strip leading AMD, NVIDIA, etc.
// This avoids showing the same model twice
//
function strip_vendor($model) {
foreach (array("AMD ", "NVIDIA ", "ATI ", "Intel(R) ") as $maker) {
$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 +50,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

0 comments on commit 5f68764

Please sign in to comment.