diff --git a/checkin_notes b/checkin_notes index 4ed52be3a8..fc630a1e71 100644 --- a/checkin_notes +++ b/checkin_notes @@ -7336,3 +7336,15 @@ David 17 Oct 2011 client/ sim.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 diff --git a/client/app.h b/client/app.h index be19633b6b..387ac81c45 100644 --- a/client/app.h +++ b/client/app.h @@ -156,10 +156,6 @@ struct ACTIVE_TASK { return _task_state; } -#ifdef SIM - double flops_left; -#endif - #if (defined (__APPLE__) && (defined(__i386__) || defined(__x86_64__))) // PowerPC apps emulated on i386 Macs crash if running graphics int powerpc_emulated_on_i386; diff --git a/client/client_types.cpp b/client/client_types.cpp index 6c1818cd35..5dec67c1e1 100644 --- a/client/client_types.cpp +++ b/client/client_types.cpp @@ -134,6 +134,7 @@ void PROJECT::init() { completions_ratio_s = 0.0; completions_ratio_stdev = 0.1; // for the first couple of completions - guess. completions_required_stdevs = 3.0; + result_index = 0; #endif } @@ -322,6 +323,7 @@ int PROJECT::parse_state(XML_PARSER& xp) { xp.parsed_tag ); } + xp.skip_unexpected(); } return ERR_XML_PARSE; } @@ -693,6 +695,7 @@ int PROJECT::parse_project_files(XML_PARSER& xp, bool delete_existing_symlinks) xp.parsed_tag ); } + xp.skip_unexpected(); } } 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("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 if (xp.parse_double("latency_bound", latency_bound)) 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; #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; } @@ -1019,6 +1023,7 @@ int FILE_INFO::parse(XML_PARSER& xp) { xp.parsed_tag ); } + xp.skip_unexpected(); } return ERR_XML_PARSE; } @@ -1325,6 +1330,7 @@ int APP_VERSION::parse(XML_PARSER& xp) { xp.parsed_tag ); } + xp.skip_unexpected(); } return ERR_XML_PARSE; } @@ -1473,6 +1479,7 @@ int FILE_REF::parse(XML_PARSER& xp) { xp.parsed_tag ); } + xp.skip_unexpected(); } return ERR_XML_PARSE; } @@ -1546,6 +1553,7 @@ int WORKUNIT::parse(XML_PARSER& xp) { xp.parsed_tag ); } + xp.skip_unexpected(); } return ERR_XML_PARSE; } @@ -1639,6 +1647,7 @@ int RESULT::parse_name(XML_PARSER& xp, const char* end_tag) { xp.parsed_tag ); } + xp.skip_unexpected(); } return ERR_XML_PARSE; } @@ -1704,6 +1713,7 @@ int RESULT::parse_server(XML_PARSER& xp) { xp.parsed_tag ); } + xp.skip_unexpected(); } return ERR_XML_PARSE; } @@ -1766,6 +1776,7 @@ int RESULT::parse_state(XML_PARSER& xp) { xp.parsed_tag ); } + xp.skip_unexpected(); } return ERR_XML_PARSE; } diff --git a/client/client_types.h b/client/client_types.h index 1ea6d72908..7007ae9d27 100644 --- a/client/client_types.h +++ b/client/client_types.h @@ -655,6 +655,7 @@ struct RESULT { double final_elapsed_time; #ifdef SIM double peak_flop_count; + double sim_flops_left; #endif // the following are nonzero if reported by app @@ -718,7 +719,11 @@ struct RESULT { double estimated_duration_uncorrected(); double estimated_time_remaining(); inline double estimated_flops_remaining() { +#ifdef SIM + return sim_flops_left; +#else return estimated_time_remaining()*avp->flops; +#endif } inline bool computing_done() { diff --git a/client/sim.cpp b/client/sim.cpp index 10319698d2..dab1438872 100644 --- a/client/sim.cpp +++ b/client/sim.cpp @@ -237,6 +237,7 @@ void make_job( sprintf(rp->name, "%s_%d", p->project_name, p->result_index++); wup->project = p; wup->rsc_fpops_est = app->fpops_est; + rp->sim_flops_left = rp->wup->rsc_fpops_est; strcpy(wup->name, rp->name); strcpy(wup->app_name, app->name); wup->app = app; @@ -610,12 +611,12 @@ bool ACTIVE_TASK_SET::poll() { 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; - if (atp->flops_left <= 0) { + if (rp->sim_flops_left <= 0) { atp->set_task_state(PROCESS_EXITED, "poll"); rp->exit_status = 0; rp->ready_to_report = true; @@ -708,6 +709,7 @@ void SIM_RESULTS::compute_figures_of_merit() { double flops_total = cpu_peak_flops()*active_time + gpu_peak_flops()*gpu_active_time; double flops_idle = flops_total - flops_used; + if (flops_idle<0) flops_idle=0; wasted_frac = flops_wasted/flops_total; idle_frac = flops_idle/flops_total; 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) { - double r = ((double)nrpcs)/(njobs*2); + double r = njobs?((double)nrpcs)/(njobs*2):0; if (human_readable) { fprintf(f, "wasted fraction %f\n" @@ -858,9 +860,9 @@ void show_resource(int rsc_type) { fprintf(html_out, "%.2f%s%s%.0f%s\n", ninst, colors[p->index%NCOLORS], - atp->result->rr_sim_misses_deadline?"*":"", - atp->result->name, - atp->flops_left/1e9, + rp->rr_sim_misses_deadline?"*":"", + rp->name, + rp->sim_flops_left/1e9, buf ); } @@ -926,8 +928,8 @@ void html_start() { void html_rec() { if (html_msg.size()) { fprintf(html_out, - "", - WIDTH1, gstate.now + "
%.0f
", + WIDTH1, sim_time_string(gstate.now) ); fprintf(html_out, "
%s%s
\n", @@ -936,7 +938,7 @@ void html_rec() { ); html_msg = ""; } - fprintf(html_out, "", WIDTH1, gstate.now); + fprintf(html_out, "
%.0f
", WIDTH1, sim_time_string(gstate.now)); if (active) { show_resource(0); @@ -1174,9 +1176,13 @@ void get_app_params() { for (i=0; iapp; + double latency_bound = rp->report_deadline - rp->received_time; 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 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*) { const char* x; char message[1024]; @@ -73,7 +95,7 @@ void show_message(PROJ_AM *p, char* msg, int priority, bool, const char*) { 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() {} @@ -99,12 +121,15 @@ int ACTIVE_TASK::resume_or_start(bool first_time) { if (log_flags.task) { msg_printf(result->project, MSG_INFO, "[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"); char buf[256]; - sprintf(buf, "Starting %s
", result->name); + sprintf(buf, "Starting %s; deadline %s
", + result->name, sim_time_string(result->report_deadline) + ); html_msg += buf; return 0; } @@ -116,7 +141,6 @@ int ACTIVE_TASK::init(RESULT* rp) { max_elapsed_time = rp->wup->rsc_fpops_bound/result->avp->flops; max_disk_usage = rp->wup->rsc_disk_bound; max_mem_usage = rp->wup->rsc_memory_bound; - flops_left = rp->wup->rsc_fpops_est; _task_state = PROCESS_UNINITIALIZED; scheduler_state = CPU_SCHED_UNINITIALIZED; return 0; diff --git a/client/work_fetch.cpp b/client/work_fetch.cpp index 31aaa7d779..e096326238 100644 --- a/client/work_fetch.cpp +++ b/client/work_fetch.cpp @@ -1029,7 +1029,11 @@ double RESULT::estimated_time_remaining() { if (computing_done()) return 0; ACTIVE_TASK* atp = gstate.lookup_active_task_by_result(this); if (atp) { +#ifdef SIM + return sim_flops_left/avp->flops; +#else return atp->est_dur() - atp->elapsed_time; +#endif } return estimated_duration(); }
%s