diff --git a/checkin_notes b/checkin_notes
index eab5cb0d19..47819e10e3 100644
--- a/checkin_notes
+++ b/checkin_notes
@@ -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
diff --git a/html/inc/host.inc b/html/inc/host.inc
index c24d85fdbe..ce2d2c56cb 100644
--- a/html/inc/host.inc
+++ b/html/inc/host.inc
@@ -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
$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
$host->os_version");
$x = $host->m_nbytes/(1024*1024);
@@ -199,7 +199,8 @@ function top_host_table_start($sort_by) {
";
}
echo "
-
CPU type |
+ CPU |
+ GPU |
Operating system |
";
@@ -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
$host->p_model
($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("
%s |
%s |
- %s %s |
+ %s |
+ %s |
%s %s | ",
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 "", format_credit($host->expavg_credit), " | \n";
echo "", format_credit_large($host->total_credit), " | \n";
- echo "$host->p_vendor $host->p_model | \n";
+ echo "".cpu_desc($host)." | \n";
+ echo "".gpu_desc($host->serialnum)." | \n";
echo "$host->os_name $host->os_version | \n";
echo "".sched_log_link($host->rpc_time)." | \n";
}
diff --git a/html/ops/analyze_coproc_log.php b/html/ops/analyze_coproc_log.php
new file mode 100644
index 0000000000..3421636fa7
--- /dev/null
+++ b/html/ops/analyze_coproc_log.php
@@ -0,0 +1,89 @@
+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);
+
+?>
diff --git a/html/user/hosts_user.php b/html/user/hosts_user.php
index 5e548cfd16..cd7f6fb330 100644
--- a/html/user/hosts_user.php
+++ b/html/user/hosts_user.php
@@ -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 "Total credit | \n";
$url = link_url_rev($sort, "cpu", $rev, $show_all);
- echo "CPU type | \n";
+ echo "CPU | \n";
+ $url = link_url_rev($sort, "gpu", $rev, $show_all);
+ echo "GPU | \n";
$url = link_url_rev($sort, "os", $rev, $show_all);
echo "Operating System | \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:
diff --git a/html/user/show_coproc.php b/html/user/show_coproc.php
new file mode 100644
index 0000000000..5eac09e42b
--- /dev/null
+++ b/html/user/show_coproc.php
@@ -0,0 +1,98 @@
+";
+ switch ($mode) {
+ case 'host':
+ echo "Computer ID click for details";
+ break;
+ case 'user':
+ echo "User";
+ break;
+ case 'team':
+ echo "Team";
+ break;
+ case 'model':
+ echo "Model";
+ break;
+ case 'day':
+ echo "Date";
+ break;
+ }
+ echo " | CUDA Credit | Number of CUDA jobs | \n";
+}
+
+function show_row($x, $y, $mode, $i) {
+ $class = $i%2?"row0":"row1";
+ echo "";
+ switch ($mode) {
+ case 'host':
+ echo "$x";
+ break;
+ case 'user':
+ $user = BoincUser::lookup_id($x);
+ echo "$user->name";
+ break;
+ case 'team':
+ $team = BoincTeam::lookup_id($x);
+ if ($team) {
+ echo "$team->name";
+ } else {
+ echo "(no team)";
+ }
+ break;
+ case 'model':
+ echo $x;
+ break;
+ case 'day':
+ echo $x;
+ break;
+ }
+ echo " | ".format_credit($y->credit)," | $y->nresults |
\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();
+
+?>