Web: add option in gpu_desc() to show shorter version of GPU string

This commit is contained in:
David Anderson 2017-07-22 00:13:08 -07:00
parent ecbc1eb991
commit 7b6479f437
3 changed files with 30 additions and 29 deletions

View File

@ -245,7 +245,7 @@ function host_nresults($host) {
// Given string of the form [BOINC|vers][type|model|count|RAM|driver-vers][vbox|vers],
// return a human-readable version of the GPU info
//
function gpu_desc($x) {
function gpu_desc($x, $detail=true) {
$descs = explode("]", $x);
array_pop($descs);
$str = "";
@ -267,35 +267,35 @@ function gpu_desc($x) {
$str .= $d[0];
}
$str .= " ".$d[1];
$str .= " (".$d[3].")";
if (array_key_exists(4, $d)) {
if ($d[4] != "" && $d[4] != 0) {
// if version has no '.', assume it's in 100*maj+min form
//
if (strchr($d[4], '.')) {
$str .= " driver: ".$d[4];
} else {
$i = (int)$d[4];
$maj = (int)($i/100);
$min = $i%100;
$str .= sprintf(" driver: %d.%02d", $maj, $min);
if ($detail) {
$str .= " (".$d[3].")";
if (array_key_exists(4, $d)) {
if ($d[4] != "" && $d[4] != 0) {
// if version has no '.', assume it's in 100*maj+min form
//
if (strchr($d[4], '.')) {
$str .= " driver: ".$d[4];
} else {
$i = (int)$d[4];
$maj = (int)($i/100);
$min = $i%100;
$str .= sprintf(" driver: %d.%02d", $maj, $min);
}
}
}
if (array_key_exists(5, $d)) {
if ($d[5] != "" && $d[5] != 0) {
if (strchr($d[5], '.')) {
$str .= " OpenCL: ".$d[5];
} else {
$i = (int)$d[5];
$maj = (int)($i/100);
$min = $i%100;
$str .= sprintf(" OpenCL: %d.%d", $maj, $min);
}
}
}
}
if (array_key_exists(5, $d)) {
if ($d[5] != "" && $d[5] != 0) {
if (strchr($d[5], '.')) {
$str .= " OpenCL: ".$d[5];
} else {
$i = (int)$d[5];
$maj = (int)($i/100);
$min = $i%100;
$str .= sprintf(" OpenCL: %d.%d", $maj, $min);
}
}
}
}
if (!$str) $str = "---";
return $str;

View File

@ -222,7 +222,7 @@ function page_head(
$did_page_head = true;
$url_base = url_base();
$rssname = PROJECT . " RSS 2.0";
$rssname = "RSS 2.0";
$rsslink = $url_base."rss_main.php";
if (!$caching) {

View File

@ -102,7 +102,8 @@ if ($format=="xml"){
}
community_links($community_links, $logged_in_user);
end_table();
echo "</td></tr></table>";
echo "</td></tr>";
end_table();
page_tail(true);
}