2011-11-16 20:09:06 +00:00
|
|
|
<?php
|
2011-11-16 19:47:40 +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 XML showing the average PFC of GPU versions
|
|
|
|
// relative to CPU versions.
|
|
|
|
// This can be used to scale GPU credit
|
|
|
|
// for projects that have only GPU versions
|
|
|
|
|
|
|
|
require_once("../inc/boinc_db.inc");
|
2011-11-16 20:09:06 +00:00
|
|
|
require_once("../inc/xml.inc");
|
2011-11-16 19:47:40 +00:00
|
|
|
|
|
|
|
$cpu_scale_sum = 0;
|
|
|
|
$cpu_credit_sum = 0;
|
|
|
|
$ati_scale_sum = 0;
|
|
|
|
$ati_credit_sum = 0;
|
|
|
|
$nvidia_scale_sum = 0;
|
|
|
|
$nvidia_credit_sum = 0;
|
2014-02-20 19:08:24 +00:00
|
|
|
$intel_gpu_scale_sum = 0;
|
|
|
|
$intel_gpu_credit_sum = 0;
|
2011-11-16 20:13:13 +00:00
|
|
|
$total_credit_sum= 0;
|
2011-11-16 19:47:40 +00:00
|
|
|
|
|
|
|
$apps = BoincApp::enum("deprecated=0");
|
|
|
|
foreach ($apps as $app) {
|
|
|
|
$avs = BoincAppVersion::enum("appid=$app->id and deprecated=0");
|
|
|
|
foreach ($avs as $av) {
|
|
|
|
if (strstr($av->plan_class, "ati")) {
|
|
|
|
$ati_scale_sum += $av->pfc_scale * $av->expavg_credit;
|
|
|
|
$ati_credit_sum += $av->expavg_credit;
|
|
|
|
} else if (strstr($av->plan_class, "nvidia") || strstr($av->plan_class, "cuda")) {
|
|
|
|
$nvidia_scale_sum += $av->pfc_scale * $av->expavg_credit;
|
|
|
|
$nvidia_credit_sum += $av->expavg_credit;
|
2014-02-20 19:08:24 +00:00
|
|
|
} else if (strstr($av->plan_class, "intel_gpu")) {
|
|
|
|
$intel_gpu_scale_sum += $av->pfc_scale * $av->expavg_credit;
|
|
|
|
$intel_gpu_credit_sum += $av->expavg_credit;
|
2011-11-16 19:47:40 +00:00
|
|
|
} else {
|
|
|
|
$cpu_scale_sum += $av->pfc_scale * $av->expavg_credit;
|
|
|
|
$cpu_credit_sum += $av->expavg_credit;
|
|
|
|
}
|
2011-11-16 20:13:13 +00:00
|
|
|
$total_credit_sum += $av->expavg_credit;
|
2011-11-16 19:47:40 +00:00
|
|
|
}
|
2011-11-16 20:09:06 +00:00
|
|
|
}
|
2011-11-16 19:47:40 +00:00
|
|
|
|
2011-11-16 20:09:06 +00:00
|
|
|
xml_header();
|
2011-11-16 20:13:13 +00:00
|
|
|
echo "<scale_factors>
|
|
|
|
<total_credit>$total_credit_sum</total_credit>
|
|
|
|
";
|
2011-11-16 20:09:06 +00:00
|
|
|
if ($cpu_credit_sum) {
|
2011-11-16 20:13:13 +00:00
|
|
|
echo " <cpu>", $cpu_scale_sum/$cpu_credit_sum, "</cpu>\n";
|
2011-11-16 20:09:06 +00:00
|
|
|
}
|
|
|
|
if ($ati_credit_sum) {
|
2011-11-16 20:13:13 +00:00
|
|
|
echo " <ati>", $ati_scale_sum/$ati_credit_sum, "</ati>\n";
|
2011-11-16 20:09:06 +00:00
|
|
|
}
|
|
|
|
if ($nvidia_credit_sum) {
|
2011-11-16 20:13:13 +00:00
|
|
|
echo " <nvidia>", $nvidia_scale_sum/$nvidia_credit_sum, "</nvidia>\n";
|
2011-11-16 19:47:40 +00:00
|
|
|
}
|
2014-02-20 19:08:24 +00:00
|
|
|
if ($intel_gpu_credit_sum) {
|
|
|
|
echo " <intel_gpu>", $intel_gpu_scale_sum/$intel_gpu_credit_sum, "</intel_gpu>\n";
|
|
|
|
}
|
2011-11-16 20:09:06 +00:00
|
|
|
echo "</scale_factors>\n";
|
|
|
|
?>
|