mirror of https://github.com/BOINC/boinc.git
- make the Manager build on FC11
- simulator work svn path=/trunk/boinc/; revision=22906
This commit is contained in:
parent
6a1c7cf4ac
commit
e97c64b92f
|
@ -152,3 +152,15 @@ Bernd 14 Jan 2011
|
||||||
so these could be used in proprocessor directives
|
so these could be used in proprocessor directives
|
||||||
|
|
||||||
generate_svn_version.sh
|
generate_svn_version.sh
|
||||||
|
|
||||||
|
David 14 Jan 2011
|
||||||
|
- make the Manager build on FC11
|
||||||
|
- simulator work
|
||||||
|
|
||||||
|
clientgui/
|
||||||
|
Makefile.am
|
||||||
|
sched/
|
||||||
|
edf_sim.cpp
|
||||||
|
client/
|
||||||
|
sim.cpp
|
||||||
|
sim_control.php
|
||||||
|
|
|
@ -248,12 +248,17 @@ void CLIENT_STATE::handle_completed_results(PROJECT* p) {
|
||||||
while (result_iter != results.end()) {
|
while (result_iter != results.end()) {
|
||||||
RESULT* rp = *result_iter;
|
RESULT* rp = *result_iter;
|
||||||
if (rp->project == p && rp->ready_to_report) {
|
if (rp->project == p && rp->ready_to_report) {
|
||||||
sprintf(buf, "result %s reported; %s<br>",
|
if (gstate.now > rp->report_deadline) {
|
||||||
rp->name,
|
sprintf(buf, "result %s reported; "
|
||||||
(gstate.now > rp->report_deadline)?
|
"<font color=#cc0000>MISSED DEADLINE by %f</font><br>\n",
|
||||||
"<font color=#cc0000>MISSED DEADLINE</font>":
|
rp->name, gstate.now - rp->report_deadline
|
||||||
"<font color=#00cc00>MADE DEADLINE</font>"
|
);
|
||||||
);
|
} else {
|
||||||
|
sprintf(buf, "result %s reported; "
|
||||||
|
"<font color=#00cc00>MADE DEADLINE</font><br>\n",
|
||||||
|
rp->name
|
||||||
|
);
|
||||||
|
}
|
||||||
PROJECT* spp = rp->project;
|
PROJECT* spp = rp->project;
|
||||||
if (gstate.now > rp->report_deadline) {
|
if (gstate.now > rp->report_deadline) {
|
||||||
sim_results.flops_wasted += rp->peak_flop_count;
|
sim_results.flops_wasted += rp->peak_flop_count;
|
||||||
|
@ -281,7 +286,7 @@ void CLIENT_STATE::get_workload(vector<IP_RESULT>& ip_results) {
|
||||||
RESULT* rp = results[i];
|
RESULT* rp = results[i];
|
||||||
double x = rp->estimated_time_remaining();
|
double x = rp->estimated_time_remaining();
|
||||||
if (x == 0) continue;
|
if (x == 0) continue;
|
||||||
IP_RESULT ipr(rp->name, rp->report_deadline, x);
|
IP_RESULT ipr(rp->name, rp->report_deadline-now, x);
|
||||||
ip_results.push_back(ipr);
|
ip_results.push_back(ipr);
|
||||||
}
|
}
|
||||||
init_ip_results(work_buf_min(), ncpus, ip_results);
|
init_ip_results(work_buf_min(), ncpus, ip_results);
|
||||||
|
@ -371,8 +376,9 @@ bool CLIENT_STATE::simulate_rpc(PROJECT* p) {
|
||||||
WORKUNIT* wup = new WORKUNIT;
|
WORKUNIT* wup = new WORKUNIT;
|
||||||
make_job(p, wup, rp, apps);
|
make_job(p, wup, rp, apps);
|
||||||
|
|
||||||
|
double et = wup->rsc_fpops_est / rp->avp->flops;
|
||||||
if (server_uses_workload) {
|
if (server_uses_workload) {
|
||||||
IP_RESULT c(rp->name, rp->report_deadline, rp->final_cpu_time);
|
IP_RESULT c(rp->name, rp->report_deadline-now, et);
|
||||||
if (check_candidate(c, ncpus, ip_results)) {
|
if (check_candidate(c, ncpus, ip_results)) {
|
||||||
ip_results.push_back(c);
|
ip_results.push_back(c);
|
||||||
} else {
|
} else {
|
||||||
|
@ -384,7 +390,6 @@ bool CLIENT_STATE::simulate_rpc(PROJECT* p) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
double et = wup->rsc_fpops_est / rp->avp->flops;
|
|
||||||
if (get_estimated_delay(rp) + et > wup->app->latency_bound) {
|
if (get_estimated_delay(rp) + et > wup->app->latency_bound) {
|
||||||
//printf("%d: %s misses deadline\n", (int)gstate.now, p->project_name);
|
//printf("%d: %s misses deadline\n", (int)gstate.now, p->project_name);
|
||||||
APP_VERSION* avp = rp->avp;
|
APP_VERSION* avp = rp->avp;
|
||||||
|
|
|
@ -111,6 +111,8 @@ function do_sim($in, $out, $policy) {
|
||||||
system($cmd);
|
system($cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// display N results (usually 2) as bar graphs
|
||||||
|
//
|
||||||
function write_gp_bar($fname, $title, $data_fname) {
|
function write_gp_bar($fname, $title, $data_fname) {
|
||||||
$f = fopen($fname, "w");
|
$f = fopen($fname, "w");
|
||||||
$s = <<<EOT
|
$s = <<<EOT
|
||||||
|
@ -130,6 +132,8 @@ EOT;
|
||||||
fclose($f);
|
fclose($f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// display N results as line graphs, one for each figure of merit
|
||||||
|
//
|
||||||
function write_gp_line($fname, $title, $data_fname) {
|
function write_gp_line($fname, $title, $data_fname) {
|
||||||
$f = fopen($fname, "w");
|
$f = fopen($fname, "w");
|
||||||
$s = <<<EOT
|
$s = <<<EOT
|
||||||
|
@ -150,6 +154,25 @@ EOT;
|
||||||
fclose($f);
|
fclose($f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// display 2 groups of N results as line graphs.
|
||||||
|
// Show only 1 figure of merit (waste).
|
||||||
|
//
|
||||||
|
function write_gp_line2($fname, $title, $xlabel, $lab1, $lab2, $data1, $data2) {
|
||||||
|
$f = fopen($fname, "w");
|
||||||
|
$s = <<<EOT
|
||||||
|
set terminal png small size 320, 240
|
||||||
|
set title "$title"
|
||||||
|
set xlabel "$xlabel"
|
||||||
|
set format x "%e"
|
||||||
|
set style data linesp
|
||||||
|
set yrange[0:1]
|
||||||
|
plot "$data1" u 3:xtic(1) t "$lab1" , "$data2" u 3:xtic(1) t "$lab2"
|
||||||
|
|
||||||
|
EOT;
|
||||||
|
fwrite($f, $s);
|
||||||
|
fclose($f);
|
||||||
|
}
|
||||||
|
|
||||||
function graph_2_results($title, $dir, $r1, $r2) {
|
function graph_2_results($title, $dir, $r1, $r2) {
|
||||||
$data_fname = "$dir/cr.dat";
|
$data_fname = "$dir/cr.dat";
|
||||||
$f = fopen($data_fname, "w");
|
$f = fopen($data_fname, "w");
|
||||||
|
@ -162,7 +185,7 @@ function graph_2_results($title, $dir, $r1, $r2) {
|
||||||
system("gnuplot < $gp_fname > $png_fname");
|
system("gnuplot < $gp_fname > $png_fname");
|
||||||
}
|
}
|
||||||
|
|
||||||
function graph_n_results($title, $dir, $results) {
|
function graph_n_results1($title, $dir, $results) {
|
||||||
$data_fname = "$dir/cr.dat";
|
$data_fname = "$dir/cr.dat";
|
||||||
$f = fopen($data_fname, "w");
|
$f = fopen($data_fname, "w");
|
||||||
foreach ($results as $r) {
|
foreach ($results as $r) {
|
||||||
|
@ -175,6 +198,22 @@ function graph_n_results($title, $dir, $results) {
|
||||||
system("gnuplot < $gp_fname > $png_fname");
|
system("gnuplot < $gp_fname > $png_fname");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function graph_n_results2($title, $xlabel, $lab1, $lab2, $dir, $results1, $results2) {
|
||||||
|
for ($i=0; $i<2; $i++) {
|
||||||
|
$data_fname = "$dir/cr_$i.dat";
|
||||||
|
$f = fopen($data_fname, "w");
|
||||||
|
$rr = $i?$results2:$results1;
|
||||||
|
foreach ($rr as $r) {
|
||||||
|
$r->write($f);
|
||||||
|
}
|
||||||
|
fclose($f);
|
||||||
|
}
|
||||||
|
$gp_fname = "$dir/cr.gp";
|
||||||
|
$png_fname = "$dir/cr.png";
|
||||||
|
write_gp_line2($gp_fname, $title, $xlabel, $lab1, $lab2, "$dir/cr_0.dat", "$dir/cr_1.dat");
|
||||||
|
system("gnuplot < $gp_fname > $png_fname");
|
||||||
|
}
|
||||||
|
|
||||||
// create output dir, do a simulation, accumulate results
|
// create output dir, do a simulation, accumulate results
|
||||||
//
|
//
|
||||||
function do_sim_aux($out_dir, $scenario, $policy, $pname, $sum) {
|
function do_sim_aux($out_dir, $scenario, $policy, $pname, $sum) {
|
||||||
|
@ -186,7 +225,7 @@ function do_sim_aux($out_dir, $scenario, $policy, $pname, $sum) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function do_sim_param($out_dir, $scenario, $policy, $param, $sum) {
|
function do_sim_param($out_dir, $scenario, $policy, $param, $sum) {
|
||||||
$sim_out_dir = $out_dir."/".$scenario."_".$param;
|
$sim_out_dir = $out_dir."/".$scenario."_".$policy->name."_".$param;
|
||||||
@mkdir($sim_out_dir);
|
@mkdir($sim_out_dir);
|
||||||
$cs_template_fname = "$scenario/client_state_template.xml";
|
$cs_template_fname = "$scenario/client_state_template.xml";
|
||||||
$cs_fname = "$scenario/client_state.xml";
|
$cs_fname = "$scenario/client_state.xml";
|
||||||
|
@ -223,7 +262,7 @@ function compare_policies($title, $set, $p1, $p2, $out_dir) {
|
||||||
// Outputs are stored in the given directory.
|
// Outputs are stored in the given directory.
|
||||||
// Subdirectories scenario_arg/ store individual sim outputs
|
// Subdirectories scenario_arg/ store individual sim outputs
|
||||||
//
|
//
|
||||||
function compare_params($title, $set, $policy, $lo, $hi, $inc, $out_dir) {
|
function compare_params1($title, $set, $policy, $lo, $hi, $inc, $out_dir) {
|
||||||
@mkdir($out_dir);
|
@mkdir($out_dir);
|
||||||
$results = array();
|
$results = array();
|
||||||
for ($x = $lo; $x <= $hi; $x += $inc) {
|
for ($x = $lo; $x <= $hi; $x += $inc) {
|
||||||
|
@ -233,7 +272,28 @@ function compare_params($title, $set, $policy, $lo, $hi, $inc, $out_dir) {
|
||||||
}
|
}
|
||||||
$results[] = $sum;
|
$results[] = $sum;
|
||||||
}
|
}
|
||||||
graph_n_results($title, $out_dir, $results);
|
graph_n_results1($title, $out_dir, $results);
|
||||||
|
}
|
||||||
|
|
||||||
|
// same, but compare 2 policies and graph only wasted CPU
|
||||||
|
//
|
||||||
|
function compare_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_param($out_dir, $s, $p1, $x, $sum);
|
||||||
|
}
|
||||||
|
$rr1[] = $sum;
|
||||||
|
$sum = new RESULT($x);
|
||||||
|
foreach ($set as $s) {
|
||||||
|
$sum = do_sim_param($out_dir, $s, $p2, $x, $sum);
|
||||||
|
}
|
||||||
|
$rr2[] = $sum;
|
||||||
|
}
|
||||||
|
graph_n_results2($title, $xlabel, $lab1, $lab2, $out_dir, $rr1, $rr2);
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////// EXAMPLE USAGES ////////////
|
///////////// EXAMPLE USAGES ////////////
|
||||||
|
@ -247,15 +307,24 @@ if (0) {
|
||||||
compare_policies("Scenario 2", array("scen2"), $p1, $p2, "test1");
|
compare_policies("Scenario 2", array("scen2"), $p1, $p2, "test1");
|
||||||
}
|
}
|
||||||
|
|
||||||
// evaluate a policy over a set of parameterized policies
|
if (0) {
|
||||||
//
|
|
||||||
if (1) {
|
|
||||||
$p = new POLICY("");
|
$p = new POLICY("");
|
||||||
$p->use_rec = true;
|
$p->use_rec = true;
|
||||||
$lo = 2e9;
|
$lo = 2e9;
|
||||||
$hi = 1e10;
|
$hi = 1e10;
|
||||||
$inc = 1e9;
|
$inc = 1e9;
|
||||||
compare_params("Scenario 3", array("s3"), $p, $lo, $hi, $inc, "test2");
|
compare_params1("Scenario 3", array("s3"), $p, $lo, $hi, $inc, "test2");
|
||||||
|
}
|
||||||
|
|
||||||
|
// compare WRR and EDF
|
||||||
|
if (1) {
|
||||||
|
$p1 = new POLICY("DC_SIM");
|
||||||
|
$p1->server_uses_workload = true;
|
||||||
|
$p2 = new POLICY("DC_APPROX");
|
||||||
|
$lo = 1000;
|
||||||
|
$hi = 2000;
|
||||||
|
$inc = 100;
|
||||||
|
compare_params2("Wasted processing", "Job deadline", "DC_SIM", "DC_APPROX", array("scen5"), $p1, $p2, $lo, $hi, $inc, "test6");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (0) {
|
if (0) {
|
||||||
|
|
|
@ -118,9 +118,9 @@ EXTRA_DIST = *.h \
|
||||||
../lib/error_numbers.h \
|
../lib/error_numbers.h \
|
||||||
locale $(mac_headers)
|
locale $(mac_headers)
|
||||||
|
|
||||||
boincmgr_CPPFLAGS = $(AM_CPPFLAGS) $(WX_CPPFLAGS) $(SQLITE3_CPPFLAGS) $(LIBNOTIFY_CFLAGS) $(CLIENTGUIFLAGS)
|
boincmgr_CPPFLAGS = $(AM_CPPFLAGS) $(WX_CPPFLAGS) $(SQLITE3_CPPFLAGS) $(LIBNOTIFY_CFLAGS) $(CLIENTGUIFLAGS) `pkg-config --cflags gtk+-2.0`
|
||||||
boincmgr_CXXFLAGS = $(AM_CXXFLAGS) $(WX_CXXFLAGS) $(SQLITE3_CPPFLAGS) $(LIBNOTIFY_CFLAGS) $(CLIENTGUIFLAGS)
|
boincmgr_CXXFLAGS = $(AM_CXXFLAGS) $(WX_CXXFLAGS) $(SQLITE3_CPPFLAGS) $(LIBNOTIFY_CFLAGS) $(CLIENTGUIFLAGS) `pkg-config --cflags gtk+-2.0`
|
||||||
boincmgr_LDADD = $(LIBBOINC) $(SQLITE3_LIBS) $(LIBNOTIFY_LIBS) $(CLIENTGUILIBS) $(BOINC_EXTRA_LIBS) $(CLIENTLIBS)
|
boincmgr_LDFLAGS = $(LIBBOINC) $(SQLITE3_LIBS) $(LIBNOTIFY_LIBS) $(CLIENTGUILIBS) $(BOINC_EXTRA_LIBS) $(CLIENTLIBS) `pkg-config --libs gtk+-2.0` -lnotify
|
||||||
|
|
||||||
win_config.h: $(top_srcdir)/config.h
|
win_config.h: $(top_srcdir)/config.h
|
||||||
grep '#define.*BOINC.*VERSION' $^ > $@
|
grep '#define.*BOINC.*VERSION' $^ > $@
|
||||||
|
|
|
@ -33,6 +33,9 @@
|
||||||
|
|
||||||
|
|
||||||
#include "edf_sim.h"
|
#include "edf_sim.h"
|
||||||
|
#ifdef SIM
|
||||||
|
extern FILE* logfile;
|
||||||
|
#endif
|
||||||
|
|
||||||
using std::vector;
|
using std::vector;
|
||||||
|
|
||||||
|
@ -43,6 +46,9 @@ using std::vector;
|
||||||
#define DETAIL 2
|
#define DETAIL 2
|
||||||
// show every step of simulation
|
// show every step of simulation
|
||||||
|
|
||||||
|
#define TIME_SCALE 1
|
||||||
|
//#define TIME_SCALE 3600
|
||||||
|
|
||||||
static void log_msg(int level, const char* format, ...) {
|
static void log_msg(int level, const char* format, ...) {
|
||||||
#ifdef SIM
|
#ifdef SIM
|
||||||
#else
|
#else
|
||||||
|
@ -61,7 +67,7 @@ static void log_msg(int level, const char* format, ...) {
|
||||||
va_list va;
|
va_list va;
|
||||||
va_start(va, format);
|
va_start(va, format);
|
||||||
#ifdef SIM
|
#ifdef SIM
|
||||||
vfprintf(stderr, format, va);
|
vfprintf(logfile, format, va);
|
||||||
#else
|
#else
|
||||||
log_messages.vprintf(MSG_NORMAL, format, va);
|
log_messages.vprintf(MSG_NORMAL, format, va);
|
||||||
#endif
|
#endif
|
||||||
|
@ -111,18 +117,18 @@ void mark_edf_misses (int ncpus, vector<IP_RESULT>& ip_results){
|
||||||
|
|
||||||
booked_to[lowest_booked_cpu] += r.cpu_time_remaining;
|
booked_to[lowest_booked_cpu] += r.cpu_time_remaining;
|
||||||
log_msg(DETAIL, "[edf_detail] running %s on cpu %d; finishes at %.2f\n",
|
log_msg(DETAIL, "[edf_detail] running %s on cpu %d; finishes at %.2f\n",
|
||||||
r.name, lowest_booked_cpu, booked_to[lowest_booked_cpu]/3600
|
r.name, lowest_booked_cpu, booked_to[lowest_booked_cpu]/TIME_SCALE
|
||||||
);
|
);
|
||||||
if (booked_to[lowest_booked_cpu] > r.computation_deadline) {
|
if (booked_to[lowest_booked_cpu] > r.computation_deadline) {
|
||||||
r.misses_deadline = true;
|
r.misses_deadline = true;
|
||||||
r.estimated_completion_time = booked_to[lowest_booked_cpu];
|
r.estimated_completion_time = booked_to[lowest_booked_cpu];
|
||||||
log_msg(DETAIL, "[edf_detail] %s misses_deadline; est completion %.2f\n",
|
log_msg(DETAIL, "[edf_detail] %s misses_deadline; est completion %.2f\n",
|
||||||
r.name, booked_to[lowest_booked_cpu]/3600
|
r.name, booked_to[lowest_booked_cpu]/TIME_SCALE
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
r.misses_deadline = false;
|
r.misses_deadline = false;
|
||||||
log_msg(DETAIL, "[edf_detail] %s makes deadline; est completion %.2f\n",
|
log_msg(DETAIL, "[edf_detail] %s makes deadline; est completion %.2f\n",
|
||||||
r.name, booked_to[lowest_booked_cpu]/3600
|
r.name, booked_to[lowest_booked_cpu]/TIME_SCALE
|
||||||
);
|
);
|
||||||
// if result doesn't miss its deadline,
|
// if result doesn't miss its deadline,
|
||||||
// then the estimated_completion_time is of no use
|
// then the estimated_completion_time is of no use
|
||||||
|
@ -142,13 +148,13 @@ void init_ip_results(
|
||||||
|
|
||||||
log_msg(DETAIL,
|
log_msg(DETAIL,
|
||||||
"[edf_detail] init_ip_results; work_buf_min %.2f ncpus %d:\n",
|
"[edf_detail] init_ip_results; work_buf_min %.2f ncpus %d:\n",
|
||||||
work_buf_min/3600, ncpus
|
work_buf_min/TIME_SCALE, ncpus
|
||||||
);
|
);
|
||||||
for (i=0; i<ip_results.size(); i++) {
|
for (i=0; i<ip_results.size(); i++) {
|
||||||
IP_RESULT& r = ip_results[i];
|
IP_RESULT& r = ip_results[i];
|
||||||
r.computation_deadline = r.report_deadline - work_buf_min;
|
r.computation_deadline = r.report_deadline - work_buf_min;
|
||||||
log_msg(DETAIL, "[edf_detail] %s: deadline %.2f cpu %.2f\n",
|
log_msg(DETAIL, "[edf_detail] %s: deadline %.2f cpu %.2f\n",
|
||||||
r.name, r.computation_deadline/3600, r.cpu_time_remaining/3600
|
r.name, r.computation_deadline/TIME_SCALE, r.cpu_time_remaining/TIME_SCALE
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -221,8 +227,8 @@ bool check_candidate (
|
||||||
int j;
|
int j;
|
||||||
|
|
||||||
log_msg(DETAIL, "[edf_detail] check_candidate %s: dl %.2f cpu %.2f\n",
|
log_msg(DETAIL, "[edf_detail] check_candidate %s: dl %.2f cpu %.2f\n",
|
||||||
candidate.name, candidate.computation_deadline/3600,
|
candidate.name, candidate.computation_deadline/TIME_SCALE,
|
||||||
candidate.cpu_time_remaining/3600
|
candidate.cpu_time_remaining/TIME_SCALE
|
||||||
);
|
);
|
||||||
|
|
||||||
for (j=0; j<ncpus; j++) {
|
for (j=0; j<ncpus; j++) {
|
||||||
|
@ -250,8 +256,8 @@ bool check_candidate (
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
booked_to[lowest_booked_cpu] += r.cpu_time_remaining;
|
booked_to[lowest_booked_cpu] += r.cpu_time_remaining;
|
||||||
log_msg(DETAIL, "[edf_detail] running %s on cpu %d; finishes at %.2f\n",
|
log_msg(DETAIL, "[edf_detail] running %s on cpu %d; deadline %f, finishes at %.2f\n",
|
||||||
r.name, lowest_booked_cpu, booked_to[lowest_booked_cpu]/3600
|
r.name, lowest_booked_cpu, r.computation_deadline, booked_to[lowest_booked_cpu]/TIME_SCALE
|
||||||
);
|
);
|
||||||
|
|
||||||
// return false if completion time if > computation_deadline AND
|
// return false if completion time if > computation_deadline AND
|
||||||
|
@ -262,8 +268,8 @@ bool check_candidate (
|
||||||
) {
|
) {
|
||||||
log_msg(SUMMARY,
|
log_msg(SUMMARY,
|
||||||
"[send] cand. fails; %s now misses deadline: %.2f > %.2f\n",
|
"[send] cand. fails; %s now misses deadline: %.2f > %.2f\n",
|
||||||
r.name, booked_to[lowest_booked_cpu]/3600,
|
r.name, booked_to[lowest_booked_cpu]/TIME_SCALE,
|
||||||
r.computation_deadline/3600
|
r.computation_deadline/TIME_SCALE
|
||||||
);
|
);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue