@@ -28,7 +28,9 @@ |
||
| 28 | 28 | while (1) { |
| 29 | 29 | $now = time(); |
| 30 | 30 | $wus = BoincWorkunit::enum("transition_time<$now limit 1"); |
| 31 | - if (count($wus) == 0) break; |
|
| 31 | + if (count($wus) == 0) { |
|
| 32 | + break; |
|
| 33 | + } |
|
| 32 | 34 | echo "Some WUs need transition - running transitioner.\n"; |
| 33 | 35 | $ret = system("bin/transitioner --one_pass"); |
| 34 | 36 | echo "ret: $ret\n"; |
@@ -12,7 +12,7 @@ |
||
| 12 | 12 | |
| 13 | 13 | function art_list_show($logos) { |
| 14 | 14 | shuffle($logos); |
| 15 | - foreach($logos as $logo) { |
|
| 15 | + foreach ($logos as $logo) { |
|
| 16 | 16 | $x0 = $logo[0]; |
| 17 | 17 | $x1 = $logo[1]; |
| 18 | 18 | echo "<tr> |
@@ -45,17 +45,29 @@ |
||
| 45 | 45 | return "<font size=-2>(no ratings)</font>"; |
| 46 | 46 | } |
| 47 | 47 | $x = $vol->rating_sum/$vol->nratings; |
| 48 | - if ($x > 4.5) $img = "stars-5-0.gif"; |
|
| 49 | - else if ($x > 4.0) $img = "stars-4-5.gif"; |
|
| 50 | - else if ($x > 3.5) $img = "stars-4-0.gif"; |
|
| 51 | - else if ($x > 3.0) $img = "stars-3-5.gif"; |
|
| 52 | - else if ($x > 2.5) $img = "stars-3-0.gif"; |
|
| 53 | - else if ($x > 2.0) $img = "stars-2-5.gif"; |
|
| 54 | - else if ($x > 1.5) $img = "stars-2-0.gif"; |
|
| 55 | - else if ($x > 1.0) $img = "stars-1-5.gif"; |
|
| 56 | - else if ($x > 0.5) $img = "stars-1-0.gif"; |
|
| 57 | - else if ($x > 0.0) $img = "stars-0-5.gif"; |
|
| 58 | - else $img = "stars-0-0.gif"; |
|
| 48 | + if ($x > 4.5) { |
|
| 49 | + $img = "stars-5-0.gif"; |
|
| 50 | + } else if ($x > 4.0) { |
|
| 51 | + $img = "stars-4-5.gif"; |
|
| 52 | + } else if ($x > 3.5) { |
|
| 53 | + $img = "stars-4-0.gif"; |
|
| 54 | + } else if ($x > 3.0) { |
|
| 55 | + $img = "stars-3-5.gif"; |
|
| 56 | + } else if ($x > 2.5) { |
|
| 57 | + $img = "stars-3-0.gif"; |
|
| 58 | + } else if ($x > 2.0) { |
|
| 59 | + $img = "stars-2-5.gif"; |
|
| 60 | + } else if ($x > 1.5) { |
|
| 61 | + $img = "stars-2-0.gif"; |
|
| 62 | + } else if ($x > 1.0) { |
|
| 63 | + $img = "stars-1-5.gif"; |
|
| 64 | + } else if ($x > 0.5) { |
|
| 65 | + $img = "stars-1-0.gif"; |
|
| 66 | + } else if ($x > 0.0) { |
|
| 67 | + $img = "stars-0-5.gif"; |
|
| 68 | + } else { |
|
| 69 | + $img = "stars-0-0.gif"; |
|
| 70 | + } |
|
| 59 | 71 | return " |
| 60 | 72 | <nobr><a href=help_ratings.php?volid=$vol->id> |
| 61 | 73 | <img border=0 src=images/help/$img> |
@@ -4,11 +4,11 @@ discard block |
||
| 4 | 4 | class PROJECT { |
| 5 | 5 | public $name; |
| 6 | 6 | public $resource_share; |
| 7 | - public $has_cpu; // whether it has a CPU app |
|
| 8 | - public $cpu_ncpus; // # CPUS used by CPU app |
|
| 9 | - public $cpu_flops; // speed of CPU app |
|
| 10 | - public $cpu_job_size; // size of jobs |
|
| 11 | - public $cpu_latency; // latency of CPU jobs |
|
| 7 | + public $has_cpu; // whether it has a CPU app |
|
| 8 | + public $cpu_ncpus; // # CPUS used by CPU app |
|
| 9 | + public $cpu_flops; // speed of CPU app |
|
| 10 | + public $cpu_job_size; // size of jobs |
|
| 11 | + public $cpu_latency; // latency of CPU jobs |
|
| 12 | 12 | |
| 13 | 13 | public $has_gpu; |
| 14 | 14 | public $gpu_ncpus; |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | |
| 113 | 113 | function big_scenario() { |
| 114 | 114 | $pp = array(); |
| 115 | - for ($i=0; $i<1; $i++) { |
|
| 115 | + for ($i = 0; $i < 1; $i++) { |
|
| 116 | 116 | $p = new PROJECT; |
| 117 | 117 | $p->name = "C_$i"; |
| 118 | 118 | $p->resource_share = 100; |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | $p->cpu_latency = 864000; |
| 124 | 124 | $pp[] = $p; |
| 125 | 125 | } |
| 126 | - for ($i=0; $i<1; $i++) { |
|
| 126 | + for ($i = 0; $i < 1; $i++) { |
|
| 127 | 127 | $p = new PROJECT; |
| 128 | 128 | $p->name = "G_$i"; |
| 129 | 129 | $p->resource_share = 100; |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | $p->gpu_latency = 864000; |
| 135 | 135 | $pp[] = $p; |
| 136 | 136 | } |
| 137 | - for ($i=0; $i<1; $i++) { |
|
| 137 | + for ($i = 0; $i < 1; $i++) { |
|
| 138 | 138 | $p = new PROJECT; |
| 139 | 139 | $p->name = "CG_$i"; |
| 140 | 140 | $p->resource_share = 100; |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | require_once("../inc/util.inc"); |
| 26 | 26 | require_once("../inc/sim_util.inc"); |
| 27 | 27 | |
| 28 | -ini_set ("memory_limit", "1G"); |
|
| 28 | +ini_set("memory_limit", "1G"); |
|
| 29 | 29 | set_time_limit(0); |
| 30 | 30 | |
| 31 | 31 | function get_comments($dir) { |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | $user = BoincUser::lookup_id($userid); |
| 64 | 64 | $date = date_str(filemtime("scenarios/$f")); |
| 65 | 65 | $nsims = nsims($f); |
| 66 | - $name = $user?$user->name:"???"; |
|
| 66 | + $name = $user ? $user->name : "???"; |
|
| 67 | 67 | echo "<tr> |
| 68 | 68 | <td><a href=sim_web.php?action=show_scenario&name=$f>$f</a></td> |
| 69 | 69 | <td>$name</td> |
@@ -30,13 +30,21 @@ discard block |
||
| 30 | 30 | |
| 31 | 31 | function get_comments($dir) { |
| 32 | 32 | $d = "$dir/comments"; |
| 33 | - if (!is_dir($d)) return null; |
|
| 33 | + if (!is_dir($d)) { |
|
| 34 | + return null; |
|
| 35 | + } |
|
| 34 | 36 | $dd = opendir($d); |
| 35 | 37 | $x = ""; |
| 36 | 38 | while (false !== ($f = readdir($dd))) { |
| 37 | - if ($f == ".") continue; |
|
| 38 | - if ($f == "..") continue; |
|
| 39 | - if (strlen($x)) $x .= "<hr>\n"; |
|
| 39 | + if ($f == ".") { |
|
| 40 | + continue; |
|
| 41 | + } |
|
| 42 | + if ($f == "..") { |
|
| 43 | + continue; |
|
| 44 | + } |
|
| 45 | + if (strlen($x)) { |
|
| 46 | + $x .= "<hr>\n"; |
|
| 47 | + } |
|
| 40 | 48 | $userid = (int)file_get_contents("$d/$f/userid"); |
| 41 | 49 | $user = BoincUser::lookup_id($userid); |
| 42 | 50 | $comment = file_get_contents("$d/$f/comment"); |
@@ -50,8 +58,12 @@ discard block |
||
| 50 | 58 | $d = opendir("scenarios/$scen/simulations"); |
| 51 | 59 | $n = 0; |
| 52 | 60 | while (false !== ($f = readdir($d))) { |
| 53 | - if ($f == ".") continue; |
|
| 54 | - if ($f == "..") continue; |
|
| 61 | + if ($f == ".") { |
|
| 62 | + continue; |
|
| 63 | + } |
|
| 64 | + if ($f == "..") { |
|
| 65 | + continue; |
|
| 66 | + } |
|
| 55 | 67 | $n++; |
| 56 | 68 | } |
| 57 | 69 | return $n; |
@@ -174,8 +186,12 @@ discard block |
||
| 174 | 186 | $d = opendir("scenarios"); |
| 175 | 187 | $dirs = array(); |
| 176 | 188 | while (false !== ($f = readdir($d))) { |
| 177 | - if ($f === ".") continue; |
|
| 178 | - if ($f === "..") continue; |
|
| 189 | + if ($f === ".") { |
|
| 190 | + continue; |
|
| 191 | + } |
|
| 192 | + if ($f === "..") { |
|
| 193 | + continue; |
|
| 194 | + } |
|
| 179 | 195 | $dirs[] = $f; |
| 180 | 196 | } |
| 181 | 197 | rsort($dirs); |
@@ -338,7 +354,9 @@ discard block |
||
| 338 | 354 | $dirs = array(); |
| 339 | 355 | $s = opendir("$d/simulations"); |
| 340 | 356 | while (false !== ($f = readdir($s))) { |
| 341 | - if (!is_numeric($f)) continue; |
|
| 357 | + if (!is_numeric($f)) { |
|
| 358 | + continue; |
|
| 359 | + } |
|
| 342 | 360 | $dirs[] = $f; |
| 343 | 361 | } |
| 344 | 362 | rsort($dirs); |
@@ -515,7 +533,9 @@ discard block |
||
| 515 | 533 | } |
| 516 | 534 | |
| 517 | 535 | $action = get_str("action", true); |
| 518 | -if (!$action) $action = post_str("action", true); |
|
| 536 | +if (!$action) { |
|
| 537 | + $action = post_str("action", true); |
|
| 538 | +} |
|
| 519 | 539 | |
| 520 | 540 | switch ($action) { |
| 521 | 541 | case "create_scenario_form": |
@@ -185,10 +185,10 @@ |
||
| 185 | 185 | function graph_n_results2( |
| 186 | 186 | $title, $xlabel, $lab1, $lab2, $dir, $results1, $results2, $col |
| 187 | 187 | ) { |
| 188 | - for ($i=0; $i<2; $i++) { |
|
| 188 | + for ($i = 0; $i < 2; $i++) { |
|
| 189 | 189 | $data_fname = "$dir/cr_$i.dat"; |
| 190 | 190 | $f = fopen($data_fname, "w"); |
| 191 | - $rr = $i?$results2:$results1; |
|
| 191 | + $rr = $i ? $results2 : $results1; |
|
| 192 | 192 | foreach ($rr as $r) { |
| 193 | 193 | $r->write($f); |
| 194 | 194 | } |
@@ -76,10 +76,18 @@ discard block |
||
| 76 | 76 | // |
| 77 | 77 | function do_sim($in, $out, $policy) { |
| 78 | 78 | $args = ""; |
| 79 | - if ($policy->existing_jobs_only) $args .= " --existing_jobs_only"; |
|
| 80 | - if ($policy->cpu_sched_rr_only) $args .= " --cpu_sched_rr_only"; |
|
| 81 | - if ($policy->include_empty_projects) $args .= " --include_empty_projects"; |
|
| 82 | - if ($policy->server_uses_workload) $args .= " --server_uses_workload"; |
|
| 79 | + if ($policy->existing_jobs_only) { |
|
| 80 | + $args .= " --existing_jobs_only"; |
|
| 81 | + } |
|
| 82 | + if ($policy->cpu_sched_rr_only) { |
|
| 83 | + $args .= " --cpu_sched_rr_only"; |
|
| 84 | + } |
|
| 85 | + if ($policy->include_empty_projects) { |
|
| 86 | + $args .= " --include_empty_projects"; |
|
| 87 | + } |
|
| 88 | + if ($policy->server_uses_workload) { |
|
| 89 | + $args .= " --server_uses_workload"; |
|
| 90 | + } |
|
| 83 | 91 | $args .= " --duration $policy->duration"; |
| 84 | 92 | $args .= " --delta $policy->delta"; |
| 85 | 93 | $args .= " --rec_half_life $policy->rec_half_life"; |
@@ -221,7 +229,9 @@ discard block |
||
| 221 | 229 | $cs_template_fname = "$scenario/client_state_template.xml"; |
| 222 | 230 | $cs_fname = "$scenario/client_state.xml"; |
| 223 | 231 | $cs = file_get_contents($cs_template_fname); |
| 224 | - if (!$cs) die("no file $cs_template_fname"); |
|
| 232 | + if (!$cs) { |
|
| 233 | + die("no file $cs_template_fname"); |
|
| 234 | + } |
|
| 225 | 235 | $cs = str_replace("PARAM", $param, $cs); |
| 226 | 236 | file_put_contents($cs_fname, $cs); |
| 227 | 237 | do_sim($scenario, $sim_out_dir, $policy); |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | } |
| 141 | 141 | |
| 142 | 142 | if (0) { |
| 143 | - $duration = 50* 86400; |
|
| 143 | + $duration = 50*86400; |
|
| 144 | 144 | $p1 = new POLICY("JS_LOCAL"); |
| 145 | 145 | $p2 = new POLICY("JS_GLOBAL"); |
| 146 | 146 | $p2->use_rec = true; |
@@ -170,7 +170,7 @@ discard block |
||
| 170 | 170 | $lo = 5*86400; |
| 171 | 171 | $hi = 40*86400; |
| 172 | 172 | $inc = 5*86400; |
| 173 | - $duration = 50* 86400; |
|
| 173 | + $duration = 50*86400; |
|
| 174 | 174 | compare_policy_params("Resource share violation", "REC half-life", "JS_LOCAL", "JS_GLOBAL", array("scen3"), $p1, $p2, $lo, $hi, $inc, "test7"); |
| 175 | 175 | } |
| 176 | 176 | |
@@ -111,7 +111,9 @@ discard block |
||
| 111 | 111 | |
| 112 | 112 | function vol_lookup($id) { |
| 113 | 113 | $result = mysql_query("select * from volunteer where id=$id"); |
| 114 | - if (!$result) return null; |
|
| 114 | + if (!$result) { |
|
| 115 | + return null; |
|
| 116 | + } |
|
| 115 | 117 | $vol = mysql_fetch_object($result); |
| 116 | 118 | mysql_free_result($result); |
| 117 | 119 | return $vol; |
@@ -120,7 +122,9 @@ discard block |
||
| 120 | 122 | function vol_lookup_email($email) { |
| 121 | 123 | $email = mysql_real_escape_string($email); |
| 122 | 124 | $result = mysql_query("select * from volunteer where email_addr='$email'"); |
| 123 | - if (!$result) return null; |
|
| 125 | + if (!$result) { |
|
| 126 | + return null; |
|
| 127 | + } |
|
| 124 | 128 | $vol = mysql_fetch_object($result); |
| 125 | 129 | mysql_free_result($result); |
| 126 | 130 | return $vol; |
@@ -129,7 +133,9 @@ discard block |
||
| 129 | 133 | function vol_lookup_name($name) { |
| 130 | 134 | $name = mysql_real_escape_string($name); |
| 131 | 135 | $result = mysql_query("select * from volunteer where name='$name'"); |
| 132 | - if (!$result) return null; |
|
| 136 | + if (!$result) { |
|
| 137 | + return null; |
|
| 138 | + } |
|
| 133 | 139 | $vol = mysql_fetch_object($result); |
| 134 | 140 | mysql_free_result($result); |
| 135 | 141 | return $vol; |
@@ -228,7 +228,7 @@ discard block |
||
| 228 | 228 | libxml_use_internal_errors(true); |
| 229 | 229 | $s = simplexml_load_string($x); |
| 230 | 230 | $list = null; |
| 231 | - foreach($s->application as $a) { |
|
| 231 | + foreach ($s->application as $a) { |
|
| 232 | 232 | foreach ($a->version as $v) { |
| 233 | 233 | if (!array_key_exists('platform_short', $v)) continue; |
| 234 | 234 | $p = $v->platform_short[0]; |
@@ -252,7 +252,7 @@ discard block |
||
| 252 | 252 | function make_friendly_string($l, $comma) { |
| 253 | 253 | if (!count($l)) return "Unknown"; |
| 254 | 254 | $fn = array(); |
| 255 | - foreach($l as $p) { |
|
| 255 | + foreach ($l as $p) { |
|
| 256 | 256 | $p = friendly_name($p); |
| 257 | 257 | if (!$p) continue; |
| 258 | 258 | $fn[] = $p; |
@@ -260,7 +260,7 @@ discard block |
||
| 260 | 260 | $fn = array_unique($fn); |
| 261 | 261 | $x = ""; |
| 262 | 262 | $first = true; |
| 263 | - foreach($fn as $p) { |
|
| 263 | + foreach ($fn as $p) { |
|
| 264 | 264 | if ($first) { |
| 265 | 265 | $x .= "$p"; |
| 266 | 266 | $first = false; |
@@ -303,7 +303,7 @@ discard block |
||
| 303 | 303 | |
| 304 | 304 | // return platforms as a human-readable string |
| 305 | 305 | // |
| 306 | -function get_platforms_string($url, $comma=true) { |
|
| 306 | +function get_platforms_string($url, $comma = true) { |
|
| 307 | 307 | $l = get_platforms_cached($url); |
| 308 | 308 | return make_friendly_string($l, $comma); |
| 309 | 309 | } |
@@ -334,7 +334,7 @@ discard block |
||
| 334 | 334 | // |
| 335 | 335 | function wfPlatforms() { |
| 336 | 336 | global $wgParser; |
| 337 | - $wgParser->setHook( "platforms", "get_platforms_string" ); |
|
| 337 | + $wgParser->setHook("platforms", "get_platforms_string"); |
|
| 338 | 338 | } |
| 339 | 339 | |
| 340 | 340 | $wgExtensionFunctions[] = "wfPlatforms"; |
@@ -13,8 +13,12 @@ discard block |
||
| 13 | 13 | $pc = substr($x[1], 0, -1); |
| 14 | 14 | } |
| 15 | 15 | |
| 16 | - if (strstr($p, "fubar")) return null; |
|
| 17 | - if ($p == 'x86_64-unknown-linux-gnu') return null; |
|
| 16 | + if (strstr($p, "fubar")) { |
|
| 17 | + return null; |
|
| 18 | + } |
|
| 19 | + if ($p == 'x86_64-unknown-linux-gnu') { |
|
| 20 | + return null; |
|
| 21 | + } |
|
| 18 | 22 | $q = $p; |
| 19 | 23 | switch ($p) { |
| 20 | 24 | case 'i686-pc-linux-gnu': $q = 'Linux/x86'; break; |
@@ -39,13 +43,21 @@ discard block |
||
| 39 | 43 | case 'arm-unknown-linux-gnueabihf': $q = 'Linux on ARM (e.g., Raspberry Pi)'; |
| 40 | 44 | } |
| 41 | 45 | if (strlen($pc)) { |
| 42 | - if (strstr($pc, 'cuda')) $q .= " (NVIDIA GPU)"; |
|
| 43 | - else if (strstr($pc, 'nvidia')) $q .= " (NVIDIA GPU)"; |
|
| 44 | - else if (strstr($pc, 'ati')) $q .= " (AMD/ATI GPU)"; |
|
| 45 | - else if (strstr($pc, 'intel_gpu')) $q .= " (Intel GPU)"; |
|
| 46 | - else if (strstr($pc, 'mt')) $q .= " (multicore)"; |
|
| 47 | - else if (strstr($pc, 'vbox32')) $q .= " (VirtualBox 32-bit)"; |
|
| 48 | - else if (strstr($pc, 'vbox64')) $q .= " (VirtualBox 64-bit)"; |
|
| 46 | + if (strstr($pc, 'cuda')) { |
|
| 47 | + $q .= " (NVIDIA GPU)"; |
|
| 48 | + } else if (strstr($pc, 'nvidia')) { |
|
| 49 | + $q .= " (NVIDIA GPU)"; |
|
| 50 | + } else if (strstr($pc, 'ati')) { |
|
| 51 | + $q .= " (AMD/ATI GPU)"; |
|
| 52 | + } else if (strstr($pc, 'intel_gpu')) { |
|
| 53 | + $q .= " (Intel GPU)"; |
|
| 54 | + } else if (strstr($pc, 'mt')) { |
|
| 55 | + $q .= " (multicore)"; |
|
| 56 | + } else if (strstr($pc, 'vbox32')) { |
|
| 57 | + $q .= " (VirtualBox 32-bit)"; |
|
| 58 | + } else if (strstr($pc, 'vbox64')) { |
|
| 59 | + $q .= " (VirtualBox 64-bit)"; |
|
| 60 | + } |
|
| 49 | 61 | } |
| 50 | 62 | return $q; |
| 51 | 63 | } |
@@ -71,19 +83,45 @@ discard block |
||
| 71 | 83 | $p = $y[0]; |
| 72 | 84 | $pc = substr($y[1], 0, -1); |
| 73 | 85 | } |
| 74 | - if (strstr($p, "windows")) $x->windows = true; |
|
| 75 | - if (strstr($p, "darwin")) $x->mac = true; |
|
| 76 | - if (strstr($p, "linux")) $x->linux = true; |
|
| 77 | - if (strstr($p, "android")) $x->android = true; |
|
| 78 | - if (strstr($p, "freebsd")) $x->freebsd = true; |
|
| 79 | - if (strstr($p, "arm-unknown-linux-gnueabihf")) $x->rasp_pi = true; |
|
| 80 | - if (strstr($p, "armv5")) $x->rasp_pi = true; |
|
| 81 | - if (strstr($p, "armv6")) $x->rasp_pi = true; |
|
| 82 | - if (strstr($pc, "ati")) $x->amd_gpu = true; |
|
| 83 | - if (strstr($pc, "cuda")) $x->nvidia_gpu = true; |
|
| 84 | - if (strstr($pc, "nvidia")) $x->nvidia_gpu = true; |
|
| 85 | - if (strstr($pc, "intel_gpu")) $x->intel_gpu = true; |
|
| 86 | - if (strstr($pc, "vbox")) $x->vbox = true; |
|
| 86 | + if (strstr($p, "windows")) { |
|
| 87 | + $x->windows = true; |
|
| 88 | + } |
|
| 89 | + if (strstr($p, "darwin")) { |
|
| 90 | + $x->mac = true; |
|
| 91 | + } |
|
| 92 | + if (strstr($p, "linux")) { |
|
| 93 | + $x->linux = true; |
|
| 94 | + } |
|
| 95 | + if (strstr($p, "android")) { |
|
| 96 | + $x->android = true; |
|
| 97 | + } |
|
| 98 | + if (strstr($p, "freebsd")) { |
|
| 99 | + $x->freebsd = true; |
|
| 100 | + } |
|
| 101 | + if (strstr($p, "arm-unknown-linux-gnueabihf")) { |
|
| 102 | + $x->rasp_pi = true; |
|
| 103 | + } |
|
| 104 | + if (strstr($p, "armv5")) { |
|
| 105 | + $x->rasp_pi = true; |
|
| 106 | + } |
|
| 107 | + if (strstr($p, "armv6")) { |
|
| 108 | + $x->rasp_pi = true; |
|
| 109 | + } |
|
| 110 | + if (strstr($pc, "ati")) { |
|
| 111 | + $x->amd_gpu = true; |
|
| 112 | + } |
|
| 113 | + if (strstr($pc, "cuda")) { |
|
| 114 | + $x->nvidia_gpu = true; |
|
| 115 | + } |
|
| 116 | + if (strstr($pc, "nvidia")) { |
|
| 117 | + $x->nvidia_gpu = true; |
|
| 118 | + } |
|
| 119 | + if (strstr($pc, "intel_gpu")) { |
|
| 120 | + $x->intel_gpu = true; |
|
| 121 | + } |
|
| 122 | + if (strstr($pc, "vbox")) { |
|
| 123 | + $x->vbox = true; |
|
| 124 | + } |
|
| 87 | 125 | } |
| 88 | 126 | return $x; |
| 89 | 127 | } |
@@ -126,9 +164,15 @@ discard block |
||
| 126 | 164 | } |
| 127 | 165 | |
| 128 | 166 | function canonical_plan_class($pc) { |
| 129 | - if (strstr($pc, "atiOpenCL")) return "opencl_ati"; |
|
| 130 | - if (strstr($pc, "nvidiaOpenCL")) return "opencl_nvidia"; |
|
| 131 | - if (strstr($pc, "intelOpenCL")) return "opencl_intel_gpu"; |
|
| 167 | + if (strstr($pc, "atiOpenCL")) { |
|
| 168 | + return "opencl_ati"; |
|
| 169 | + } |
|
| 170 | + if (strstr($pc, "nvidiaOpenCL")) { |
|
| 171 | + return "opencl_nvidia"; |
|
| 172 | + } |
|
| 173 | + if (strstr($pc, "intelOpenCL")) { |
|
| 174 | + return "opencl_intel_gpu"; |
|
| 175 | + } |
|
| 132 | 176 | return $pc; |
| 133 | 177 | } |
| 134 | 178 | |
@@ -136,10 +180,16 @@ discard block |
||
| 136 | 180 | // |
| 137 | 181 | function valid($url, $plat) { |
| 138 | 182 | if (strstr($url, "gpugrid.net")) { |
| 139 | - if (strstr($plat, "android")) return false; |
|
| 140 | - if (strstr($plat, "vbox")) return false; |
|
| 183 | + if (strstr($plat, "android")) { |
|
| 184 | + return false; |
|
| 185 | + } |
|
| 186 | + if (strstr($plat, "vbox")) { |
|
| 187 | + return false; |
|
| 188 | + } |
|
| 141 | 189 | } else if (strstr($url, "csgrid")) { |
| 142 | - if (strstr($plat, "android")) return false; |
|
| 190 | + if (strstr($plat, "android")) { |
|
| 191 | + return false; |
|
| 192 | + } |
|
| 143 | 193 | } |
| 144 | 194 | return true; |
| 145 | 195 | } |
@@ -165,7 +215,9 @@ discard block |
||
| 165 | 215 | // ... |
| 166 | 216 | // |
| 167 | 217 | function get_platforms($url) { |
| 168 | - if (strstr($url, "radioactive")) return null; |
|
| 218 | + if (strstr($url, "radioactive")) { |
|
| 219 | + return null; |
|
| 220 | + } |
|
| 169 | 221 | $url .= 'get_project_config.php'; |
| 170 | 222 | $x = @file_get_contents($url); |
| 171 | 223 | if (!$x) { |
@@ -230,7 +282,9 @@ discard block |
||
| 230 | 282 | $list = null; |
| 231 | 283 | foreach($s->application as $a) { |
| 232 | 284 | foreach ($a->version as $v) { |
| 233 | - if (!array_key_exists('platform_short', $v)) continue; |
|
| 285 | + if (!array_key_exists('platform_short', $v)) { |
|
| 286 | + continue; |
|
| 287 | + } |
|
| 234 | 288 | $p = $v->platform_short[0]; |
| 235 | 289 | $pc = ""; |
| 236 | 290 | if (array_key_exists('plan_class', $v)) { |
@@ -250,11 +304,15 @@ discard block |
||
| 250 | 304 | // list of human-readable names |
| 251 | 305 | // |
| 252 | 306 | function make_friendly_string($l, $comma) { |
| 253 | - if (!count($l)) return "Unknown"; |
|
| 307 | + if (!count($l)) { |
|
| 308 | + return "Unknown"; |
|
| 309 | + } |
|
| 254 | 310 | $fn = array(); |
| 255 | 311 | foreach($l as $p) { |
| 256 | 312 | $p = friendly_name($p); |
| 257 | - if (!$p) continue; |
|
| 313 | + if (!$p) { |
|
| 314 | + continue; |
|
| 315 | + } |
|
| 258 | 316 | $fn[] = $p; |
| 259 | 317 | } |
| 260 | 318 | $fn = array_unique($fn); |