- 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 wizardex.cpp, .h
win_build/ win_build/
boincmgr.vcproj 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() { void CONFIG::show() {
unsigned int i; unsigned int i;
if (config.ncpus>=0) { 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) { if (config.no_gpus) {
msg_printf(NULL, MSG_INFO, "Config: don't use coprocessors"); msg_printf(NULL, MSG_INFO, "Config: don't use coprocessors");

View File

@ -1,72 +1,98 @@
<?php <?php
ini_set('display_errors', 'stdout');
error_reporting(E_ALL);
// Mediawiki extension to show a project's platforms. // Mediawiki extension to show a project's platforms.
// The platforms for a given project are stored in a file platforms/URL // 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) { function friendly_name($p) {
switch ($p) { $x = explode('[', $p);
case 'i686-pc-linux-gnu': return 'Linux/x86'; $pc = "";
case 'windows_intelx86': return 'Windows'; if (sizeof($x) > 1) {
case 'x86_64-pc-linux-gnu': return 'Linux/x64'; $p = $x[0];
case 'i686-apple-darwin': return 'Mac OS X'; $pc = substr($x[1], 0, -1);
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; if (strstr($p, "fubar")) return null;
return $p; 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'; $url .= 'get_project_config.php';
$x = file_get_contents($url); $x = file_get_contents($url);
if (!$x) return null; if (!$x) return null;
$cursor = 0; $s = new SimpleXMLElement($x);
$list = null; if (array_key_exists('rpc_prefix', $s)) {
$tag = '<platform_name>'; $url = $s->rpc_prefix;
if (!strstr($x, "<platform_name>")) $tag = '<platform>'; }
while (1) { if (!array_key_exists('platforms', $s)) return null;
$p = parse_next_element($x, $tag, $cursor); $p = $s->platforms;
if (!$p) break; if (!array_key_exists('platform', $p)) return null;
$list[] = $p; 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); return array_unique($list);
} }
// get platforms from app.php?xml=1 (deprecated)
//
function get_platforms2($url) { function get_platforms2($url) {
$url .= 'apps.php?xml=1'; $url .= 'apps.php?xml=1';
$x = file_get_contents($url); $x = file_get_contents($url);
if (!$x) return null; if (!$x) return null;
$cursor = 0; $s = new SimpleXMLElement($x);
$list = null; $list = null;
$tag = '<platform_short>'; foreach($s->application as $a) {
while (1) { foreach ($a->version as $v) {
$p = parse_next_element($x, $tag, $cursor); if (!array_key_exists('platform_short', $v)) continue;
if (!$p) break; $p = $v->platform_short[0];
$list[] = $p; $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); 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://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() { function wfPlatforms() {
global $wgParser; global $wgParser;

View File

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