2011-08-30 05:54:34 +00:00
|
|
|
<?php
|
|
|
|
|
2011-08-31 20:09:58 +00:00
|
|
|
// This file is part of BOINC.
|
|
|
|
// http://boinc.berkeley.edu
|
|
|
|
// Copyright (C) 2011 University of California
|
|
|
|
//
|
|
|
|
// BOINC is free software; you can redistribute it and/or modify it
|
|
|
|
// under the terms of the GNU Lesser General Public License
|
|
|
|
// as published by the Free Software Foundation,
|
|
|
|
// either version 3 of the License, or (at your option) any later version.
|
|
|
|
//
|
|
|
|
// BOINC is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
// See the GNU Lesser General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU Lesser General Public License
|
|
|
|
// along with BOINC. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
// generate a page of the best-performing GPU models.
|
|
|
|
//
|
|
|
|
// "best-performing" is defined as minimizing the average of
|
|
|
|
//
|
|
|
|
// elapsed_time(J)/rsc_fpops_est(J)
|
|
|
|
// over completed jobs J currently in the DB
|
|
|
|
|
2011-08-30 05:54:34 +00:00
|
|
|
require_once("../inc/util.inc");
|
|
|
|
|
|
|
|
function get_gpu_model($x, $vendor) {
|
|
|
|
$descs = explode("]", $x);
|
|
|
|
array_pop($descs);
|
|
|
|
foreach ($descs as $desc) {
|
|
|
|
$desc = trim($desc, "[");
|
|
|
|
$d = explode("|", $desc);
|
|
|
|
if ($d[0] == "BOINC") continue;
|
|
|
|
if ($d[0] != $vendor) continue;
|
|
|
|
return $d[1];
|
|
|
|
}
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2011-09-01 05:05:53 +00:00
|
|
|
function add_model($model, $r, $wu, &$models) {
|
2011-08-30 05:54:34 +00:00
|
|
|
if (array_key_exists($model, $models)) {
|
2011-08-30 21:39:05 +00:00
|
|
|
$models[$model]->count++;
|
|
|
|
$models[$model]->time += $r->elapsed_time;
|
2011-08-30 05:54:34 +00:00
|
|
|
} else {
|
2011-11-16 19:47:40 +00:00
|
|
|
$x = null;
|
|
|
|
$x->count = 1;
|
|
|
|
$x->time = $r->elapsed_time/$wu->rsc_fpops_est;
|
2011-08-30 21:39:05 +00:00
|
|
|
$models[$model] = $x;
|
2011-08-30 05:54:34 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// return a data structure containing GPU usage info for a vendor
|
|
|
|
// $x->total: combined list
|
|
|
|
// $x->windows
|
|
|
|
// $x->linux
|
|
|
|
// $x->mac
|
|
|
|
//
|
2011-11-16 19:47:40 +00:00
|
|
|
function get_gpu_list($vendor, $alt_vendor=null) {
|
|
|
|
$clause = "plan_class like '%$vendor%'";
|
|
|
|
if ($alt_vendor) {
|
|
|
|
$clause .= " or plan_class like '%$alt_vendor%'";
|
|
|
|
}
|
|
|
|
$avs = BoincAppVersion::enum($clause);
|
|
|
|
if (count($avs) == 0) return null;
|
2011-08-30 05:54:34 +00:00
|
|
|
|
|
|
|
$av_ids = "";
|
|
|
|
foreach($avs as $av) {
|
|
|
|
$av_ids .= "$av->id, ";
|
|
|
|
}
|
|
|
|
$av_ids .= "0";
|
|
|
|
|
|
|
|
$t = time() - 30*86400;
|
2011-11-16 19:47:40 +00:00
|
|
|
//echo "start enum $vendor $av_ids\n";
|
|
|
|
$results = BoincResult::enum(
|
|
|
|
"app_version_id in ($av_ids) and create_time > $t and elapsed_time>100 limit 500"
|
|
|
|
);
|
|
|
|
//echo "end enum\n";
|
2011-08-30 05:54:34 +00:00
|
|
|
$total = array();
|
|
|
|
$win = array();
|
|
|
|
$linux = array();
|
|
|
|
$mac = array();
|
|
|
|
foreach ($results as $r) {
|
|
|
|
$h = BoincHost::lookup_id($r->hostid);
|
|
|
|
if (!$h) continue;
|
2011-11-16 19:47:40 +00:00
|
|
|
$wu = BoincWorkunit::lookup_id($r->workunitid);
|
2011-09-01 05:05:53 +00:00
|
|
|
if (!$wu) continue;
|
2011-10-26 22:11:37 +00:00
|
|
|
$v = $vendor=="cuda"?"CUDA":"CAL";
|
2011-08-30 05:54:34 +00:00
|
|
|
$model = get_gpu_model($h->serialnum, $v);
|
|
|
|
if (!$model) continue;
|
2011-09-01 05:05:53 +00:00
|
|
|
add_model($model, $r, $wu, $total);
|
2011-08-30 05:54:34 +00:00
|
|
|
if (strstr($h->os_name, "Windows")) {
|
2011-09-01 05:05:53 +00:00
|
|
|
add_model($model, $r, $wu, $win);
|
2011-08-30 05:54:34 +00:00
|
|
|
}
|
|
|
|
if (strstr($h->os_name, "Linux")) {
|
2011-09-01 05:05:53 +00:00
|
|
|
add_model($model, $r, $wu, $linux);
|
2011-08-30 05:54:34 +00:00
|
|
|
}
|
|
|
|
if (strstr($h->os_name, "Darwin")) {
|
2011-09-01 05:05:53 +00:00
|
|
|
add_model($model, $r, $wu, $mac);
|
2011-08-30 05:54:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
$x = null;
|
|
|
|
$x->total = $total;
|
|
|
|
$x->win = $win;
|
|
|
|
$x->linux = $linux;
|
|
|
|
$x->mac = $mac;
|
|
|
|
return $x;
|
|
|
|
}
|
|
|
|
|
|
|
|
function get_gpu_lists() {
|
|
|
|
$x = null;
|
2011-11-16 19:47:40 +00:00
|
|
|
$x->cuda = get_gpu_list("cuda", "nvidia");
|
2011-08-30 05:54:34 +00:00
|
|
|
$x->ati = get_gpu_list("ati");
|
|
|
|
return $x;
|
|
|
|
}
|
|
|
|
|
2011-08-30 21:39:05 +00:00
|
|
|
function gpucmp($x1, $x2) {
|
2011-11-16 19:47:40 +00:00
|
|
|
return $x1->avg_time > $x2->avg_time;
|
2011-08-30 21:39:05 +00:00
|
|
|
}
|
|
|
|
|
2011-08-30 05:54:34 +00:00
|
|
|
function show_list($models, $name) {
|
|
|
|
echo "<td><h2>$name</h2>\n";
|
|
|
|
if (!count($models)) {
|
2011-08-30 07:00:53 +00:00
|
|
|
echo tra("No GPU tasks reported")."</td>\n";
|
2011-08-30 05:54:34 +00:00
|
|
|
return;
|
|
|
|
}
|
2011-11-16 19:47:40 +00:00
|
|
|
$max_count = 0;
|
2011-08-30 21:39:05 +00:00
|
|
|
foreach ($models as $model=>$x) {
|
2011-11-16 19:47:40 +00:00
|
|
|
if ($x->count > $max_count) $max_count = $x->count;
|
|
|
|
$x->avg_time = $x->time/$x->count;
|
|
|
|
}
|
|
|
|
$min_time = 1e9;
|
2011-09-01 05:05:53 +00:00
|
|
|
foreach ($models as $model=>$x) {
|
2011-11-16 19:47:40 +00:00
|
|
|
if ($x->count < $max_count/10) continue;
|
|
|
|
if ($x->avg_time < $min_time) $min_time = $x->avg_time;
|
|
|
|
}
|
2011-09-01 05:05:53 +00:00
|
|
|
uasort($models, 'gpucmp');
|
|
|
|
echo "<ol>\n";
|
2011-08-30 21:39:05 +00:00
|
|
|
foreach ($models as $model=>$x) {
|
2011-11-16 19:47:40 +00:00
|
|
|
if ($x->count < $max_count/10) continue;
|
|
|
|
$s = number_format($min_time/$x->avg_time, 3);
|
2011-09-01 05:05:53 +00:00
|
|
|
echo "<li>($s) $model\n";
|
2011-08-30 05:54:34 +00:00
|
|
|
}
|
|
|
|
echo "</ol></td>\n";
|
|
|
|
}
|
|
|
|
|
|
|
|
function show_vendor($vendor, $x) {
|
|
|
|
echo "<h2>$vendor</h2>\n";
|
|
|
|
if (!count($x->total)) {
|
2011-08-30 07:00:53 +00:00
|
|
|
echo tra("No GPU tasks reported");
|
2011-08-30 05:54:34 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
$have_win = count($x->win)>0;
|
|
|
|
$have_mac = count($x->mac)>0;
|
|
|
|
$have_linux = count($x->linux)>0;
|
|
|
|
$n = 0;
|
|
|
|
if ($have_win) $n++;
|
|
|
|
if ($have_mac) $n++;
|
|
|
|
if ($have_linux) $n++;
|
|
|
|
$show_total = $n>1;
|
|
|
|
start_table();
|
|
|
|
echo "<tr>";
|
|
|
|
if ($show_total) {
|
|
|
|
show_list($x->total, "Total");
|
|
|
|
}
|
|
|
|
show_list($x->win, "Windows");
|
|
|
|
show_list($x->linux, "Linux");
|
|
|
|
show_list($x->mac, "Mac");
|
|
|
|
echo "</tr></table>\n";
|
|
|
|
}
|
|
|
|
|
|
|
|
$d = get_cached_data(86400);
|
|
|
|
if ($d) {
|
|
|
|
$data = unserialize($d);
|
|
|
|
} else {
|
|
|
|
$data = get_gpu_lists();
|
|
|
|
set_cached_data(86400, serialize($data));
|
|
|
|
}
|
|
|
|
|
|
|
|
page_head(tra("Top GPU models"));
|
2011-09-01 05:05:53 +00:00
|
|
|
echo tra("The following lists show the most productive GPU models on different platforms. Relative speeds are shown in parentheses.");
|
2011-08-30 05:54:34 +00:00
|
|
|
show_vendor("NVIDIA", $data->cuda);
|
|
|
|
show_vendor("ATI/AMD", $data->ati);
|
|
|
|
page_tail();
|
|
|
|
|
|
|
|
?>
|