From c1125582ccf076f72c613c066c5fcfa987d5c37f Mon Sep 17 00:00:00 2001 From: David Anderson Date: Fri, 30 Apr 2021 14:06:13 -0700 Subject: [PATCH 1/2] GPU list: strip leading "AMD" or "NVIDIA" from model to avoid dups in list --- html/user/gpu_list.php | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/html/user/gpu_list.php b/html/user/gpu_list.php index c958c376c04..2532a83a7d8 100644 --- a/html/user/gpu_list.php +++ b/html/user/gpu_list.php @@ -26,6 +26,18 @@ require_once("../inc/util.inc"); +// strip leading AMD or NVIDIA +// +function strip_vendor($model) { + foreach (array("AMD ", "NVIDIA ") 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 // @@ -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; } From 508a22bda9d31f7b103b43665b3050742d12198d Mon Sep 17 00:00:00 2001 From: David Anderson Date: Mon, 3 May 2021 19:43:33 -0700 Subject: [PATCH 2/2] Add ATI, Intel(R) to GPU maker list --- html/user/gpu_list.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/html/user/gpu_list.php b/html/user/gpu_list.php index 2532a83a7d8..2eed68fe119 100644 --- a/html/user/gpu_list.php +++ b/html/user/gpu_list.php @@ -26,10 +26,11 @@ require_once("../inc/util.inc"); -// strip leading AMD or NVIDIA +// strip leading AMD, NVIDIA, etc. +// This avoids showing the same model twice // function strip_vendor($model) { - foreach (array("AMD ", "NVIDIA ") as $maker) { + foreach (array("AMD ", "NVIDIA ", "ATI ", "Intel(R) ") as $maker) { $n = strlen($maker); if (substr($model, 0, $n) == $maker) { return substr($model, $n);