mirror of https://github.com/BOINC/boinc.git
- move client simulator PHP code to doc/sim
svn path=/trunk/boinc/; revision=23229
This commit is contained in:
parent
b11b56ecbb
commit
e858e7bcfa
|
@ -1580,3 +1580,9 @@ Rytis 12 Mar 2011
|
||||||
top_teams.php
|
top_teams.php
|
||||||
top_users.php
|
top_users.php
|
||||||
view_profile.php
|
view_profile.php
|
||||||
|
|
||||||
|
David 12 Mar 2001
|
||||||
|
- move client simulator PHP code to doc/sim
|
||||||
|
|
||||||
|
doc/sim/
|
||||||
|
various
|
||||||
|
|
|
@ -13,7 +13,7 @@ $cogsci = array(
|
||||||
array(
|
array(
|
||||||
array(
|
array(
|
||||||
"FreeHAL",
|
"FreeHAL",
|
||||||
"http://freehal.net/freehal_at_home/",
|
"http://www.freehal.net/freehal_at_home/",
|
||||||
"private",
|
"private",
|
||||||
"Artificial intelligence",
|
"Artificial intelligence",
|
||||||
"Parse and convert semantic nets for use in FreeHAL, an artificial intelligence that uses semantic networks, stemmers, part of speech databases, and part of speech taggers in order to imitate human behavior in conversations."
|
"Parse and convert semantic nets for use in FreeHAL, an artificial intelligence that uses semantic networks, stemmers, part of speech databases, and part of speech taggers in order to imitate human behavior in conversations."
|
||||||
|
@ -106,7 +106,7 @@ $biomed = array(
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
"SIMAP",
|
"SIMAP",
|
||||||
"http://www.boincsimap.org/boincsimap/",
|
"http://boincsimap.org/boincsimap/",
|
||||||
"University of Vienna",
|
"University of Vienna",
|
||||||
"Biology",
|
"Biology",
|
||||||
"Calculate similarities between proteins. SIMAP provides a public database of the resulting data, which plays a key role in many bioinformatics research projects.",
|
"Calculate similarities between proteins. SIMAP provides a public database of the resulting data, which plays a key role in many bioinformatics research projects.",
|
||||||
|
|
114
doc/sim.php
114
doc/sim.php
|
@ -1,114 +0,0 @@
|
||||||
<?php
|
|
||||||
// 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/>.
|
|
||||||
|
|
||||||
// web interface to client simulator
|
|
||||||
|
|
||||||
require_once("../inc/util.inc");
|
|
||||||
|
|
||||||
function show_scenario_summary($f) {
|
|
||||||
echo "<a href=sim.php?action=show_scenario&name=$f>$f</a>";
|
|
||||||
readfile("scenarios/$f/description");
|
|
||||||
readfile("scenarios/$f/user_name");
|
|
||||||
show # sims
|
|
||||||
}
|
|
||||||
|
|
||||||
// show existing scenarios, "create scenario" button
|
|
||||||
//
|
|
||||||
function show_scenarios() {
|
|
||||||
page_head("Client simulator");
|
|
||||||
$d = open_dir("scenarios");
|
|
||||||
while ($f = readdir($d)) {
|
|
||||||
if ($f == ".") continue;
|
|
||||||
if ($f == "..") continue;
|
|
||||||
show_scenario_summary($f);
|
|
||||||
}
|
|
||||||
echo "<a href=sim.php?action=create_scenario>Create new scenario</a>";
|
|
||||||
page_tail();
|
|
||||||
}
|
|
||||||
|
|
||||||
// show form for creating a scenario
|
|
||||||
//
|
|
||||||
function create_scenario_form() {
|
|
||||||
get_logged_in_user();
|
|
||||||
page_head("Create scenario");
|
|
||||||
echo "<form action=sim.php?action=create_scenario>
|
|
||||||
<input name=client_state type=file>
|
|
||||||
<p><input name=prefs type=file>
|
|
||||||
<p><input name=prefs_override type=file>
|
|
||||||
<p><input name=cc_config type=file>
|
|
||||||
<p>Description: <input name=description type=textarea>
|
|
||||||
<p><input type=submit value=OK>
|
|
||||||
</form>
|
|
||||||
";
|
|
||||||
page_tail();
|
|
||||||
}
|
|
||||||
|
|
||||||
function create_scenario() {
|
|
||||||
get_logged_in_user();
|
|
||||||
if (!is_uploaded_file($_FILES['client_state']['tmp_name'])) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// redirect to show_scenario
|
|
||||||
}
|
|
||||||
|
|
||||||
function show_scenario() {
|
|
||||||
page_head();
|
|
||||||
page_tail();
|
|
||||||
}
|
|
||||||
|
|
||||||
function simulation_form() {
|
|
||||||
page_head();
|
|
||||||
page_tail();
|
|
||||||
}
|
|
||||||
|
|
||||||
function simulation_action() {
|
|
||||||
//redirect to show_simulation
|
|
||||||
}
|
|
||||||
|
|
||||||
function show_simulation() {
|
|
||||||
page_head();
|
|
||||||
page_tail();
|
|
||||||
}
|
|
||||||
|
|
||||||
$action = get_str("action", true);
|
|
||||||
|
|
||||||
switch ($action) {
|
|
||||||
case "create_scenario_form":
|
|
||||||
create_scenario_form();
|
|
||||||
break;
|
|
||||||
case "create_scenario":
|
|
||||||
create_scenario();
|
|
||||||
break;
|
|
||||||
case "show_scenario":
|
|
||||||
show_scenario();
|
|
||||||
break;
|
|
||||||
case "simulation_form":
|
|
||||||
simulation_form();
|
|
||||||
break;
|
|
||||||
case "simulation_action":
|
|
||||||
simulation_action();
|
|
||||||
break;
|
|
||||||
case "show_simulation":
|
|
||||||
show_simulation();
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
show_scenarios();
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
|
|
@ -0,0 +1,183 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
// multi-purpose script to do BOINC client simulations and graph the results
|
||||||
|
//
|
||||||
|
// terms:
|
||||||
|
// "policy" - a combination of scheduling policies (see POLICY below)
|
||||||
|
// "scenario" - a combination of host characteristics,
|
||||||
|
// project characteristics, and preferences,
|
||||||
|
// described by a set of files (client_state.xml etc.).
|
||||||
|
// A scenario can have a parameter,
|
||||||
|
// macro-subsituted into client_state_template.xml
|
||||||
|
// "result" - the vector of figures of merit (see RESULT below)
|
||||||
|
// resulting from a simulation
|
||||||
|
//
|
||||||
|
// The script provides 2 functions:
|
||||||
|
//
|
||||||
|
// compare_policies()
|
||||||
|
// Compare 2 policies over a set of scenarios.
|
||||||
|
// Show the average results as side-by-side bar graphs
|
||||||
|
//
|
||||||
|
// compare_scenario_params()
|
||||||
|
// For a given policy and a set of parameterized scenarios,
|
||||||
|
// show the average results as a function of the parameter.
|
||||||
|
// Show the figures of merit as line graphs.
|
||||||
|
|
||||||
|
require_once("sim_util.inc");
|
||||||
|
|
||||||
|
// Compare 2 policies for a set of scenarios, and show the average results.
|
||||||
|
// Outputs are stored in the given directory.
|
||||||
|
// Subdirectories policy_scenario/ store individual sim outputs.
|
||||||
|
//
|
||||||
|
function compare_policies($title, $set, $p1, $p2, $out_dir) {
|
||||||
|
$sum1 = new RESULT($p1->name);
|
||||||
|
$sum2 = new RESULT($p2->name);
|
||||||
|
@mkdir($out_dir);
|
||||||
|
foreach ($set as $s) {
|
||||||
|
$sum1 = do_sim_aux($out_dir, $s, $p1, "p1", $sum1);
|
||||||
|
$sum2 = do_sim_aux($out_dir, $s, $p2, "p2", $sum2);
|
||||||
|
}
|
||||||
|
$sum1->scale(count($set));
|
||||||
|
$sum2->scale(count($set));
|
||||||
|
graph_2_results($title, $out_dir, $sum1, $sum2);
|
||||||
|
}
|
||||||
|
|
||||||
|
// For a given policy and a set of parameterized scenarios,
|
||||||
|
// show the average results as a function of the parameter.
|
||||||
|
// Outputs are stored in the given directory.
|
||||||
|
// Subdirectories scenario_arg/ store individual sim outputs
|
||||||
|
//
|
||||||
|
function compare_scenario_params1($title, $set, $policy, $lo, $hi, $inc, $out_dir) {
|
||||||
|
@mkdir($out_dir);
|
||||||
|
$results = array();
|
||||||
|
for ($x = $lo; $x <= $hi; $x += $inc) {
|
||||||
|
$sum = new RESULT($x);
|
||||||
|
foreach ($set as $s) {
|
||||||
|
$sum = do_sim_scenario_param($out_dir, $s, $policy, $x, $sum);
|
||||||
|
}
|
||||||
|
$results[] = $sum;
|
||||||
|
}
|
||||||
|
graph_n_results1($title, $out_dir, $results);
|
||||||
|
}
|
||||||
|
|
||||||
|
// same, but compare 2 policies and graph only wasted CPU
|
||||||
|
//
|
||||||
|
function compare_scenario_params2($title, $xlabel, $lab1, $lab2, $set, $p1, $p2, $lo, $hi, $inc, $out_dir) {
|
||||||
|
@mkdir($out_dir);
|
||||||
|
$rr1 = array();
|
||||||
|
$rr2 = array();
|
||||||
|
for ($x = $lo; $x <= $hi; $x += $inc) {
|
||||||
|
$sum = new RESULT($x);
|
||||||
|
foreach ($set as $s) {
|
||||||
|
$sum = do_sim_scenario_param($out_dir, $s, $p1, $x, $sum);
|
||||||
|
}
|
||||||
|
$rr1[] = $sum;
|
||||||
|
$sum = new RESULT($x);
|
||||||
|
foreach ($set as $s) {
|
||||||
|
$sum = do_sim_scenario_param($out_dir, $s, $p2, $x, $sum);
|
||||||
|
}
|
||||||
|
$rr2[] = $sum;
|
||||||
|
}
|
||||||
|
graph_n_results2($title, $xlabel, $lab1, $lab2, $out_dir, $rr1, $rr2, 3);
|
||||||
|
}
|
||||||
|
|
||||||
|
// compare two policies, varying rec_half_life
|
||||||
|
//
|
||||||
|
function compare_policy_params($title, $xlabel, $lab1, $lab2, $set, $p1, $p2, $lo, $hi, $inc, $out_dir) {
|
||||||
|
global $rec_half_life;
|
||||||
|
|
||||||
|
@mkdir($out_dir);
|
||||||
|
$rr1 = array();
|
||||||
|
$rr2 = array();
|
||||||
|
for ($x = $lo; $x <= $hi; $x += $inc) {
|
||||||
|
$rec_half_life = $x;
|
||||||
|
$sum = new RESULT($x);
|
||||||
|
foreach ($set as $s) {
|
||||||
|
$sum1 = do_sim_policy_param($out_dir, $s, $p1, $x, $sum);
|
||||||
|
}
|
||||||
|
$rr1[] = $sum;
|
||||||
|
$sum = new RESULT($x);
|
||||||
|
foreach ($set as $s) {
|
||||||
|
$sum1 = do_sim_policy_param($out_dir, $s, $p2, $x, $sum);
|
||||||
|
}
|
||||||
|
$rr2[] = $sum;
|
||||||
|
}
|
||||||
|
graph_n_results2($title, $xlabel, $lab1, $lab2, $out_dir, $rr1, $rr2, 7);
|
||||||
|
}
|
||||||
|
|
||||||
|
///////////// EXAMPLE USAGES ////////////
|
||||||
|
|
||||||
|
// compare REC and debt scheduling for a set of scenarios
|
||||||
|
//
|
||||||
|
if (0) {
|
||||||
|
$p1 = new POLICY("JS_LOCAL");
|
||||||
|
$p2 = new POLICY("JS_GLOBAL");
|
||||||
|
$p2->use_rec = true;
|
||||||
|
compare_policies("Scenario 2", array("scen2"), $p1, $p2, "test1");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (0) {
|
||||||
|
$p = new POLICY("");
|
||||||
|
$p->use_rec = true;
|
||||||
|
$lo = 2e9;
|
||||||
|
$hi = 1e10;
|
||||||
|
$inc = 1e9;
|
||||||
|
compare_scenario_params1("Scenario 3", array("s3"), $p, $lo, $hi, $inc, "test2");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (1) {
|
||||||
|
$p1 = new POLICY("WF_ORIG");
|
||||||
|
$p2 = new POLICY("WF_HYST");
|
||||||
|
$p2->use_hyst_fetch = true;
|
||||||
|
compare_policies("Scenario 4", array("scen4"), $p1, $p2, "test3");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (0) {
|
||||||
|
$p1 = new POLICY("JS_LOCAL");
|
||||||
|
$p2 = new POLICY("JS_GLOBAL");
|
||||||
|
$p2->use_rec = true;
|
||||||
|
compare_policies("Scenario 4", array("scen4"), $p1, $p2, "test4");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (0) {
|
||||||
|
$duration = 50* 86400;
|
||||||
|
$p1 = new POLICY("JS_LOCAL");
|
||||||
|
$p2 = new POLICY("JS_GLOBAL");
|
||||||
|
$p2->use_rec = true;
|
||||||
|
compare_policies("Scenario 3", array("scen3"), $p1, $p2, "test5");
|
||||||
|
}
|
||||||
|
|
||||||
|
// compare WRR and EDF
|
||||||
|
if (0) {
|
||||||
|
$p1 = new POLICY("JS_LOCAL");
|
||||||
|
$p1->use_rec = true;
|
||||||
|
$p1->use_hyst_fetch = true;
|
||||||
|
$p1->cpu_sched_rr_only = true;
|
||||||
|
$p2 = new POLICY("JS_WRR");
|
||||||
|
$p2->use_rec = true;
|
||||||
|
$p2->use_hyst_fetch = true;
|
||||||
|
$lo = 1000;
|
||||||
|
$hi = 2000;
|
||||||
|
$inc = 100;
|
||||||
|
compare_scenario_params2("Wasted processing", "Latency bound", "JS_WRR", "JS_LOCAL", array("scen5"), $p1, $p2, $lo, $hi, $inc, "test6");
|
||||||
|
}
|
||||||
|
|
||||||
|
// compare rec and debt over a range of rec_half_life
|
||||||
|
if (0) {
|
||||||
|
$p1 = new POLICY("JS_LOCAL");
|
||||||
|
$p2 = new POLICY("JS_GLOBAL");
|
||||||
|
$p2->use_rec = true;
|
||||||
|
$lo = 5*86400;
|
||||||
|
$hi = 40*86400;
|
||||||
|
$inc = 5*86400;
|
||||||
|
$duration = 50* 86400;
|
||||||
|
compare_policy_params("Resource share violation", "REC half-life", "JS_LOCAL", "JS_GLOBAL", array("scen3"), $p1, $p2, $lo, $hi, $inc, "test7");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (0) {
|
||||||
|
$p1 = new POLICY("JS_LOCAL + WF_ORIG");
|
||||||
|
$p2 = new POLICY("JS_GLOBAL + WF_HYSTERESIS");
|
||||||
|
$p2->use_rec = true;
|
||||||
|
compare_policies("Scenario 4", array("scen4"), $p1, $p2, "test8");
|
||||||
|
}
|
||||||
|
?>
|
|
@ -1,28 +1,3 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
// multi-purpose script to do BOINC client simulations and graph the results
|
|
||||||
//
|
|
||||||
// terms:
|
|
||||||
// "policy" - a combination of scheduling policies (see POLICY below)
|
|
||||||
// "scenario" - a combination of host characteristics,
|
|
||||||
// project characteristics, and preferences,
|
|
||||||
// described by a set of files (client_state.xml etc.).
|
|
||||||
// A scenario can have a parameter,
|
|
||||||
// macro-subsituted into client_state_template.xml
|
|
||||||
// "result" - the vector of figures of merit (see RESULT below)
|
|
||||||
// resulting from a simulation
|
|
||||||
//
|
|
||||||
// The script provides 2 functions:
|
|
||||||
//
|
|
||||||
// compare_policies()
|
|
||||||
// Compare 2 policies over a set of scenarios.
|
|
||||||
// Show the average results as side-by-side bar graphs
|
|
||||||
//
|
|
||||||
// compare_scenario_params()
|
|
||||||
// For a given policy and a set of parameterized scenarios,
|
|
||||||
// show the average results as a function of the parameter.
|
|
||||||
// Show the figures of merit as line graphs.
|
|
||||||
|
|
||||||
$duration = 864000; // sim duration
|
$duration = 864000; // sim duration
|
||||||
$delta = 60; // time step
|
$delta = 60; // time step
|
||||||
$rec_half_life = 10*86400;
|
$rec_half_life = 10*86400;
|
||||||
|
@ -261,161 +236,3 @@ function do_sim_policy_param($out_dir, $scenario, $policy, $param, $sum) {
|
||||||
return $sum;
|
return $sum;
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////// THE TOP-LEVEL FUNCTIONS ////////////
|
|
||||||
|
|
||||||
// Compare 2 policies for a set of scenarios, and show the average results.
|
|
||||||
// Outputs are stored in the given directory.
|
|
||||||
// Subdirectories policy_scenario/ store individual sim outputs.
|
|
||||||
//
|
|
||||||
function compare_policies($title, $set, $p1, $p2, $out_dir) {
|
|
||||||
$sum1 = new RESULT($p1->name);
|
|
||||||
$sum2 = new RESULT($p2->name);
|
|
||||||
@mkdir($out_dir);
|
|
||||||
foreach ($set as $s) {
|
|
||||||
$sum1 = do_sim_aux($out_dir, $s, $p1, "p1", $sum1);
|
|
||||||
$sum2 = do_sim_aux($out_dir, $s, $p2, "p2", $sum2);
|
|
||||||
}
|
|
||||||
$sum1->scale(count($set));
|
|
||||||
$sum2->scale(count($set));
|
|
||||||
graph_2_results($title, $out_dir, $sum1, $sum2);
|
|
||||||
}
|
|
||||||
|
|
||||||
// For a given policy and a set of parameterized scenarios,
|
|
||||||
// show the average results as a function of the parameter.
|
|
||||||
// Outputs are stored in the given directory.
|
|
||||||
// Subdirectories scenario_arg/ store individual sim outputs
|
|
||||||
//
|
|
||||||
function compare_scenario_params1($title, $set, $policy, $lo, $hi, $inc, $out_dir) {
|
|
||||||
@mkdir($out_dir);
|
|
||||||
$results = array();
|
|
||||||
for ($x = $lo; $x <= $hi; $x += $inc) {
|
|
||||||
$sum = new RESULT($x);
|
|
||||||
foreach ($set as $s) {
|
|
||||||
$sum = do_sim_scenario_param($out_dir, $s, $policy, $x, $sum);
|
|
||||||
}
|
|
||||||
$results[] = $sum;
|
|
||||||
}
|
|
||||||
graph_n_results1($title, $out_dir, $results);
|
|
||||||
}
|
|
||||||
|
|
||||||
// same, but compare 2 policies and graph only wasted CPU
|
|
||||||
//
|
|
||||||
function compare_scenario_params2($title, $xlabel, $lab1, $lab2, $set, $p1, $p2, $lo, $hi, $inc, $out_dir) {
|
|
||||||
@mkdir($out_dir);
|
|
||||||
$rr1 = array();
|
|
||||||
$rr2 = array();
|
|
||||||
for ($x = $lo; $x <= $hi; $x += $inc) {
|
|
||||||
$sum = new RESULT($x);
|
|
||||||
foreach ($set as $s) {
|
|
||||||
$sum = do_sim_scenario_param($out_dir, $s, $p1, $x, $sum);
|
|
||||||
}
|
|
||||||
$rr1[] = $sum;
|
|
||||||
$sum = new RESULT($x);
|
|
||||||
foreach ($set as $s) {
|
|
||||||
$sum = do_sim_scenario_param($out_dir, $s, $p2, $x, $sum);
|
|
||||||
}
|
|
||||||
$rr2[] = $sum;
|
|
||||||
}
|
|
||||||
graph_n_results2($title, $xlabel, $lab1, $lab2, $out_dir, $rr1, $rr2, 3);
|
|
||||||
}
|
|
||||||
|
|
||||||
// compare two policies, varying rec_half_life
|
|
||||||
//
|
|
||||||
function compare_policy_params($title, $xlabel, $lab1, $lab2, $set, $p1, $p2, $lo, $hi, $inc, $out_dir) {
|
|
||||||
global $rec_half_life;
|
|
||||||
|
|
||||||
@mkdir($out_dir);
|
|
||||||
$rr1 = array();
|
|
||||||
$rr2 = array();
|
|
||||||
for ($x = $lo; $x <= $hi; $x += $inc) {
|
|
||||||
$rec_half_life = $x;
|
|
||||||
$sum = new RESULT($x);
|
|
||||||
foreach ($set as $s) {
|
|
||||||
$sum1 = do_sim_policy_param($out_dir, $s, $p1, $x, $sum);
|
|
||||||
}
|
|
||||||
$rr1[] = $sum;
|
|
||||||
$sum = new RESULT($x);
|
|
||||||
foreach ($set as $s) {
|
|
||||||
$sum1 = do_sim_policy_param($out_dir, $s, $p2, $x, $sum);
|
|
||||||
}
|
|
||||||
$rr2[] = $sum;
|
|
||||||
}
|
|
||||||
graph_n_results2($title, $xlabel, $lab1, $lab2, $out_dir, $rr1, $rr2, 7);
|
|
||||||
}
|
|
||||||
|
|
||||||
///////////// EXAMPLE USAGES ////////////
|
|
||||||
|
|
||||||
// compare REC and debt scheduling for a set of scenarios
|
|
||||||
//
|
|
||||||
if (0) {
|
|
||||||
$p1 = new POLICY("JS_LOCAL");
|
|
||||||
$p2 = new POLICY("JS_GLOBAL");
|
|
||||||
$p2->use_rec = true;
|
|
||||||
compare_policies("Scenario 2", array("scen2"), $p1, $p2, "test1");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (0) {
|
|
||||||
$p = new POLICY("");
|
|
||||||
$p->use_rec = true;
|
|
||||||
$lo = 2e9;
|
|
||||||
$hi = 1e10;
|
|
||||||
$inc = 1e9;
|
|
||||||
compare_scenario_params1("Scenario 3", array("s3"), $p, $lo, $hi, $inc, "test2");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (1) {
|
|
||||||
$p1 = new POLICY("WF_ORIG");
|
|
||||||
$p2 = new POLICY("WF_HYST");
|
|
||||||
$p2->use_hyst_fetch = true;
|
|
||||||
compare_policies("Scenario 4", array("scen4"), $p1, $p2, "test3");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (0) {
|
|
||||||
$p1 = new POLICY("JS_LOCAL");
|
|
||||||
$p2 = new POLICY("JS_GLOBAL");
|
|
||||||
$p2->use_rec = true;
|
|
||||||
compare_policies("Scenario 4", array("scen4"), $p1, $p2, "test4");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (0) {
|
|
||||||
$duration = 50* 86400;
|
|
||||||
$p1 = new POLICY("JS_LOCAL");
|
|
||||||
$p2 = new POLICY("JS_GLOBAL");
|
|
||||||
$p2->use_rec = true;
|
|
||||||
compare_policies("Scenario 3", array("scen3"), $p1, $p2, "test5");
|
|
||||||
}
|
|
||||||
|
|
||||||
// compare WRR and EDF
|
|
||||||
if (0) {
|
|
||||||
$p1 = new POLICY("JS_LOCAL");
|
|
||||||
$p1->use_rec = true;
|
|
||||||
$p1->use_hyst_fetch = true;
|
|
||||||
$p1->cpu_sched_rr_only = true;
|
|
||||||
$p2 = new POLICY("JS_WRR");
|
|
||||||
$p2->use_rec = true;
|
|
||||||
$p2->use_hyst_fetch = true;
|
|
||||||
$lo = 1000;
|
|
||||||
$hi = 2000;
|
|
||||||
$inc = 100;
|
|
||||||
compare_scenario_params2("Wasted processing", "Latency bound", "JS_WRR", "JS_LOCAL", array("scen5"), $p1, $p2, $lo, $hi, $inc, "test6");
|
|
||||||
}
|
|
||||||
|
|
||||||
// compare rec and debt over a range of rec_half_life
|
|
||||||
if (0) {
|
|
||||||
$p1 = new POLICY("JS_LOCAL");
|
|
||||||
$p2 = new POLICY("JS_GLOBAL");
|
|
||||||
$p2->use_rec = true;
|
|
||||||
$lo = 5*86400;
|
|
||||||
$hi = 40*86400;
|
|
||||||
$inc = 5*86400;
|
|
||||||
$duration = 50* 86400;
|
|
||||||
compare_policy_params("Resource share violation", "REC half-life", "JS_LOCAL", "JS_GLOBAL", array("scen3"), $p1, $p2, $lo, $hi, $inc, "test7");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (0) {
|
|
||||||
$p1 = new POLICY("JS_LOCAL + WF_ORIG");
|
|
||||||
$p2 = new POLICY("JS_GLOBAL + WF_HYSTERESIS");
|
|
||||||
$p2->use_rec = true;
|
|
||||||
compare_policies("Scenario 4", array("scen4"), $p1, $p2, "test8");
|
|
||||||
}
|
|
||||||
?>
|
|
|
@ -0,0 +1,274 @@
|
||||||
|
<?php
|
||||||
|
// 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/>.
|
||||||
|
|
||||||
|
// web interface to client simulator
|
||||||
|
|
||||||
|
require_once("../inc/util.inc");
|
||||||
|
|
||||||
|
function show_scenario_summary($f) {
|
||||||
|
echo "<a href=sim.php?action=show_scenario&name=$f>$f</a>";
|
||||||
|
readfile("scenarios/$f/description");
|
||||||
|
readfile("scenarios/$f/user_name");
|
||||||
|
}
|
||||||
|
|
||||||
|
// show existing scenarios, "create scenario" button
|
||||||
|
//
|
||||||
|
function show_scenarios() {
|
||||||
|
page_head("The BOINC Client Emulator");
|
||||||
|
echo "
|
||||||
|
Welcome to the BOINC Client Emulator (BCE).
|
||||||
|
BCE <b>emulates</b> a BOINC client attached to one or more projects.
|
||||||
|
It predicts, in a few seconds, what the BOINC client will do
|
||||||
|
over a period of day or months.
|
||||||
|
This allows BOINC developers to fix bugs and improve performance.
|
||||||
|
<p>
|
||||||
|
The inputs to BCE, called <b>scenarios</b>,
|
||||||
|
describe a particular computer and the project to which it's attached.
|
||||||
|
A scenario consists of 4 files:
|
||||||
|
<ul>
|
||||||
|
<li> <b>client_state.xml</b>: describes the host and projects.
|
||||||
|
<li> <b>global_prefs.xml</b> and <b>global_prefs_override.xml</b>:
|
||||||
|
computing preferences (optional).
|
||||||
|
<li> <b>cc_config.xml</b>: client configuration (optional).
|
||||||
|
</ul>
|
||||||
|
You can use the files from a running BOINC client
|
||||||
|
to emulate that client.
|
||||||
|
You can modify these files, or create new ones, to study hypothetical hosts
|
||||||
|
(e.g. ones with a large number of CPUs,
|
||||||
|
attached to a large number of projects, and so on).
|
||||||
|
See <a href=http://boinc.berkeley.edu/trac/wiki/ClientSim>The
|
||||||
|
BCE documentation</a> for details.
|
||||||
|
<p>
|
||||||
|
You create a scenario by uploading these files to the BOINC server.
|
||||||
|
Then you can run any number of <b>simulations</b> based on the scenario.
|
||||||
|
The parameters of a simulation include
|
||||||
|
<ul>
|
||||||
|
<li> The duration and time resolution of the simulation.
|
||||||
|
<li> Choices for various client policy alternatives.
|
||||||
|
<li> The client version.
|
||||||
|
</ul>
|
||||||
|
The outputs of a simulation include
|
||||||
|
<ul>
|
||||||
|
<li> A graphical 'time line' showing CPU and GPU usage.
|
||||||
|
<li> The client's message log
|
||||||
|
<li> graphs of scheduling-related data (debt, REC).
|
||||||
|
<li> A summary of several 'figures of merit',
|
||||||
|
including idle and wasted processing fraction,
|
||||||
|
resource share violation, and monotony.
|
||||||
|
</ul>
|
||||||
|
<p>
|
||||||
|
<a href=sim.php?action=create_scenario_form>Create a scenario</a>
|
||||||
|
<hr>
|
||||||
|
<h3>Existing scenarios</h3>
|
||||||
|
";
|
||||||
|
$d = opendir("scenarios");
|
||||||
|
while ($f = readdir($d)) {
|
||||||
|
if ($f == ".") continue;
|
||||||
|
if ($f == "..") continue;
|
||||||
|
show_scenario_summary($f);
|
||||||
|
}
|
||||||
|
page_tail();
|
||||||
|
}
|
||||||
|
|
||||||
|
// show form for creating a scenario
|
||||||
|
//
|
||||||
|
function create_scenario_form() {
|
||||||
|
get_logged_in_user();
|
||||||
|
page_head("Create a scenario");
|
||||||
|
echo "
|
||||||
|
To create a scenario:
|
||||||
|
choose the input files,
|
||||||
|
enter a short description, and click OK
|
||||||
|
(items with * are required).
|
||||||
|
<form action=sim.php method=post enctype=\"multipart/form-data\">
|
||||||
|
<input type=hidden name=action value=create_scenario>
|
||||||
|
<table>
|
||||||
|
";
|
||||||
|
row2("* client_state.xml", "<input name=client_state type=file>");
|
||||||
|
row2("global_prefs.xml", "<input name=prefs type=file>");
|
||||||
|
row2("global_prefs_override.xml", "<input name=prefs_override type=file>");
|
||||||
|
row2("cc_config.xml", "<input name=cc_config type=file>");
|
||||||
|
row2("* Description", "<textarea name=description cols=40></textarea>");
|
||||||
|
row2("", "<input type=submit value=OK>");
|
||||||
|
echo "
|
||||||
|
</table>
|
||||||
|
</form>
|
||||||
|
";
|
||||||
|
page_tail();
|
||||||
|
}
|
||||||
|
|
||||||
|
// create a subdir $dir/N for the first available N
|
||||||
|
//
|
||||||
|
function create_dir_seqno($dir) {
|
||||||
|
$i = -1;
|
||||||
|
$d = opendir($dir);
|
||||||
|
while ($f = readdir($d)) {
|
||||||
|
$j = -1;
|
||||||
|
$n = sscanf($f, "%d", $j);
|
||||||
|
if ($n == 1 && $j >= 0) {
|
||||||
|
if ($j > $i) {
|
||||||
|
$i = $j;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$i++;
|
||||||
|
$p = "$dir/$i";
|
||||||
|
mkdir($p);
|
||||||
|
return "$i";
|
||||||
|
}
|
||||||
|
|
||||||
|
// choose scenario name
|
||||||
|
// create dir, put files there
|
||||||
|
// create meta-data file
|
||||||
|
// redirect to show scenario
|
||||||
|
//
|
||||||
|
function create_scenario() {
|
||||||
|
$user = get_logged_in_user();
|
||||||
|
$csname = $_FILES['client_state']['tmp_name'];
|
||||||
|
if (!is_uploaded_file($csname)) {
|
||||||
|
error_page("You must specify a client_state.xml file.");
|
||||||
|
}
|
||||||
|
$desc = post_str("description", true);
|
||||||
|
if (!strlen($desc)) {
|
||||||
|
error_page("You must supply a description.");
|
||||||
|
}
|
||||||
|
$sname = create_dir_seqno("scenarios");
|
||||||
|
$d = "scenarios/$sname";
|
||||||
|
move_uploaded_file($csname, "$d/client_state.xml");
|
||||||
|
$gp = $_FILES['global_prefs']['tmp_name'];
|
||||||
|
if (is_uploaded_file($gp)) {
|
||||||
|
move_uploaded_file($gp, "$d/global_prefs.xml");
|
||||||
|
}
|
||||||
|
$gpo = $_FILES['global_prefs_override']['tmp_name'];
|
||||||
|
if (is_uploaded_file($gpo)) {
|
||||||
|
move_uploaded_file($gpo, "$d/global_prefs_override.xml");
|
||||||
|
}
|
||||||
|
$cc = $_FILES['cc_config']['tmp_name'];
|
||||||
|
if (is_uploaded_file($cc)) {
|
||||||
|
move_uploaded_file($cc, "$d/cc_config.xml");
|
||||||
|
}
|
||||||
|
file_put_contents("$d/userid", "$user->id");
|
||||||
|
file_put_contents("$d/description", $desc);
|
||||||
|
mkdir("$d/simulations");
|
||||||
|
header("Location: sim.php?action=show_scenario&name=$sname");
|
||||||
|
}
|
||||||
|
|
||||||
|
// show:
|
||||||
|
// links to files
|
||||||
|
// list of existing simulations
|
||||||
|
// link for new simulation
|
||||||
|
//
|
||||||
|
function show_scenario() {
|
||||||
|
$name = get_str("name");
|
||||||
|
$d = "scenarios/$name";
|
||||||
|
if (!is_dir($d)) {
|
||||||
|
error_page("No such scenario");
|
||||||
|
}
|
||||||
|
page_head("Scenario $name");
|
||||||
|
echo "Input files:
|
||||||
|
<p>
|
||||||
|
<a href=$d/client_state.xml>client_state.xml</a>
|
||||||
|
";
|
||||||
|
if (file_exists("$d/global_prefs.xml")) {
|
||||||
|
echo "<p><a href=$d/global_prefs.xml>global_prefs.xml</a>\n";
|
||||||
|
}
|
||||||
|
if (file_exists("$d/global_prefs_override.xml")) {
|
||||||
|
echo "<p><a href=$d/global_prefs_override.xml>global_prefs_override.xml</a>\n";
|
||||||
|
}
|
||||||
|
if (file_exists("$d/cc_config.xml")) {
|
||||||
|
echo "<p><a href=$d/cc_config.xml>cc_config.xml</a>\n";
|
||||||
|
}
|
||||||
|
echo "<a href=sim.php?action=simulation_form&scen=$name>Do new simulation</a>\n";
|
||||||
|
echo "<hr>Simulations";
|
||||||
|
$s = opendir("$d/simulations");
|
||||||
|
while ($f = readdir($d)) {
|
||||||
|
if (!is_numeric($f)) continue;
|
||||||
|
echo "<p><a href=sim.php?action=show_simulation&scen=$name&sim=$f>$f</a>\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
page_tail();
|
||||||
|
}
|
||||||
|
|
||||||
|
// form for simulation parameters:
|
||||||
|
// duration, time step, policy options
|
||||||
|
//
|
||||||
|
function simulation_form() {
|
||||||
|
$scen = get_str("name");
|
||||||
|
page_head("Do simulation");
|
||||||
|
echo "<form action=sim.php?action=simulation_action&name=$name>
|
||||||
|
<table>
|
||||||
|
";
|
||||||
|
row2("Duration", "<input name=duration> seconds");
|
||||||
|
row2("Time step", "<input name=delta> seconds");
|
||||||
|
row2("Recent Estimated Credit", "<input type=checkbox name=rec>");
|
||||||
|
row2("Server EDF simulation?", "<input type=checkbox name=server_edf>");
|
||||||
|
row2("Client uses pure RR?", "<input type=checkbox name=rr_only>");
|
||||||
|
row2("", "<input type=submit value=OK>");
|
||||||
|
echo "</table>";
|
||||||
|
page_tail();
|
||||||
|
}
|
||||||
|
|
||||||
|
// create directory for simulation,
|
||||||
|
// run simulation,
|
||||||
|
// redirect to simulation page
|
||||||
|
//
|
||||||
|
function simulation_action() {
|
||||||
|
$scen = get_str("name");
|
||||||
|
if (!is_dir("scenarios/$scen")) {
|
||||||
|
error_page("no such scenario");
|
||||||
|
}
|
||||||
|
$sim = create_dir_seqno("scenarios/$scen/sims");
|
||||||
|
$c
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// show links to files in simulation directory
|
||||||
|
//
|
||||||
|
function show_simulation() {
|
||||||
|
page_head();
|
||||||
|
page_tail();
|
||||||
|
}
|
||||||
|
|
||||||
|
$action = get_str("action", true);
|
||||||
|
if (!$action) $action = post_str("action", true);
|
||||||
|
|
||||||
|
switch ($action) {
|
||||||
|
case "create_scenario_form":
|
||||||
|
create_scenario_form();
|
||||||
|
break;
|
||||||
|
case "create_scenario":
|
||||||
|
create_scenario();
|
||||||
|
break;
|
||||||
|
case "show_scenario":
|
||||||
|
show_scenario();
|
||||||
|
break;
|
||||||
|
case "simulation_form":
|
||||||
|
simulation_form();
|
||||||
|
break;
|
||||||
|
case "simulation_action":
|
||||||
|
simulation_action();
|
||||||
|
break;
|
||||||
|
case "show_simulation":
|
||||||
|
show_simulation();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
show_scenarios();
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
Loading…
Reference in New Issue