mirror of https://github.com/BOINC/boinc.git
- web: anywhere we show info about a host, show its GPUs too
- web: add script to parse GPU completed-job log and generate summary data; also add page to display this data. svn path=/trunk/boinc/; revision=17069
This commit is contained in:
parent
809adc7e68
commit
3838ac2f19
|
@ -878,3 +878,18 @@ Rom Jan 29 2009
|
|||
|
||||
clientgui/
|
||||
AccountInfoPage.cpp
|
||||
|
||||
David 29 Jan 2009
|
||||
- web: anywhere we show info about a host, show its GPUs too
|
||||
- web: add script to parse GPU completed-job log
|
||||
and generate summary data;
|
||||
also add page to display this data.
|
||||
|
||||
html/
|
||||
inc/
|
||||
host.inc
|
||||
ops/
|
||||
analyze_coproc_log.php
|
||||
user/
|
||||
hosts_user.php
|
||||
show_coproc.php
|
||||
|
|
|
@ -94,9 +94,9 @@ function show_host($host, $user, $ipprivate) {
|
|||
row2("Total Credit", format_credit_large($host->total_credit));
|
||||
row2("Avg. credit", format_credit($host->expavg_credit));
|
||||
row2("CPU type", "$host->p_vendor <br> $host->p_model");
|
||||
row2("Number of CPUs", $host->p_ncpus);
|
||||
row2("Number of processors", $host->p_ncpus);
|
||||
if ($host->serialnum) {
|
||||
row2("Coprocessors", $host->serialnum);
|
||||
row2("Coprocessors", gpu_desc($host->serialnum));
|
||||
}
|
||||
row2("Operating System", "$host->os_name <br> $host->os_version");
|
||||
$x = $host->m_nbytes/(1024*1024);
|
||||
|
@ -199,7 +199,8 @@ function top_host_table_start($sort_by) {
|
|||
";
|
||||
}
|
||||
echo "
|
||||
<th>CPU type</th>
|
||||
<th>CPU</th>
|
||||
<th>GPU</th>
|
||||
<th>Operating system</th>
|
||||
</tr>
|
||||
";
|
||||
|
@ -209,6 +210,24 @@ function host_nresults($host) {
|
|||
return BoincResult::count("hostid=$host->id");
|
||||
}
|
||||
|
||||
// format a GPU description string of the form [type|model|number|RAM]
|
||||
//
|
||||
function gpu_desc($x) {
|
||||
if (!$x) return "";
|
||||
$x = substr($x, 1, -1);
|
||||
$y = explode("|", $x);
|
||||
$z = "";
|
||||
if ($y[2]!="" && $y[2]!="1") $z = "[".$y[2]."] ";
|
||||
if ($y[0] == "CUDA") $z .= "NVIDIA ";
|
||||
$z .= $y[1];
|
||||
$z .= " (".$y[3].")";
|
||||
return $z;
|
||||
}
|
||||
|
||||
function cpu_desc($host) {
|
||||
return "$host->p_vendor<br>$host->p_model<br>($host->p_ncpus processors)\n";
|
||||
}
|
||||
|
||||
// If private is true, we're showing the host to its owner,
|
||||
// so it's OK to show the domain name etc.
|
||||
// If private is false, show the owner's name only if they've given permission
|
||||
|
@ -240,10 +259,12 @@ function show_host_row($host, $i, $private, $show_owner) {
|
|||
printf("
|
||||
<td>%s</td>
|
||||
<td>%s</td>
|
||||
<td>%s <br> %s</td>
|
||||
<td>%s</td>
|
||||
<td>%s</td>
|
||||
<td>%s <br> %s</td>",
|
||||
format_credit($host->expavg_credit), format_credit_large($host->total_credit),
|
||||
$host->p_vendor, $host->p_model,
|
||||
cpu_desc($host),
|
||||
gpu_desc($host->serialnum),
|
||||
$host->os_name, $host->os_version
|
||||
);
|
||||
} else {
|
||||
|
@ -251,7 +272,8 @@ function show_host_row($host, $i, $private, $show_owner) {
|
|||
//
|
||||
echo "<td align=right>", format_credit($host->expavg_credit), "</td>\n";
|
||||
echo "<td align=right>", format_credit_large($host->total_credit), "</td>\n";
|
||||
echo "<td>$host->p_vendor<br><span class=note>$host->p_model</span></td>\n";
|
||||
echo "<td>".cpu_desc($host)."</td>\n";
|
||||
echo "<td>".gpu_desc($host->serialnum)."</td>\n";
|
||||
echo "<td>$host->os_name<br><span class=note>$host->os_version</span></td>\n";
|
||||
echo "<td>".sched_log_link($host->rpc_time)."</td>\n";
|
||||
}
|
||||
|
|
|
@ -0,0 +1,89 @@
|
|||
<?php
|
||||
|
||||
// Parse a log file of completed GPU jobs and generate some stats.
|
||||
// Log format:
|
||||
//
|
||||
// time validated
|
||||
// time received
|
||||
// result ID
|
||||
// host ID
|
||||
// user ID
|
||||
// team ID
|
||||
// claimed credit
|
||||
// granted credit
|
||||
// coprocessor description
|
||||
//
|
||||
// This was developed for SETI@home but might be useful for other projects;
|
||||
// you'll need to add code to your validator to generate the log file
|
||||
|
||||
// outputs:
|
||||
// - user leaderboard
|
||||
// - host leaderboard
|
||||
// - team leaderboard
|
||||
// - daily total
|
||||
// - breakdown by desc (number, credit)
|
||||
|
||||
ini_set ("memory_limit", "1G");
|
||||
set_time_limit(0);
|
||||
|
||||
$users = array();
|
||||
$hosts = array();
|
||||
$teams = array();
|
||||
$days = array();
|
||||
$descs = array();
|
||||
|
||||
function add_to_array(&$array, $id, $credit) {
|
||||
if (array_key_exists($id, $array)) {
|
||||
$array[$id]->nresults++;
|
||||
$array[$id]->credit += $credit;
|
||||
} else {
|
||||
$x = null;
|
||||
$x->nresults = 1;
|
||||
$x->credit = $credit;
|
||||
$array[$id] = $x;
|
||||
}
|
||||
}
|
||||
|
||||
function compare($x, $y) {
|
||||
if ($x->credit > $y->credit) return -1;
|
||||
if ($x->credit < $y->credit) return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
function write_array($array, $file, $n) {
|
||||
if ($n) {
|
||||
$array = array_slice($array, 0, $n, true);
|
||||
}
|
||||
$f = fopen($file, "w");
|
||||
fwrite($f, serialize($array));
|
||||
fclose($f);
|
||||
}
|
||||
|
||||
$f = fopen("cuda_result_log", "r");
|
||||
$i = 0;
|
||||
while (!feof($f)) {
|
||||
$str = fgets($f);
|
||||
list($val_time, $rec_time, $resultid, $hostid, $userid, $teamid, $claimed, $granted, $desc) = sscanf($str, "%d %d %d %d %d %d %f %f %s");
|
||||
add_to_array($hosts, $hostid, $granted);
|
||||
add_to_array($users, $userid, $granted);
|
||||
add_to_array($teams, $teamid, $granted);
|
||||
add_to_array($descs, $desc, $granted);
|
||||
if ($rec_time) {
|
||||
$day = date("Y n j", $rec_time);
|
||||
add_to_array($days, $day, $granted);
|
||||
}
|
||||
$i++;
|
||||
if ($i % 10000 == 0) echo "$i\n";
|
||||
}
|
||||
|
||||
uasort($hosts, "compare");
|
||||
uasort($users, "compare");
|
||||
uasort($teams, "compare");
|
||||
uasort($descs, "compare");
|
||||
write_array($hosts, "cuda_hosts.dat", 100);
|
||||
write_array($users, "cuda_users.dat", 100);
|
||||
write_array($teams, "cuda_teams.dat", 100);
|
||||
write_array($descs, "cuda_models.dat", 0);
|
||||
write_array($days, "cuda_days.dat", 0);
|
||||
|
||||
?>
|
|
@ -67,7 +67,9 @@ function user_host_table_start($private, $sort, $rev, $show_all) {
|
|||
$url = link_url_rev($sort, "total_credit", $rev, $show_all);
|
||||
echo "<th><a href=$url>Total credit</a></th>\n";
|
||||
$url = link_url_rev($sort, "cpu", $rev, $show_all);
|
||||
echo "<th><a href=$url>CPU type</a></th>\n";
|
||||
echo "<th><a href=$url>CPU</a></th>\n";
|
||||
$url = link_url_rev($sort, "gpu", $rev, $show_all);
|
||||
echo "<th><a href=$url>GPU</a></th>\n";
|
||||
$url = link_url_rev($sort, "os", $rev, $show_all);
|
||||
echo "<th><a href=$url>Operating System</a></th>\n";
|
||||
$url = link_url_rev($sort, "rpc_time", $rev, $show_all);
|
||||
|
@ -92,6 +94,7 @@ case "expavg_credit": $sort_clause = "expavg_credit"; $desc = true; break;
|
|||
case "name": $sort_clause = "domain_name"; break;
|
||||
case "id": $sort_clause = "id"; break;
|
||||
case "cpu": $sort_clause = "p_vendor"; break;
|
||||
case "gpu": $sort_clause = "serialnum"; break;
|
||||
case "os": $sort_clause = "os_name"; break;
|
||||
case "venue": $sort_clause = "venue"; break;
|
||||
default:
|
||||
|
|
|
@ -0,0 +1,98 @@
|
|||
<?php
|
||||
|
||||
require_once("../inc/util.inc");
|
||||
require_once("../inc/boinc_db.inc");
|
||||
|
||||
// show the results of ops/analyze_coproc_log.php
|
||||
|
||||
function filename($mode) {
|
||||
switch ($mode) {
|
||||
case 'host': return "cuda_hosts.dat";
|
||||
case 'user': return "cuda_users.dat";
|
||||
case 'team': return "cuda_teams.dat";
|
||||
case 'model': return "cuda_models.dat";
|
||||
case 'day': return "cuda_days.dat";
|
||||
}
|
||||
}
|
||||
|
||||
function title($mode) {
|
||||
switch ($mode) {
|
||||
case 'host': return "Top CUDA hosts";
|
||||
case 'user': return "Top CUDA users";
|
||||
case 'team': return "Top CUDA teams";
|
||||
case 'model': return "Top CUDA models";
|
||||
case 'day': return "Daily CUDA credit";
|
||||
}
|
||||
}
|
||||
|
||||
function header_row($mode) {
|
||||
echo "<tr><th>";
|
||||
switch ($mode) {
|
||||
case 'host':
|
||||
echo "Computer ID<br><span class=note>click for details</span>";
|
||||
break;
|
||||
case 'user':
|
||||
echo "User";
|
||||
break;
|
||||
case 'team':
|
||||
echo "Team";
|
||||
break;
|
||||
case 'model':
|
||||
echo "Model";
|
||||
break;
|
||||
case 'day':
|
||||
echo "Date";
|
||||
break;
|
||||
}
|
||||
echo "</th><th>CUDA Credit</th><th>Number of CUDA jobs</th></tr>\n";
|
||||
}
|
||||
|
||||
function show_row($x, $y, $mode, $i) {
|
||||
$class = $i%2?"row0":"row1";
|
||||
echo "<tr class=$class><td>";
|
||||
switch ($mode) {
|
||||
case 'host':
|
||||
echo "<a href=show_host_detail.php?hostid=$x>$x</a>";
|
||||
break;
|
||||
case 'user':
|
||||
$user = BoincUser::lookup_id($x);
|
||||
echo "<a href=show_user.php?userid=$x>$user->name</a>";
|
||||
break;
|
||||
case 'team':
|
||||
$team = BoincTeam::lookup_id($x);
|
||||
if ($team) {
|
||||
echo "<a href=team_display.php?teamid=$x>$team->name</a>";
|
||||
} else {
|
||||
echo "(no team)";
|
||||
}
|
||||
break;
|
||||
case 'model':
|
||||
echo $x;
|
||||
break;
|
||||
case 'day':
|
||||
echo $x;
|
||||
break;
|
||||
}
|
||||
echo "</td><td align=right>".format_credit($y->credit),"</td><td align=right>$y->nresults</td></tr>\n";
|
||||
}
|
||||
|
||||
$mode = get_str('mode');
|
||||
|
||||
$fname = "../ops/".filename($mode);
|
||||
$data = file_get_contents($fname);
|
||||
$array = unserialize($data);
|
||||
|
||||
page_head(title($mode));
|
||||
|
||||
start_table();
|
||||
header_row($mode);
|
||||
$i = 0;
|
||||
foreach ($array as $x=>$y) {
|
||||
show_row($x, $y, $mode, $i);
|
||||
$i++;
|
||||
}
|
||||
end_table();
|
||||
|
||||
page_tail();
|
||||
|
||||
?>
|
Loading…
Reference in New Issue