- change project_list.php so that it shows platform[plan_class].

That way the client can know which projects have GPU
    and multithread apps.
- client: message tweak


svn path=/trunk/boinc/; revision=19589
This commit is contained in:
David Anderson 2009-11-17 21:38:44 +00:00
parent e7bb9b2a7c
commit f31e46f13b
4 changed files with 89 additions and 51 deletions

View File

@ -9277,3 +9277,12 @@ Rom 17 Nov 2009
wizardex.cpp, .h
win_build/
boincmgr.vcproj
David 17 Nov 2009
- change project_list.php so that it shows platform[plan_class].
That way the client can know which projects have GPU
and multithread apps.
doc/
get_platforms.inc
project_list.php

View File

@ -174,7 +174,7 @@ static void show_gpu_ignore(vector<int>& devs, const char* name) {
void CONFIG::show() {
unsigned int i;
if (config.ncpus>=0) {
msg_printf(NULL, MSG_INFO, "Config: use at most %d CPUs", config.ncpus);
msg_printf(NULL, MSG_INFO, "Config: simulate %d CPUs", config.ncpus);
}
if (config.no_gpus) {
msg_printf(NULL, MSG_INFO, "Config: don't use coprocessors");

View File

@ -1,73 +1,99 @@
<?php
ini_set('display_errors', 'stdout');
error_reporting(E_ALL);
// Mediawiki extension to show a project's platforms.
// The platforms for a given project are stored in a file platforms/URL
//
function parse_next_element($xml, $tag, &$cursor) {
$element = null;
$closetag = "</" . substr($tag,1);
$pos = substr($xml,$cursor);
$x = strstr($pos, $tag);
if ($x) {
if (strstr($tag, "/>")) return $tag;
$y = substr($x, strlen($tag));
$n = strpos($y, $closetag);
if ($n) {
$element = substr($y, 0, $n);
}
$cursor = (strlen($xml) - strlen($x)) + strlen($tag) + strlen($closetag) + strlen($element);
}
return trim($element);
}
function friendly_name($p) {
switch ($p) {
case 'i686-pc-linux-gnu': return 'Linux/x86';
case 'windows_intelx86': return 'Windows';
case 'x86_64-pc-linux-gnu': return 'Linux/x64';
case 'i686-apple-darwin': return 'Mac OS X';
case 'x86_64-apple-darwin': return 'Mac OS X 64-bit';
case 'powerpc-apple-darwin': return 'Mac OS X (PowerPC)';
case 'sparc-sun-solaris2.7': return 'SPARC Solaris 2.7';
case 'sparc-sun-solaris': return 'SPARC Solaris';
case 'powerpc64-unknown-linux-gnu': return 'Linux/PowerPC64';
case 'windows_x86_64': return 'Windows/x64';
case 'powerpc64-ps3-linux-gnu': return 'Playstation3/Linux';
case 'x86_64-unknown-linux-gnu': return null;
}
if (strstr($p, "fubar")) return null;
return $p;
$x = explode('[', $p);
$pc = "";
if (sizeof($x) > 1) {
$p = $x[0];
$pc = substr($x[1], 0, -1);
}
if (strstr($p, "fubar")) return null;
if ($p == 'x86_64-unknown-linux-gnu') return null;
$q = $p;
switch ($p) {
case 'i686-pc-linux-gnu': $q = 'Linux/x86'; break;
case 'windows_intelx86': $q = 'Windows'; break;
case 'x86_64-pc-linux-gnu': $q = 'Linux/x64'; break;
case 'i686-apple-darwin': $q = 'Mac OS X'; break;
case 'x86_64-apple-darwin': $q = 'Mac OS X 64-bit'; break;
case 'powerpc-apple-darwin': $q = 'Mac OS X (PowerPC)'; break;
case 'sparc-sun-solaris2.7': $q = 'SPARC Solaris 2.7'; break;
case 'sparc-sun-solaris': $q = 'SPARC Solaris'; break;
case 'powerpc64-unknown-linux-gnu': $q = 'Linux/PowerPC64'; break;
case 'windows_x86_64': $q = 'Windows/x64'; break;
case 'powerpc64-ps3-linux-gnu': $q = 'Playstation3/Linux'; break;
}
if (strlen($pc)) {
if (strstr($pc, 'cuda')) $q .= " (NVIDIA GPU)";
else if (strstr($pc, 'ati')) $q .= " (ATI GPU)";
else if (strstr($pc, 'mt')) $q .= " (multicore)";
}
return $q;
}
// get platforms from get_project_config.php (preferred method)
//
function get_platforms($url) {
function get_platforms(&$url) {
$url .= 'get_project_config.php';
$x = file_get_contents($url);
if (!$x) return null;
$cursor = 0;
$list = null;
$tag = '<platform_name>';
if (!strstr($x, "<platform_name>")) $tag = '<platform>';
while (1) {
$p = parse_next_element($x, $tag, $cursor);
if (!$p) break;
$list[] = $p;
$s = new SimpleXMLElement($x);
if (array_key_exists('rpc_prefix', $s)) {
$url = $s->rpc_prefix;
}
if (!array_key_exists('platforms', $s)) return null;
$p = $s->platforms;
if (!array_key_exists('platform', $p)) return null;
if (sizeof($p->platform) == 0) return null;
if (array_key_exists(0, $p->platform[0])) {
foreach ($p->platform as $r) {
$list[] = (string)$r->platform_name;
}
} else {
$list = array();
foreach ($p->platform as $r) {
print_r($r);
if (array_key_exists('plan_class', $r)) {
$list[] = (string)$r->platform_name.'['.(string)$r->plan_class.']';
} else {
$list[] = (string)$r->platform_name;
}
}
}
return array_unique($list);
}
// get platforms from app.php?xml=1 (deprecated)
//
function get_platforms2($url) {
$url .= 'apps.php?xml=1';
$x = file_get_contents($url);
if (!$x) return null;
$cursor = 0;
$s = new SimpleXMLElement($x);
$list = null;
$tag = '<platform_short>';
while (1) {
$p = parse_next_element($x, $tag, $cursor);
if (!$p) break;
foreach($s->application as $a) {
foreach ($a->version as $v) {
if (!array_key_exists('platform_short', $v)) continue;
$p = $v->platform_short[0];
$pc = "";
if (array_key_exists('plan_class', $v)) {
$pc = $v->plan_class[0];
}
if (strlen($pc)) {
$list[] = $p.'['.$pc.']';
} else {
$list[] = $p;
}
}
}
return array_unique($list);
}
@ -126,6 +152,9 @@ function get_platforms_string($url) {
}
//echo get_platforms_string("http://www.worldcommunitygrid.org/");
//echo get_platforms_string("http://setiathome.berkeley.edu/");
//echo get_platforms_string("http://dist.ist.tugraz.at/cape5/");
//print_r(get_platforms2("http://www.primegrid.com/"));
function wfPlatforms() {
global $wgParser;

View File

@ -52,13 +52,13 @@ foreach($proj_list as $p) {
$platforms = get_platforms_cached($p->web_url);
if ($platforms) {
echo " <platforms>\n";
foreach ($platforms as $p) {
if ($p == 'Unknown') continue;
echo " <name>$p</name>\n";
foreach ($platforms as $platform) {
if ($platform == 'Unknown') continue;
echo " <name>$platform</name>\n";
}
echo " </platforms>\n";
}
if ($p->image) {
if (isset($p->image)) {
echo " <image>http://boinc.berkeley.edu/images/$p->image</image>
";
}