From 98ba6807abeec975ba6549e209887b9c4f36d4c5 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Mon, 7 Nov 2011 05:12:02 +0000 Subject: [PATCH] svn path=/trunk/boinc/; revision=24537 --- checkin_notes | 9 ++++++++- client/client_types.cpp | 12 +++++++++++- client/rr_sim.cpp | 11 ++++++----- 3 files changed, 25 insertions(+), 7 deletions(-) diff --git a/checkin_notes b/checkin_notes index 0727c8ea75..4dd305c996 100644 --- a/checkin_notes +++ b/checkin_notes @@ -8169,8 +8169,15 @@ David 5 Nov 2011 client/ cs_trickle.cpp -David 5 Nov 2011 +David 6 Nov 2011 - client: actually do the checking described above client/ cs_trickle.cpp + +David 6 Nov 2011 + - client: don't crash if a project sends app_version.flops = 0. + + client/ + client_types.cpp + rr_sim.cpp diff --git a/client/client_types.cpp b/client/client_types.cpp index d8f838d6c9..049a728a07 100644 --- a/client/client_types.cpp +++ b/client/client_types.cpp @@ -1268,6 +1268,7 @@ int FILE_INFO::gzip() { int APP_VERSION::parse(XML_PARSER& xp) { FILE_REF file_ref; + double dtemp; strcpy(app_name, ""); strcpy(api_version, ""); @@ -1302,7 +1303,16 @@ int APP_VERSION::parse(XML_PARSER& xp) { if (xp.parse_str("plan_class", plan_class, sizeof(plan_class))) continue; if (xp.parse_double("avg_ncpus", avg_ncpus)) continue; if (xp.parse_double("max_ncpus", max_ncpus)) continue; - if (xp.parse_double("flops", flops)) continue; + if (xp.parse_double("flops", dtemp)) { + if (dtemp <= 0) { + msg_printf(0, MSG_INTERNAL_ERROR, + "non-positive FLOPS in app version" + ); + } else { + flops = dtemp; + } + continue; + } if (xp.parse_str("cmdline", cmdline, sizeof(cmdline))) continue; if (xp.parse_str("file_prefix", file_prefix, sizeof(file_prefix))) continue; if (xp.parse_double("gpu_ram", gpu_ram)) continue; diff --git a/client/rr_sim.cpp b/client/rr_sim.cpp index 5ecce08485..b52dc3f506 100644 --- a/client/rr_sim.cpp +++ b/client/rr_sim.cpp @@ -96,6 +96,9 @@ void set_rrsim_flops(RESULT* rp) { } else { rp->rrsim_flops = rp->avp->flops * gstate.overall_cpu_frac(); } + if (rp->rrsim_flops == 0) { + rp->rrsim_flops = 1e6; // just in case + } } void print_deadline_misses() { @@ -346,11 +349,9 @@ void RR_SIM::simulate() { rpbest = NULL; for (u=0; urrsim_flops) { - rp->rrsim_finish_delay = rp->rrsim_flops_left/rp->rrsim_flops; - if (!rpbest || rp->rrsim_finish_delay < rpbest->rrsim_finish_delay) { - rpbest = rp; - } + rp->rrsim_finish_delay = rp->rrsim_flops_left/rp->rrsim_flops; + if (!rpbest || rp->rrsim_finish_delay < rpbest->rrsim_finish_delay) { + rpbest = rp; } }