mirror of https://github.com/BOINC/boinc.git
- client: call xp.skip_unexpected() if get unexpected tag,
to avoid showing multiple error messages - client simulator: bug fixes and tweaks svn path=/trunk/boinc/; revision=24408
This commit is contained in:
parent
7e41a84c16
commit
1d38837788
|
@ -7336,3 +7336,15 @@ David 17 Oct 2011
|
||||||
client/
|
client/
|
||||||
sim.cpp
|
sim.cpp
|
||||||
sim_util.cpp
|
sim_util.cpp
|
||||||
|
|
||||||
|
David 17 Oct 2011
|
||||||
|
- client: call xp.skip_unexpected() if get unexpected tag,
|
||||||
|
to avoid showing multiple error messages
|
||||||
|
- client simulator: bug fixes and tweaks
|
||||||
|
|
||||||
|
client/
|
||||||
|
client_types.cpp,h
|
||||||
|
app.h
|
||||||
|
sim.cpp,h
|
||||||
|
work_fetch.cpp
|
||||||
|
sim_util.cpp
|
||||||
|
|
|
@ -156,10 +156,6 @@ struct ACTIVE_TASK {
|
||||||
return _task_state;
|
return _task_state;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef SIM
|
|
||||||
double flops_left;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if (defined (__APPLE__) && (defined(__i386__) || defined(__x86_64__)))
|
#if (defined (__APPLE__) && (defined(__i386__) || defined(__x86_64__)))
|
||||||
// PowerPC apps emulated on i386 Macs crash if running graphics
|
// PowerPC apps emulated on i386 Macs crash if running graphics
|
||||||
int powerpc_emulated_on_i386;
|
int powerpc_emulated_on_i386;
|
||||||
|
|
|
@ -134,6 +134,7 @@ void PROJECT::init() {
|
||||||
completions_ratio_s = 0.0;
|
completions_ratio_s = 0.0;
|
||||||
completions_ratio_stdev = 0.1; // for the first couple of completions - guess.
|
completions_ratio_stdev = 0.1; // for the first couple of completions - guess.
|
||||||
completions_required_stdevs = 3.0;
|
completions_required_stdevs = 3.0;
|
||||||
|
result_index = 0;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -322,6 +323,7 @@ int PROJECT::parse_state(XML_PARSER& xp) {
|
||||||
xp.parsed_tag
|
xp.parsed_tag
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
xp.skip_unexpected();
|
||||||
}
|
}
|
||||||
return ERR_XML_PARSE;
|
return ERR_XML_PARSE;
|
||||||
}
|
}
|
||||||
|
@ -693,6 +695,7 @@ int PROJECT::parse_project_files(XML_PARSER& xp, bool delete_existing_symlinks)
|
||||||
xp.parsed_tag
|
xp.parsed_tag
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
xp.skip_unexpected();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ERR_XML_PARSE;
|
return ERR_XML_PARSE;
|
||||||
|
@ -789,12 +792,6 @@ int APP::parse(XML_PARSER& xp) {
|
||||||
}
|
}
|
||||||
if (xp.parse_str("name", name, sizeof(name))) continue;
|
if (xp.parse_str("name", name, sizeof(name))) continue;
|
||||||
if (xp.parse_str("user_friendly_name", user_friendly_name, sizeof(user_friendly_name))) continue;
|
if (xp.parse_str("user_friendly_name", user_friendly_name, sizeof(user_friendly_name))) continue;
|
||||||
if (log_flags.unparsed_xml) {
|
|
||||||
msg_printf(0, MSG_INFO,
|
|
||||||
"[unparsed_xml] APP::parse(): unrecognized: %s\n",
|
|
||||||
xp.parsed_tag
|
|
||||||
);
|
|
||||||
}
|
|
||||||
#ifdef SIM
|
#ifdef SIM
|
||||||
if (xp.parse_double("latency_bound", latency_bound)) continue;
|
if (xp.parse_double("latency_bound", latency_bound)) continue;
|
||||||
if (xp.parse_double("fpops_est", fpops_est)) continue;
|
if (xp.parse_double("fpops_est", fpops_est)) continue;
|
||||||
|
@ -810,6 +807,13 @@ int APP::parse(XML_PARSER& xp) {
|
||||||
}
|
}
|
||||||
if (xp.parse_bool("non_cpu_intensive", non_cpu_intensive)) continue;
|
if (xp.parse_bool("non_cpu_intensive", non_cpu_intensive)) continue;
|
||||||
#endif
|
#endif
|
||||||
|
if (log_flags.unparsed_xml) {
|
||||||
|
msg_printf(0, MSG_INFO,
|
||||||
|
"[unparsed_xml] APP::parse(): unrecognized: %s\n",
|
||||||
|
xp.parsed_tag
|
||||||
|
);
|
||||||
|
}
|
||||||
|
xp.skip_unexpected();
|
||||||
}
|
}
|
||||||
return ERR_XML_PARSE;
|
return ERR_XML_PARSE;
|
||||||
}
|
}
|
||||||
|
@ -1019,6 +1023,7 @@ int FILE_INFO::parse(XML_PARSER& xp) {
|
||||||
xp.parsed_tag
|
xp.parsed_tag
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
xp.skip_unexpected();
|
||||||
}
|
}
|
||||||
return ERR_XML_PARSE;
|
return ERR_XML_PARSE;
|
||||||
}
|
}
|
||||||
|
@ -1325,6 +1330,7 @@ int APP_VERSION::parse(XML_PARSER& xp) {
|
||||||
xp.parsed_tag
|
xp.parsed_tag
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
xp.skip_unexpected();
|
||||||
}
|
}
|
||||||
return ERR_XML_PARSE;
|
return ERR_XML_PARSE;
|
||||||
}
|
}
|
||||||
|
@ -1473,6 +1479,7 @@ int FILE_REF::parse(XML_PARSER& xp) {
|
||||||
xp.parsed_tag
|
xp.parsed_tag
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
xp.skip_unexpected();
|
||||||
}
|
}
|
||||||
return ERR_XML_PARSE;
|
return ERR_XML_PARSE;
|
||||||
}
|
}
|
||||||
|
@ -1546,6 +1553,7 @@ int WORKUNIT::parse(XML_PARSER& xp) {
|
||||||
xp.parsed_tag
|
xp.parsed_tag
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
xp.skip_unexpected();
|
||||||
}
|
}
|
||||||
return ERR_XML_PARSE;
|
return ERR_XML_PARSE;
|
||||||
}
|
}
|
||||||
|
@ -1639,6 +1647,7 @@ int RESULT::parse_name(XML_PARSER& xp, const char* end_tag) {
|
||||||
xp.parsed_tag
|
xp.parsed_tag
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
xp.skip_unexpected();
|
||||||
}
|
}
|
||||||
return ERR_XML_PARSE;
|
return ERR_XML_PARSE;
|
||||||
}
|
}
|
||||||
|
@ -1704,6 +1713,7 @@ int RESULT::parse_server(XML_PARSER& xp) {
|
||||||
xp.parsed_tag
|
xp.parsed_tag
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
xp.skip_unexpected();
|
||||||
}
|
}
|
||||||
return ERR_XML_PARSE;
|
return ERR_XML_PARSE;
|
||||||
}
|
}
|
||||||
|
@ -1766,6 +1776,7 @@ int RESULT::parse_state(XML_PARSER& xp) {
|
||||||
xp.parsed_tag
|
xp.parsed_tag
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
xp.skip_unexpected();
|
||||||
}
|
}
|
||||||
return ERR_XML_PARSE;
|
return ERR_XML_PARSE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -655,6 +655,7 @@ struct RESULT {
|
||||||
double final_elapsed_time;
|
double final_elapsed_time;
|
||||||
#ifdef SIM
|
#ifdef SIM
|
||||||
double peak_flop_count;
|
double peak_flop_count;
|
||||||
|
double sim_flops_left;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// the following are nonzero if reported by app
|
// the following are nonzero if reported by app
|
||||||
|
@ -718,7 +719,11 @@ struct RESULT {
|
||||||
double estimated_duration_uncorrected();
|
double estimated_duration_uncorrected();
|
||||||
double estimated_time_remaining();
|
double estimated_time_remaining();
|
||||||
inline double estimated_flops_remaining() {
|
inline double estimated_flops_remaining() {
|
||||||
|
#ifdef SIM
|
||||||
|
return sim_flops_left;
|
||||||
|
#else
|
||||||
return estimated_time_remaining()*avp->flops;
|
return estimated_time_remaining()*avp->flops;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool computing_done() {
|
inline bool computing_done() {
|
||||||
|
|
|
@ -237,6 +237,7 @@ void make_job(
|
||||||
sprintf(rp->name, "%s_%d", p->project_name, p->result_index++);
|
sprintf(rp->name, "%s_%d", p->project_name, p->result_index++);
|
||||||
wup->project = p;
|
wup->project = p;
|
||||||
wup->rsc_fpops_est = app->fpops_est;
|
wup->rsc_fpops_est = app->fpops_est;
|
||||||
|
rp->sim_flops_left = rp->wup->rsc_fpops_est;
|
||||||
strcpy(wup->name, rp->name);
|
strcpy(wup->name, rp->name);
|
||||||
strcpy(wup->app_name, app->name);
|
strcpy(wup->app_name, app->name);
|
||||||
wup->app = app;
|
wup->app = app;
|
||||||
|
@ -610,12 +611,12 @@ bool ACTIVE_TASK_SET::poll() {
|
||||||
flops *= cpu_scale;
|
flops *= cpu_scale;
|
||||||
}
|
}
|
||||||
|
|
||||||
atp->flops_left -= diff*flops;
|
rp->sim_flops_left -= diff*flops;
|
||||||
|
|
||||||
atp->fraction_done = 1 - (atp->flops_left / rp->wup->rsc_fpops_est);
|
atp->fraction_done = 1 - rp->sim_flops_left / rp->wup->rsc_fpops_est;
|
||||||
atp->checkpoint_wall_time = gstate.now;
|
atp->checkpoint_wall_time = gstate.now;
|
||||||
|
|
||||||
if (atp->flops_left <= 0) {
|
if (rp->sim_flops_left <= 0) {
|
||||||
atp->set_task_state(PROCESS_EXITED, "poll");
|
atp->set_task_state(PROCESS_EXITED, "poll");
|
||||||
rp->exit_status = 0;
|
rp->exit_status = 0;
|
||||||
rp->ready_to_report = true;
|
rp->ready_to_report = true;
|
||||||
|
@ -708,6 +709,7 @@ void SIM_RESULTS::compute_figures_of_merit() {
|
||||||
double flops_total = cpu_peak_flops()*active_time
|
double flops_total = cpu_peak_flops()*active_time
|
||||||
+ gpu_peak_flops()*gpu_active_time;
|
+ gpu_peak_flops()*gpu_active_time;
|
||||||
double flops_idle = flops_total - flops_used;
|
double flops_idle = flops_total - flops_used;
|
||||||
|
if (flops_idle<0) flops_idle=0;
|
||||||
wasted_frac = flops_wasted/flops_total;
|
wasted_frac = flops_wasted/flops_total;
|
||||||
idle_frac = flops_idle/flops_total;
|
idle_frac = flops_idle/flops_total;
|
||||||
share_violation = gstate.share_violation();
|
share_violation = gstate.share_violation();
|
||||||
|
@ -715,7 +717,7 @@ void SIM_RESULTS::compute_figures_of_merit() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void SIM_RESULTS::print(FILE* f, bool human_readable) {
|
void SIM_RESULTS::print(FILE* f, bool human_readable) {
|
||||||
double r = ((double)nrpcs)/(njobs*2);
|
double r = njobs?((double)nrpcs)/(njobs*2):0;
|
||||||
if (human_readable) {
|
if (human_readable) {
|
||||||
fprintf(f,
|
fprintf(f,
|
||||||
"wasted fraction %f\n"
|
"wasted fraction %f\n"
|
||||||
|
@ -858,9 +860,9 @@ void show_resource(int rsc_type) {
|
||||||
fprintf(html_out, "<tr><td>%.2f</td><td bgcolor=%s><font color=#ffffff>%s%s</font></td><td>%.0f</td>%s</tr>\n",
|
fprintf(html_out, "<tr><td>%.2f</td><td bgcolor=%s><font color=#ffffff>%s%s</font></td><td>%.0f</td>%s</tr>\n",
|
||||||
ninst,
|
ninst,
|
||||||
colors[p->index%NCOLORS],
|
colors[p->index%NCOLORS],
|
||||||
atp->result->rr_sim_misses_deadline?"*":"",
|
rp->rr_sim_misses_deadline?"*":"",
|
||||||
atp->result->name,
|
rp->name,
|
||||||
atp->flops_left/1e9,
|
rp->sim_flops_left/1e9,
|
||||||
buf
|
buf
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -926,8 +928,8 @@ void html_start() {
|
||||||
void html_rec() {
|
void html_rec() {
|
||||||
if (html_msg.size()) {
|
if (html_msg.size()) {
|
||||||
fprintf(html_out,
|
fprintf(html_out,
|
||||||
"<table border=0 cellpadding=4><tr><td width=%d valign=top>%.0f</td>",
|
"<table border=0 cellpadding=4><tr><td width=%d valign=top>%s</td>",
|
||||||
WIDTH1, gstate.now
|
WIDTH1, sim_time_string(gstate.now)
|
||||||
);
|
);
|
||||||
fprintf(html_out,
|
fprintf(html_out,
|
||||||
"<td width=%d valign=top><font size=-2>%s</font></td></tr></table>\n",
|
"<td width=%d valign=top><font size=-2>%s</font></td></tr></table>\n",
|
||||||
|
@ -936,7 +938,7 @@ void html_rec() {
|
||||||
);
|
);
|
||||||
html_msg = "";
|
html_msg = "";
|
||||||
}
|
}
|
||||||
fprintf(html_out, "<table border=0 cellpadding=4><tr><td width=%d valign=top>%.0f</td>", WIDTH1, gstate.now);
|
fprintf(html_out, "<table border=0 cellpadding=4><tr><td width=%d valign=top>%s</td>", WIDTH1, sim_time_string(gstate.now));
|
||||||
|
|
||||||
if (active) {
|
if (active) {
|
||||||
show_resource(0);
|
show_resource(0);
|
||||||
|
@ -1174,9 +1176,13 @@ void get_app_params() {
|
||||||
for (i=0; i<gstate.results.size(); i++) {
|
for (i=0; i<gstate.results.size(); i++) {
|
||||||
RESULT* rp = gstate.results[i];
|
RESULT* rp = gstate.results[i];
|
||||||
app = rp->app;
|
app = rp->app;
|
||||||
|
double latency_bound = rp->report_deadline - rp->received_time;
|
||||||
if (!app->latency_bound) {
|
if (!app->latency_bound) {
|
||||||
app->latency_bound = rp->report_deadline - rp->received_time;
|
app->latency_bound = latency_bound;
|
||||||
}
|
}
|
||||||
|
rp->received_time = START_TIME;
|
||||||
|
rp->report_deadline = START_TIME + latency_bound;
|
||||||
|
rp->sim_flops_left = rp->wup->rsc_fpops_est;
|
||||||
}
|
}
|
||||||
for (i=0; i<gstate.workunits.size(); i++) {
|
for (i=0; i<gstate.workunits.size(); i++) {
|
||||||
WORKUNIT* wup = gstate.workunits[i];
|
WORKUNIT* wup = gstate.workunits[i];
|
||||||
|
@ -1465,5 +1471,6 @@ int main(int argc, char** argv) {
|
||||||
sprintf(buf, "%s%s", outfile_prefix, SUMMARY_FNAME);
|
sprintf(buf, "%s%s", outfile_prefix, SUMMARY_FNAME);
|
||||||
summary_file = fopen(buf, "w");
|
summary_file = fopen(buf, "w");
|
||||||
|
|
||||||
|
srand(1); // make it deterministic
|
||||||
do_client_simulation();
|
do_client_simulation();
|
||||||
}
|
}
|
||||||
|
|
|
@ -90,6 +90,7 @@ extern SIM_RESULTS sim_results;
|
||||||
extern double calculate_exponential_backoff(
|
extern double calculate_exponential_backoff(
|
||||||
int n, double MIN, double MAX
|
int n, double MIN, double MAX
|
||||||
);
|
);
|
||||||
|
extern char* sim_time_string(int t);
|
||||||
|
|
||||||
extern bool dcf_dont_use;
|
extern bool dcf_dont_use;
|
||||||
extern bool dcf_stats;
|
extern bool dcf_stats;
|
||||||
|
|
|
@ -53,6 +53,28 @@ void HOST_INFO::generate_host_cpid() {}
|
||||||
|
|
||||||
//int get_connected_state() {return 1;}
|
//int get_connected_state() {return 1;}
|
||||||
|
|
||||||
|
char* sim_time_string(int t) {
|
||||||
|
static char buf[256];
|
||||||
|
char buf2[256];
|
||||||
|
if (t > 86400) {
|
||||||
|
int n = t/86400;
|
||||||
|
t %= 86400;
|
||||||
|
if (n == 1) {
|
||||||
|
sprintf(buf2, "1 day ");
|
||||||
|
} else {
|
||||||
|
sprintf(buf2, "%d days ", n);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
strcpy(buf2, "");
|
||||||
|
}
|
||||||
|
int hours = t / 3600;
|
||||||
|
t %= 3600;
|
||||||
|
int mins = t/60;
|
||||||
|
int secs = t%60;
|
||||||
|
sprintf(buf, "%s%02d:%02d:%02d", buf2, hours, mins, secs);
|
||||||
|
return buf;
|
||||||
|
}
|
||||||
|
|
||||||
void show_message(PROJ_AM *p, char* msg, int priority, bool, const char*) {
|
void show_message(PROJ_AM *p, char* msg, int priority, bool, const char*) {
|
||||||
const char* x;
|
const char* x;
|
||||||
char message[1024];
|
char message[1024];
|
||||||
|
@ -73,7 +95,7 @@ void show_message(PROJ_AM *p, char* msg, int priority, bool, const char*) {
|
||||||
x = "---";
|
x = "---";
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf(logfile, "%.0f [%s] %s\n", gstate.now, x, message);
|
fprintf(logfile, "%s [%s] %s\n", sim_time_string(gstate.now), x, message);
|
||||||
}
|
}
|
||||||
|
|
||||||
APP_CLIENT_SHM::APP_CLIENT_SHM() {}
|
APP_CLIENT_SHM::APP_CLIENT_SHM() {}
|
||||||
|
@ -99,12 +121,15 @@ int ACTIVE_TASK::resume_or_start(bool first_time) {
|
||||||
if (log_flags.task) {
|
if (log_flags.task) {
|
||||||
msg_printf(result->project, MSG_INFO,
|
msg_printf(result->project, MSG_INFO,
|
||||||
"[task] %s task %s: FLOPS left %.2fG",
|
"[task] %s task %s: FLOPS left %.2fG",
|
||||||
first_time?"Starting":"Resuming", result->name, flops_left/1e9
|
first_time?"Starting":"Resuming",
|
||||||
|
result->name, result->sim_flops_left/1e9
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
set_task_state(PROCESS_EXECUTING, "start");
|
set_task_state(PROCESS_EXECUTING, "start");
|
||||||
char buf[256];
|
char buf[256];
|
||||||
sprintf(buf, "Starting %s<br>", result->name);
|
sprintf(buf, "Starting %s; deadline %s<br>",
|
||||||
|
result->name, sim_time_string(result->report_deadline)
|
||||||
|
);
|
||||||
html_msg += buf;
|
html_msg += buf;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -116,7 +141,6 @@ int ACTIVE_TASK::init(RESULT* rp) {
|
||||||
max_elapsed_time = rp->wup->rsc_fpops_bound/result->avp->flops;
|
max_elapsed_time = rp->wup->rsc_fpops_bound/result->avp->flops;
|
||||||
max_disk_usage = rp->wup->rsc_disk_bound;
|
max_disk_usage = rp->wup->rsc_disk_bound;
|
||||||
max_mem_usage = rp->wup->rsc_memory_bound;
|
max_mem_usage = rp->wup->rsc_memory_bound;
|
||||||
flops_left = rp->wup->rsc_fpops_est;
|
|
||||||
_task_state = PROCESS_UNINITIALIZED;
|
_task_state = PROCESS_UNINITIALIZED;
|
||||||
scheduler_state = CPU_SCHED_UNINITIALIZED;
|
scheduler_state = CPU_SCHED_UNINITIALIZED;
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -1029,7 +1029,11 @@ double RESULT::estimated_time_remaining() {
|
||||||
if (computing_done()) return 0;
|
if (computing_done()) return 0;
|
||||||
ACTIVE_TASK* atp = gstate.lookup_active_task_by_result(this);
|
ACTIVE_TASK* atp = gstate.lookup_active_task_by_result(this);
|
||||||
if (atp) {
|
if (atp) {
|
||||||
|
#ifdef SIM
|
||||||
|
return sim_flops_left/avp->flops;
|
||||||
|
#else
|
||||||
return atp->est_dur() - atp->elapsed_time;
|
return atp->est_dur() - atp->elapsed_time;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
return estimated_duration();
|
return estimated_duration();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue