@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | } |
| 41 | 41 | $error = merge_hosts($host, $newest_host); |
| 42 | 42 | if (!$error) { |
| 43 | - echo "<br>".tra("Merged %1 into %2",$host->id,$newest_host->id)."\n"; |
|
| 43 | + echo "<br>".tra("Merged %1 into %2", $host->id, $newest_host->id)."\n"; |
|
| 44 | 44 | } else { |
| 45 | 45 | echo "<br>$error\n"; |
| 46 | 46 | } |
@@ -52,10 +52,10 @@ discard block |
||
| 52 | 52 | function merge_by_name($userid) { |
| 53 | 53 | $hosts = array(); |
| 54 | 54 | $host_list = BoincHost::enum("userid=$userid"); |
| 55 | - foreach($host_list as $host) { |
|
| 55 | + foreach ($host_list as $host) { |
|
| 56 | 56 | $hosts[$host->domain_name][] = $host; |
| 57 | 57 | } |
| 58 | - foreach($hosts as $hlist) { |
|
| 58 | + foreach ($hosts as $hlist) { |
|
| 59 | 59 | merge_name($hlist); |
| 60 | 60 | } |
| 61 | 61 | } |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | start_table(); |
| 50 | 50 | |
| 51 | 51 | $get_reason = true; |
| 52 | -if (get_str('action')=="hide") { |
|
| 52 | +if (get_str('action') == "hide") { |
|
| 53 | 53 | //display input that selects reason |
| 54 | 54 | echo "<input type=hidden name=action value=hide>"; |
| 55 | 55 | row1(tra("Hide post")); |
@@ -66,12 +66,12 @@ discard block |
||
| 66 | 66 | ) |
| 67 | 67 | ) |
| 68 | 68 | ); |
| 69 | -} elseif (get_str('action')=="move") { |
|
| 69 | +} elseif (get_str('action') == "move") { |
|
| 70 | 70 | row1(tra("Move post")); |
| 71 | 71 | echo "<input type=hidden name=action value=move>"; |
| 72 | 72 | row2(tra("Destination thread ID:"), "<input name=\"threadid\">"); |
| 73 | 73 | // TODO: display where to move the post as a dropdown instead of having to get ID |
| 74 | -} elseif (get_str('action')=="banish_user") { |
|
| 74 | +} elseif (get_str('action') == "banish_user") { |
|
| 75 | 75 | $userid = get_int('userid'); |
| 76 | 76 | $user = BoincUser::lookup_id($userid); |
| 77 | 77 | BoincForumPrefs::lookup($user); |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | error_page("no user found"); |
| 80 | 80 | } |
| 81 | 81 | $x = $user->prefs->banished_until; |
| 82 | - if ($x>time()) { |
|
| 82 | + if ($x > time()) { |
|
| 83 | 83 | error_page(tra("User is already banished")); |
| 84 | 84 | } |
| 85 | 85 | row1(tra("Banish user")); |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | echo "<input type=\"hidden\" name=\"id\" value=\"".$postid."\">\n"; |
| 98 | 98 | echo "<input type=\"hidden\" name=\"userid\" value=\"".$userid."\">\n"; |
| 99 | 99 | echo "<input type=\"hidden\" name=\"confirmed\" value=\"yes\">\n"; |
| 100 | -} elseif (get_str('action')=="delete") { |
|
| 100 | +} elseif (get_str('action') == "delete") { |
|
| 101 | 101 | echo "<input type=hidden name=action value=delete>"; |
| 102 | 102 | row2( |
| 103 | 103 | "Are you sure want to delete this post? This cannot be undone.", |
@@ -41,7 +41,7 @@ |
||
| 41 | 41 | $nhosts = get_int("nhosts"); |
| 42 | 42 | $hostid = get_int("id_0"); |
| 43 | 43 | $latest_host = get_host($hostid, $user); |
| 44 | -for ($i=1; $i<$nhosts; $i++) { |
|
| 44 | +for ($i = 1; $i < $nhosts; $i++) { |
|
| 45 | 45 | $var = "id_$i"; |
| 46 | 46 | $hostid = get_int($var, true); |
| 47 | 47 | if (!$hostid) continue; |
@@ -54,7 +54,7 @@ |
||
| 54 | 54 | if (!is_valid_country($country)) { |
| 55 | 55 | error_page(tra("bad country")); |
| 56 | 56 | } |
| 57 | -$joinable = post_str('joinable', true)?1:0; |
|
| 57 | +$joinable = post_str('joinable', true) ? 1 : 0; |
|
| 58 | 58 | |
| 59 | 59 | $t = BoincTeam::lookup("name='$team_name'"); |
| 60 | 60 | if ($t && $t->id != $teamid) { |
@@ -148,6 +148,6 @@ |
||
| 148 | 148 | |
| 149 | 149 | page_tail(); |
| 150 | 150 | |
| 151 | -$cvs_version_tracker[]="\$Id$"; //Generated automatically - do not edit |
|
| 151 | +$cvs_version_tracker[] = "\$Id$"; //Generated automatically - do not edit |
|
| 152 | 152 | |
| 153 | 153 | ?> |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | page_tail(); |
| 45 | 45 | exit; |
| 46 | 46 | } |
| 47 | - if (substr($user->authenticator, 0, 1) == 'x'){ |
|
| 47 | + if (substr($user->authenticator, 0, 1) == 'x') { |
|
| 48 | 48 | sleep(LOGIN_FAIL_SLEEP_SEC); |
| 49 | 49 | error_page("This account has been administratively disabled."); |
| 50 | 50 | } |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | Please <a href=get_passwd.php>try again</a>. |
| 106 | 106 | "; |
| 107 | 107 | page_tail(); |
| 108 | - } else if (substr($user->authenticator, 0, 1) == 'x'){ |
|
| 108 | + } else if (substr($user->authenticator, 0, 1) == 'x') { |
|
| 109 | 109 | sleep(LOGIN_FAIL_SLEEP_SEC); |
| 110 | 110 | error_page("This account has been administratively disabled."); |
| 111 | 111 | } else { |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | page_tail(); |
| 45 | 45 | exit; |
| 46 | 46 | } |
| 47 | - if (substr($user->authenticator, 0, 1) == 'x'){ |
|
| 47 | + if (substr($user->authenticator, 0, 1) == 'x') { |
|
| 48 | 48 | sleep(LOGIN_FAIL_SLEEP_SEC); |
| 49 | 49 | error_page("This account has been administratively disabled."); |
| 50 | 50 | } |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | Please <a href=get_passwd.php>try again</a>. |
| 106 | 106 | "; |
| 107 | 107 | page_tail(); |
| 108 | - } else if (substr($user->authenticator, 0, 1) == 'x'){ |
|
| 108 | + } else if (substr($user->authenticator, 0, 1) == 'x') { |
|
| 109 | 109 | sleep(LOGIN_FAIL_SLEEP_SEC); |
| 110 | 110 | error_page("This account has been administratively disabled."); |
| 111 | 111 | } else { |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | $ppid=$pstatus['pid']; |
| 36 | 36 | $ret=`ps -o pid --no-heading --ppid $ppid`; |
| 37 | 37 | //echo "parent pid is $ppid\nterninate it\n"; |
| 38 | - proc_terminate($p); |
|
| 38 | + proc_terminate($p); |
|
| 39 | 39 | // echo "child process is $ret\n"; |
| 40 | 40 | $pids=preg_split('/\s+/',$ret); |
| 41 | 41 | foreach($pids as $pid){ |
@@ -61,9 +61,9 @@ discard block |
||
| 61 | 61 | while (1) { |
| 62 | 62 | $ctime=time(); |
| 63 | 63 | if($ctime-$stime >=2 and ! file_exists("log.1")){ |
| 64 | - if($GLOBALS["debug"]) echo "time out "."<br>"; |
|
| 65 | - terminate_job($p); |
|
| 66 | - break; |
|
| 64 | + if($GLOBALS["debug"]) echo "time out "."<br>"; |
|
| 65 | + terminate_job($p); |
|
| 66 | + break; |
|
| 67 | 67 | } |
| 68 | 68 | if (file_exists("log.1")) { |
| 69 | 69 | list($avg_cpu, $test_steps) = calc_step_cpu("log.1"); |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | } |
| 113 | 113 | fclose($fd); |
| 114 | 114 | //$total_steps = $loopno*$looprun; |
| 115 | - if($GLOBALS["debug"])print "total_steps = ".$total_steps."<br>"; |
|
| 115 | + if($GLOBALS["debug"])print "total_steps = ".$total_steps."<br>"; |
|
| 116 | 116 | return $total_steps; |
| 117 | 117 | } |
| 118 | 118 | |
@@ -147,12 +147,12 @@ discard block |
||
| 147 | 147 | $cpu = (float)$arr[2]; |
| 148 | 148 | //echo "step=".$step." cpu=".$cpu."\n"; |
| 149 | 149 | if ($cpu==0) { |
| 150 | - $count=0; |
|
| 151 | - $start_step = $step; |
|
| 150 | + $count=0; |
|
| 151 | + $start_step = $step; |
|
| 152 | 152 | } else { |
| 153 | 153 | $count+=1; |
| 154 | 154 | if($GLOBALS["debug"])echo "step=".$step." cpu=".$cpu."count=".$count."<br>"; |
| 155 | - if($count >= 10) { |
|
| 155 | + if($count >= 10) { |
|
| 156 | 156 | $end_step = $step; |
| 157 | 157 | $steps = $end_step-$start_step; |
| 158 | 158 | $avg_cpu = $cpu/$steps; |
@@ -183,7 +183,7 @@ discard block |
||
| 183 | 183 | |
| 184 | 184 | if(preg_match("/^\s*dump\s+(\d)\s+/", $line,$matches)) |
| 185 | 185 | { |
| 186 | - if($GLOBALS["debug"]){print "matches=";print_r($matches);} |
|
| 186 | + if($GLOBALS["debug"]){print "matches=";print_r($matches);} |
|
| 187 | 187 | |
| 188 | 188 | $dump_types=(int)$matches[1]; |
| 189 | 189 | break; |
@@ -198,7 +198,7 @@ discard block |
||
| 198 | 198 | echo "can not open file $cmd_file\n"; |
| 199 | 199 | exit(-1); |
| 200 | 200 | } |
| 201 | - if($GLOBALS["debug"]) print "structure_file_size=".$structure_file_size."<br>"; |
|
| 201 | + if($GLOBALS["debug"]) print "structure_file_size=".$structure_file_size."<br>"; |
|
| 202 | 202 | |
| 203 | 203 | $loopno=1; |
| 204 | 204 | $looprun=1; |
@@ -216,8 +216,8 @@ discard block |
||
| 216 | 216 | } |
| 217 | 217 | fclose($fd); |
| 218 | 218 | if($GLOBALS["debug"]){ |
| 219 | - print "max loopno(number of loops to run)=".$loopno."<br>"; |
|
| 220 | - print "max looprun(steps for each loop)=".$looprun."<br>"; |
|
| 219 | + print "max loopno(number of loops to run)=".$loopno."<br>"; |
|
| 220 | + print "max looprun(steps for each loop)=".$looprun."<br>"; |
|
| 221 | 221 | } |
| 222 | 222 | //$est_size = $loopno*$structure_file_size*0.8*$dump_types; |
| 223 | 223 | $test_log_size = filesize("log.1"); |
@@ -368,7 +368,7 @@ discard block |
||
| 368 | 368 | <br>Please refer to the following Error Message:<br><p> |
| 369 | 369 | "; |
| 370 | 370 | foreach($err_msgs as $line){ |
| 371 | - $err=$err.$line."<br>"; |
|
| 371 | + $err=$err.$line."<br>"; |
|
| 372 | 372 | } |
| 373 | 373 | $err=$err." <p> |
| 374 | 374 | <a href=sandbox.php><strong> File_Sandbox </strong></a> |
@@ -393,7 +393,7 @@ discard block |
||
| 393 | 393 | // |
| 394 | 394 | $njobs = count(file($cmdline_file_path)); |
| 395 | 395 | $secs_est = estimated_makespan($njobs, $info->rsc_fpops_est); |
| 396 | - if($GLOBALS["debug"])echo "secs_est is $secs_est\n"; |
|
| 396 | + if($GLOBALS["debug"])echo "secs_est is $secs_est\n"; |
|
| 397 | 397 | //assume the server's flops is 1.5G and the average client's flops is 1G |
| 398 | 398 | $hrs_est = number_format($secs_est*1.5/60, 2); |
| 399 | 399 | //$hrs_est = number_format($secs_est, 2); |
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | require_once("../inc/util.inc"); |
| 19 | 19 | require_once("../inc/submit_db.inc"); |
| 20 | 20 | require_once("../inc/sandbox.inc"); |
| 21 | -$debug=0; |
|
| 21 | +$debug = 0; |
|
| 22 | 22 | |
| 23 | 23 | // test a LAMMPS job |
| 24 | 24 | // |
@@ -31,17 +31,17 @@ discard block |
||
| 31 | 31 | // output: success flag, CPU time per step, est. disk usage per job |
| 32 | 32 | // |
| 33 | 33 | function terminate_job($p) { |
| 34 | - $pstatus=proc_get_status($p); |
|
| 35 | - $ppid=$pstatus['pid']; |
|
| 36 | - $ret=`ps -o pid --no-heading --ppid $ppid`; |
|
| 34 | + $pstatus = proc_get_status($p); |
|
| 35 | + $ppid = $pstatus['pid']; |
|
| 36 | + $ret = `ps -o pid --no-heading --ppid $ppid`; |
|
| 37 | 37 | //echo "parent pid is $ppid\nterninate it\n"; |
| 38 | 38 | proc_terminate($p); |
| 39 | 39 | // echo "child process is $ret\n"; |
| 40 | - $pids=preg_split('/\s+/',$ret); |
|
| 41 | - foreach($pids as $pid){ |
|
| 42 | - if(is_numeric($pid)){ |
|
| 43 | - if($GLOBALS["debug"])echo "killing child process $pid\n"; |
|
| 44 | - posix_kill($pid,9); |
|
| 40 | + $pids = preg_split('/\s+/', $ret); |
|
| 41 | + foreach ($pids as $pid) { |
|
| 42 | + if (is_numeric($pid)) { |
|
| 43 | + if ($GLOBALS["debug"])echo "killing child process $pid\n"; |
|
| 44 | + posix_kill($pid, 9); |
|
| 45 | 45 | } |
| 46 | 46 | } |
| 47 | 47 | } |
@@ -52,23 +52,23 @@ discard block |
||
| 52 | 52 | $descs = array(); |
| 53 | 53 | $pipes = array(); |
| 54 | 54 | $options = file("cmd_variables"); |
| 55 | - $options[0] = chop($options[0],"\n"); |
|
| 55 | + $options[0] = chop($options[0], "\n"); |
|
| 56 | 56 | $cmd = "../lmp_linux ".$options[0]."&>output"; |
| 57 | 57 | if ($GLOBALS["debug"]) echo $cmd."<br>"; |
| 58 | 58 | system("unzip pot_files >/dev/null"); |
| 59 | 59 | $stime = time(); |
| 60 | 60 | $p = proc_open("$cmd", $descs, $pipes); |
| 61 | 61 | while (1) { |
| 62 | - $ctime=time(); |
|
| 63 | - if($ctime-$stime >=2 and ! file_exists("log.1")){ |
|
| 64 | - if($GLOBALS["debug"]) echo "time out "."<br>"; |
|
| 62 | + $ctime = time(); |
|
| 63 | + if ($ctime - $stime >= 2 and !file_exists("log.1")) { |
|
| 64 | + if ($GLOBALS["debug"]) echo "time out "."<br>"; |
|
| 65 | 65 | terminate_job($p); |
| 66 | 66 | break; |
| 67 | 67 | } |
| 68 | 68 | if (file_exists("log.1")) { |
| 69 | 69 | list($avg_cpu, $test_steps) = calc_step_cpu("log.1"); |
| 70 | 70 | if ($avg_cpu != 0) { |
| 71 | - if($GLOBALS["debug"])echo "avg_cpu is ".$avg_cpu."<br>"; |
|
| 71 | + if ($GLOBALS["debug"])echo "avg_cpu is ".$avg_cpu."<br>"; |
|
| 72 | 72 | terminate_job($p); |
| 73 | 73 | $test_result = 1; |
| 74 | 74 | break; |
@@ -87,32 +87,32 @@ discard block |
||
| 87 | 87 | } |
| 88 | 88 | |
| 89 | 89 | function get_total_steps($cmd_file) { |
| 90 | - $fd = fopen($cmd_file,"r"); |
|
| 90 | + $fd = fopen($cmd_file, "r"); |
|
| 91 | 91 | if (!$fd) { |
| 92 | 92 | echo "can not open file $cmd_file\n"; |
| 93 | 93 | exit(-1); |
| 94 | 94 | } |
| 95 | 95 | $this_loopno = 1; |
| 96 | 96 | $this_looprun = 1; |
| 97 | - $total_steps=1; |
|
| 97 | + $total_steps = 1; |
|
| 98 | 98 | while (!feof($fd)) { |
| 99 | - $line = fgets($fd,4096); |
|
| 99 | + $line = fgets($fd, 4096); |
|
| 100 | 100 | if (preg_match("/loopnumber\s+\d+/", $line, $matches) |
| 101 | 101 | && preg_match("/\d+/", $matches[0], $no) |
| 102 | 102 | ) { |
| 103 | - $this_loopno=$no[0]; |
|
| 103 | + $this_loopno = $no[0]; |
|
| 104 | 104 | } |
| 105 | 105 | if (preg_match("/looprun\s+\d+/", $line, $matches) |
| 106 | 106 | and preg_match("/\d+/", $matches[0], $no) |
| 107 | 107 | ) { |
| 108 | - $this_looprun=$no[0]; |
|
| 109 | - if($this_loopno*$this_looprun>$total_steps)$total_steps=$this_loopno*$this_looprun; |
|
| 108 | + $this_looprun = $no[0]; |
|
| 109 | + if ($this_loopno*$this_looprun > $total_steps)$total_steps = $this_loopno*$this_looprun; |
|
| 110 | 110 | } |
| 111 | 111 | |
| 112 | 112 | } |
| 113 | 113 | fclose($fd); |
| 114 | 114 | //$total_steps = $loopno*$looprun; |
| 115 | - if($GLOBALS["debug"])print "total_steps = ".$total_steps."<br>"; |
|
| 115 | + if ($GLOBALS["debug"])print "total_steps = ".$total_steps."<br>"; |
|
| 116 | 116 | return $total_steps; |
| 117 | 117 | } |
| 118 | 118 | |
@@ -130,8 +130,8 @@ discard block |
||
| 130 | 130 | } |
| 131 | 131 | $count = 0; |
| 132 | 132 | while (!feof($fd)) { |
| 133 | - $line = fgets($fd,4096); |
|
| 134 | - if (preg_match('/^Step\s+CPU/',$line)) { |
|
| 133 | + $line = fgets($fd, 4096); |
|
| 134 | + if (preg_match('/^Step\s+CPU/', $line)) { |
|
| 135 | 135 | //echo $line."\n"; |
| 136 | 136 | $start = 1; |
| 137 | 137 | continue; |
@@ -140,24 +140,24 @@ discard block |
||
| 140 | 140 | $arr = preg_split("/\s+/", $line); |
| 141 | 141 | //print_r($arr); |
| 142 | 142 | |
| 143 | - if (count($arr) <=6 || !is_numeric($arr[1])) { |
|
| 143 | + if (count($arr) <= 6 || !is_numeric($arr[1])) { |
|
| 144 | 144 | continue; |
| 145 | 145 | } |
| 146 | 146 | $step = (int)$arr[1]; |
| 147 | 147 | $cpu = (float)$arr[2]; |
| 148 | 148 | //echo "step=".$step." cpu=".$cpu."\n"; |
| 149 | - if ($cpu==0) { |
|
| 150 | - $count=0; |
|
| 149 | + if ($cpu == 0) { |
|
| 150 | + $count = 0; |
|
| 151 | 151 | $start_step = $step; |
| 152 | 152 | } else { |
| 153 | - $count+=1; |
|
| 154 | - if($GLOBALS["debug"])echo "step=".$step." cpu=".$cpu."count=".$count."<br>"; |
|
| 155 | - if($count >= 10) { |
|
| 153 | + $count += 1; |
|
| 154 | + if ($GLOBALS["debug"])echo "step=".$step." cpu=".$cpu."count=".$count."<br>"; |
|
| 155 | + if ($count >= 10) { |
|
| 156 | 156 | $end_step = $step; |
| 157 | - $steps = $end_step-$start_step; |
|
| 157 | + $steps = $end_step - $start_step; |
|
| 158 | 158 | $avg_cpu = $cpu/$steps; |
| 159 | 159 | #$avg_cpu = $cpu/$count; |
| 160 | - if ($GLOBALS["debug"]){ |
|
| 160 | + if ($GLOBALS["debug"]) { |
|
| 161 | 161 | echo "test steps is ".$steps."<br>"; |
| 162 | 162 | echo "avg_cpu is ".$avg_cpu."<br>"; |
| 163 | 163 | } |
@@ -166,56 +166,56 @@ discard block |
||
| 166 | 166 | } |
| 167 | 167 | } |
| 168 | 168 | } |
| 169 | - return array($avg_cpu,$test_steps); |
|
| 169 | + return array($avg_cpu, $test_steps); |
|
| 170 | 170 | } |
| 171 | 171 | |
| 172 | -function calc_est_size($lammps_script, $structure_file, $cmd_file,$test_steps){ |
|
| 172 | +function calc_est_size($lammps_script, $structure_file, $cmd_file, $test_steps) { |
|
| 173 | 173 | $dump_types = 0; |
| 174 | - $fd = fopen($lammps_script,"r"); |
|
| 175 | - if (!$fd){ |
|
| 174 | + $fd = fopen($lammps_script, "r"); |
|
| 175 | + if (!$fd) { |
|
| 176 | 176 | echo "can not open file $lammps_script\n"; |
| 177 | 177 | exit(-1); |
| 178 | 178 | } |
| 179 | - while (!feof($fd)){ |
|
| 179 | + while (!feof($fd)) { |
|
| 180 | 180 | $line = fgets($fd, 4096); |
| 181 | 181 | //if (preg_match("/^\s*dump/", $line) |
| 182 | 182 | // and preg_match_all("/dump\S+\.\w{3}/", $line, $matches, PREG_PATTERN_ORDER)) |
| 183 | 183 | |
| 184 | - if(preg_match("/^\s*dump\s+(\d)\s+/", $line,$matches)) |
|
| 184 | + if (preg_match("/^\s*dump\s+(\d)\s+/", $line, $matches)) |
|
| 185 | 185 | { |
| 186 | - if($GLOBALS["debug"]){print "matches=";print_r($matches);} |
|
| 186 | + if ($GLOBALS["debug"]) {print "matches="; print_r($matches); } |
|
| 187 | 187 | |
| 188 | - $dump_types=(int)$matches[1]; |
|
| 188 | + $dump_types = (int)$matches[1]; |
|
| 189 | 189 | break; |
| 190 | 190 | } |
| 191 | 191 | } |
| 192 | 192 | fclose($fd); |
| 193 | - if($GLOBALS["debug"])print "dump_types= ".$dump_types."<br>"; |
|
| 193 | + if ($GLOBALS["debug"])print "dump_types= ".$dump_types."<br>"; |
|
| 194 | 194 | |
| 195 | 195 | $structure_file_size = filesize($structure_file); |
| 196 | - $fd = fopen($cmd_file,"r"); |
|
| 197 | - if (!$fd){ |
|
| 196 | + $fd = fopen($cmd_file, "r"); |
|
| 197 | + if (!$fd) { |
|
| 198 | 198 | echo "can not open file $cmd_file\n"; |
| 199 | 199 | exit(-1); |
| 200 | 200 | } |
| 201 | - if($GLOBALS["debug"]) print "structure_file_size=".$structure_file_size."<br>"; |
|
| 201 | + if ($GLOBALS["debug"]) print "structure_file_size=".$structure_file_size."<br>"; |
|
| 202 | 202 | |
| 203 | - $loopno=1; |
|
| 204 | - $looprun=1; |
|
| 205 | - while (!feof($fd)){ |
|
| 206 | - $line = fgets($fd,4096); |
|
| 207 | - if(preg_match("/loopnumber\s+\d+/", $line, $matches)){ |
|
| 208 | - if(preg_match("/\d+/", $matches[0], $no)){ |
|
| 203 | + $loopno = 1; |
|
| 204 | + $looprun = 1; |
|
| 205 | + while (!feof($fd)) { |
|
| 206 | + $line = fgets($fd, 4096); |
|
| 207 | + if (preg_match("/loopnumber\s+\d+/", $line, $matches)) { |
|
| 208 | + if (preg_match("/\d+/", $matches[0], $no)) { |
|
| 209 | 209 | //$loopno=$no[0]; |
| 210 | - if($no[0]>$loopno)$loopno=$no[0]; |
|
| 210 | + if ($no[0] > $loopno)$loopno = $no[0]; |
|
| 211 | 211 | } |
| 212 | 212 | } |
| 213 | 213 | if (preg_match("/looprun\s+\d+/", $line, $matches) and preg_match("/\d+/", $matches[0], $no)) { |
| 214 | - if($no[0]>$looprun)$looprun=$no[0]; |
|
| 214 | + if ($no[0] > $looprun)$looprun = $no[0]; |
|
| 215 | 215 | } |
| 216 | 216 | } |
| 217 | 217 | fclose($fd); |
| 218 | - if($GLOBALS["debug"]){ |
|
| 218 | + if ($GLOBALS["debug"]) { |
|
| 219 | 219 | print "max loopno(number of loops to run)=".$loopno."<br>"; |
| 220 | 220 | print "max looprun(steps for each loop)=".$looprun."<br>"; |
| 221 | 221 | } |
@@ -226,12 +226,12 @@ discard block |
||
| 226 | 226 | $dump_files = glob("dump1*"); |
| 227 | 227 | $test_dump_file = $dump_files[0]; |
| 228 | 228 | $test_dump_size = filesize($test_dump_file); |
| 229 | - $dump_size1 = $test_dump_size+0.5*$test_dump_size*ceil(($looprun-$test_steps)/$test_steps); |
|
| 229 | + $dump_size1 = $test_dump_size + 0.5*$test_dump_size*ceil(($looprun - $test_steps)/$test_steps); |
|
| 230 | 230 | $dump_size = $loopno*$dump_size1*$dump_types; |
| 231 | 231 | $app_fixed_size = 5e7; |
| 232 | - $est_size = $log_size+$dump_size+$app_fixed_size; |
|
| 232 | + $est_size = $log_size + $dump_size + $app_fixed_size; |
|
| 233 | 233 | |
| 234 | - if($GLOBALS["debug"]){ |
|
| 234 | + if ($GLOBALS["debug"]) { |
|
| 235 | 235 | print "test_steps=".$test_steps."<br>"; |
| 236 | 236 | print "test_log_size=".$test_log_size."<br>"; |
| 237 | 237 | print "log_size1=".$log_size1."<br>"; |
@@ -322,7 +322,7 @@ discard block |
||
| 322 | 322 | if ($njobs < $nhosts) { |
| 323 | 323 | return $flops_per_job/$median_flops; |
| 324 | 324 | } else { |
| 325 | - $k = (int)(($njobs+$nhosts-1)/$nhosts); |
|
| 325 | + $k = (int)(($njobs + $nhosts - 1)/$nhosts); |
|
| 326 | 326 | return $k*$flops_per_job/$median_flops; |
| 327 | 327 | } |
| 328 | 328 | } |
@@ -362,27 +362,27 @@ discard block |
||
| 362 | 362 | if ($GLOBALS["debug"]) { |
| 363 | 363 | print "est_cpu_time is ".$est_cpu_time."<br>"; |
| 364 | 364 | } |
| 365 | - if ($error==0) { |
|
| 366 | - $err_msgs=file("output"); |
|
| 367 | - $err="Your test job <strong>failed</strong> |
|
| 365 | + if ($error == 0) { |
|
| 366 | + $err_msgs = file("output"); |
|
| 367 | + $err = "Your test job <strong>failed</strong> |
|
| 368 | 368 | <br>Please refer to the following Error Message:<br><p> |
| 369 | 369 | "; |
| 370 | - foreach($err_msgs as $line){ |
|
| 371 | - $err=$err.$line."<br>"; |
|
| 370 | + foreach ($err_msgs as $line) { |
|
| 371 | + $err = $err.$line."<br>"; |
|
| 372 | 372 | } |
| 373 | - $err=$err." <p> |
|
| 373 | + $err = $err." <p> |
|
| 374 | 374 | <a href=sandbox.php><strong> File_Sandbox </strong></a> |
| 375 | 375 | "; |
| 376 | 376 | error_page($err); |
| 377 | 377 | } |
| 378 | 378 | |
| 379 | 379 | system("rm *"); |
| 380 | - $info->rsc_fpops_est = $est_cpu_time * 1.5e9; |
|
| 381 | - $info->rsc_fpops_bound = $info->rsc_fpops_est * 20; |
|
| 380 | + $info->rsc_fpops_est = $est_cpu_time*1.5e9; |
|
| 381 | + $info->rsc_fpops_bound = $info->rsc_fpops_est*20; |
|
| 382 | 382 | |
| 383 | - if ($disk==0){ |
|
| 384 | - $info->rsc_disk_bound=1000000; |
|
| 385 | - } else{ |
|
| 383 | + if ($disk == 0) { |
|
| 384 | + $info->rsc_disk_bound = 1000000; |
|
| 385 | + } else { |
|
| 386 | 386 | $info->rsc_disk_bound = $disk; |
| 387 | 387 | } |
| 388 | 388 | |
@@ -393,7 +393,7 @@ discard block |
||
| 393 | 393 | // |
| 394 | 394 | $njobs = count(file($cmdline_file_path)); |
| 395 | 395 | $secs_est = estimated_makespan($njobs, $info->rsc_fpops_est); |
| 396 | - if($GLOBALS["debug"])echo "secs_est is $secs_est\n"; |
|
| 396 | + if ($GLOBALS["debug"])echo "secs_est is $secs_est\n"; |
|
| 397 | 397 | //assume the server's flops is 1.5G and the average client's flops is 1G |
| 398 | 398 | $hrs_est = number_format($secs_est*1.5/60, 2); |
| 399 | 399 | //$hrs_est = number_format($secs_est, 2); |
@@ -417,8 +417,8 @@ discard block |
||
| 417 | 417 | } |
| 418 | 418 | |
| 419 | 419 | function submit_job($app, $batch_id, $info, $cmdline, $i) { |
| 420 | - $client_disk=$info->rsc_disk_bound*2; |
|
| 421 | - if($client_disk<500000000) $client_disk=500000000; |
|
| 420 | + $client_disk = $info->rsc_disk_bound*2; |
|
| 421 | + if ($client_disk < 500000000) $client_disk = 500000000; |
|
| 422 | 422 | $cmd = "cd ../..; ./bin/create_work --appname $app->name --batch $batch_id --rsc_fpops_est $info->rsc_fpops_est --rsc_fpops_bound $info->rsc_fpops_bound --rsc_disk_bound $client_disk"; |
| 423 | 423 | if ($cmdline) { |
| 424 | 424 | $cmd .= " --command_line \"$cmdline\""; |
@@ -442,9 +442,9 @@ discard block |
||
| 442 | 442 | $x = file_get_contents("$tmpfile"); |
| 443 | 443 | $info = unserialize($x); |
| 444 | 444 | |
| 445 | - $njobs=0; |
|
| 445 | + $njobs = 0; |
|
| 446 | 446 | $cmdlines = file($info->cmdline_file_path); |
| 447 | - foreach ($cmdlines as $cmdline){ |
|
| 447 | + foreach ($cmdlines as $cmdline) { |
|
| 448 | 448 | if (preg_match("/^\s*-var/", $cmdline)) { |
| 449 | 449 | $njobs++; |
| 450 | 450 | } |
@@ -460,7 +460,7 @@ discard block |
||
| 460 | 460 | |
| 461 | 461 | $i = 0; |
| 462 | 462 | foreach ($cmdlines as $cmdline) { |
| 463 | - if (preg_match("/^\s*-var/", $cmdline)){ |
|
| 463 | + if (preg_match("/^\s*-var/", $cmdline)) { |
|
| 464 | 464 | submit_job($app, $batch_id, $info, $cmdline, $i); |
| 465 | 465 | $i++; |
| 466 | 466 | } |
@@ -38,8 +38,8 @@ discard block |
||
| 38 | 38 | proc_terminate($p); |
| 39 | 39 | // echo "child process is $ret\n"; |
| 40 | 40 | $pids=preg_split('/\s+/',$ret); |
| 41 | - foreach($pids as $pid){ |
|
| 42 | - if(is_numeric($pid)){ |
|
| 41 | + foreach($pids as $pid) { |
|
| 42 | + if(is_numeric($pid)) { |
|
| 43 | 43 | if($GLOBALS["debug"])echo "killing child process $pid\n"; |
| 44 | 44 | posix_kill($pid,9); |
| 45 | 45 | } |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | $p = proc_open("$cmd", $descs, $pipes); |
| 61 | 61 | while (1) { |
| 62 | 62 | $ctime=time(); |
| 63 | - if($ctime-$stime >=2 and ! file_exists("log.1")){ |
|
| 63 | + if($ctime-$stime >=2 and ! file_exists("log.1")) { |
|
| 64 | 64 | if($GLOBALS["debug"]) echo "time out "."<br>"; |
| 65 | 65 | terminate_job($p); |
| 66 | 66 | break; |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | $steps = $end_step-$start_step; |
| 158 | 158 | $avg_cpu = $cpu/$steps; |
| 159 | 159 | #$avg_cpu = $cpu/$count; |
| 160 | - if ($GLOBALS["debug"]){ |
|
| 160 | + if ($GLOBALS["debug"]) { |
|
| 161 | 161 | echo "test steps is ".$steps."<br>"; |
| 162 | 162 | echo "avg_cpu is ".$avg_cpu."<br>"; |
| 163 | 163 | } |
@@ -169,20 +169,19 @@ discard block |
||
| 169 | 169 | return array($avg_cpu,$test_steps); |
| 170 | 170 | } |
| 171 | 171 | |
| 172 | -function calc_est_size($lammps_script, $structure_file, $cmd_file,$test_steps){ |
|
| 172 | +function calc_est_size($lammps_script, $structure_file, $cmd_file,$test_steps) { |
|
| 173 | 173 | $dump_types = 0; |
| 174 | 174 | $fd = fopen($lammps_script,"r"); |
| 175 | - if (!$fd){ |
|
| 175 | + if (!$fd) { |
|
| 176 | 176 | echo "can not open file $lammps_script\n"; |
| 177 | 177 | exit(-1); |
| 178 | 178 | } |
| 179 | - while (!feof($fd)){ |
|
| 179 | + while (!feof($fd)) { |
|
| 180 | 180 | $line = fgets($fd, 4096); |
| 181 | 181 | //if (preg_match("/^\s*dump/", $line) |
| 182 | 182 | // and preg_match_all("/dump\S+\.\w{3}/", $line, $matches, PREG_PATTERN_ORDER)) |
| 183 | 183 | |
| 184 | - if(preg_match("/^\s*dump\s+(\d)\s+/", $line,$matches)) |
|
| 185 | - { |
|
| 184 | + if(preg_match("/^\s*dump\s+(\d)\s+/", $line,$matches)) { |
|
| 186 | 185 | if($GLOBALS["debug"]){print "matches=";print_r($matches);} |
| 187 | 186 | |
| 188 | 187 | $dump_types=(int)$matches[1]; |
@@ -194,7 +193,7 @@ discard block |
||
| 194 | 193 | |
| 195 | 194 | $structure_file_size = filesize($structure_file); |
| 196 | 195 | $fd = fopen($cmd_file,"r"); |
| 197 | - if (!$fd){ |
|
| 196 | + if (!$fd) { |
|
| 198 | 197 | echo "can not open file $cmd_file\n"; |
| 199 | 198 | exit(-1); |
| 200 | 199 | } |
@@ -202,10 +201,10 @@ discard block |
||
| 202 | 201 | |
| 203 | 202 | $loopno=1; |
| 204 | 203 | $looprun=1; |
| 205 | - while (!feof($fd)){ |
|
| 204 | + while (!feof($fd)) { |
|
| 206 | 205 | $line = fgets($fd,4096); |
| 207 | - if(preg_match("/loopnumber\s+\d+/", $line, $matches)){ |
|
| 208 | - if(preg_match("/\d+/", $matches[0], $no)){ |
|
| 206 | + if(preg_match("/loopnumber\s+\d+/", $line, $matches)) { |
|
| 207 | + if(preg_match("/\d+/", $matches[0], $no)) { |
|
| 209 | 208 | //$loopno=$no[0]; |
| 210 | 209 | if($no[0]>$loopno)$loopno=$no[0]; |
| 211 | 210 | } |
@@ -215,7 +214,7 @@ discard block |
||
| 215 | 214 | } |
| 216 | 215 | } |
| 217 | 216 | fclose($fd); |
| 218 | - if($GLOBALS["debug"]){ |
|
| 217 | + if($GLOBALS["debug"]) { |
|
| 219 | 218 | print "max loopno(number of loops to run)=".$loopno."<br>"; |
| 220 | 219 | print "max looprun(steps for each loop)=".$looprun."<br>"; |
| 221 | 220 | } |
@@ -231,7 +230,7 @@ discard block |
||
| 231 | 230 | $app_fixed_size = 5e7; |
| 232 | 231 | $est_size = $log_size+$dump_size+$app_fixed_size; |
| 233 | 232 | |
| 234 | - if($GLOBALS["debug"]){ |
|
| 233 | + if($GLOBALS["debug"]) { |
|
| 235 | 234 | print "test_steps=".$test_steps."<br>"; |
| 236 | 235 | print "test_log_size=".$test_log_size."<br>"; |
| 237 | 236 | print "log_size1=".$log_size1."<br>"; |
@@ -367,7 +366,7 @@ discard block |
||
| 367 | 366 | $err="Your test job <strong>failed</strong> |
| 368 | 367 | <br>Please refer to the following Error Message:<br><p> |
| 369 | 368 | "; |
| 370 | - foreach($err_msgs as $line){ |
|
| 369 | + foreach($err_msgs as $line) { |
|
| 371 | 370 | $err=$err.$line."<br>"; |
| 372 | 371 | } |
| 373 | 372 | $err=$err." <p> |
@@ -380,9 +379,9 @@ discard block |
||
| 380 | 379 | $info->rsc_fpops_est = $est_cpu_time * 1.5e9; |
| 381 | 380 | $info->rsc_fpops_bound = $info->rsc_fpops_est * 20; |
| 382 | 381 | |
| 383 | - if ($disk==0){ |
|
| 382 | + if ($disk==0) { |
|
| 384 | 383 | $info->rsc_disk_bound=1000000; |
| 385 | - } else{ |
|
| 384 | + } else { |
|
| 386 | 385 | $info->rsc_disk_bound = $disk; |
| 387 | 386 | } |
| 388 | 387 | |
@@ -444,7 +443,7 @@ discard block |
||
| 444 | 443 | |
| 445 | 444 | $njobs=0; |
| 446 | 445 | $cmdlines = file($info->cmdline_file_path); |
| 447 | - foreach ($cmdlines as $cmdline){ |
|
| 446 | + foreach ($cmdlines as $cmdline) { |
|
| 448 | 447 | if (preg_match("/^\s*-var/", $cmdline)) { |
| 449 | 448 | $njobs++; |
| 450 | 449 | } |
@@ -460,7 +459,7 @@ discard block |
||
| 460 | 459 | |
| 461 | 460 | $i = 0; |
| 462 | 461 | foreach ($cmdlines as $cmdline) { |
| 463 | - if (preg_match("/^\s*-var/", $cmdline)){ |
|
| 462 | + if (preg_match("/^\s*-var/", $cmdline)) { |
|
| 464 | 463 | submit_job($app, $batch_id, $info, $cmdline, $i); |
| 465 | 464 | $i++; |
| 466 | 465 | } |
@@ -430,7 +430,7 @@ |
||
| 430 | 430 | //echo "<br> $cmd\n"; |
| 431 | 431 | |
| 432 | 432 | system($cmd, $ret); |
| 433 | - if ($ret === FALSE) { |
|
| 433 | + if ($ret === false) { |
|
| 434 | 434 | error_page("can't create job"); |
| 435 | 435 | } else { |
| 436 | 436 | header('Location: submit.php'); |
@@ -43,7 +43,7 @@ |
||
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | $url = sanitize_tags(get_str("url")); |
| 46 | -$type_name = sanitize_tags(get_str("type")); // textual |
|
| 46 | +$type_name = sanitize_tags(get_str("type")); // textual |
|
| 47 | 47 | $type = team_type_num($type_name); |
| 48 | 48 | $name_html = get_str("name_html"); |
| 49 | 49 | $description = get_str("description"); |
@@ -28,10 +28,10 @@ |
||
| 28 | 28 | |
| 29 | 29 | $border = get_str("border", true); |
| 30 | 30 | |
| 31 | -if ($border=="no") { |
|
| 31 | +if ($border == "no") { |
|
| 32 | 32 | $border = 0; |
| 33 | 33 | } else { |
| 34 | - $border=8; |
|
| 34 | + $border = 8; |
|
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | $credit = credit_string($user->total_credit, false); |