From 58dadd91a8bf1ea24016d7d99a9fcbd804ce2bce Mon Sep 17 00:00:00 2001 From: David Anderson Date: Thu, 2 Dec 2010 04:53:12 +0000 Subject: [PATCH] - client, acct manager protocol: allow , and bools within in reply message. They suppress work fetch for that resource type from that project. - scheduler: check max_granted_credit after wu.rsc_fpops_bound, so that max_granted_credit will be enforced even if wu.rsc_fpops_bound is absurdly high Fixes #1034. From Diggory Hardy. svn path=/trunk/boinc/; revision=22793 --- checkin_notes | 20 ++++++++++++++++++++ client/acct_mgr.cpp | 28 ++++++++++++++++++++-------- client/acct_mgr.h | 3 +++ client/client_types.cpp | 12 ++++++++++++ client/cs_statefile.cpp | 2 ++ client/sim.cpp | 3 +++ sched/credit.cpp | 16 ++++++++++------ 7 files changed, 70 insertions(+), 14 deletions(-) diff --git a/checkin_notes b/checkin_notes index cb7e17e265..7b4d4b3ec2 100644 --- a/checkin_notes +++ b/checkin_notes @@ -8559,3 +8559,23 @@ David 1 Dec 2010 cpu_sched.cpp lib/ prefs.h + +David 1 Dec 2010 + - client, acct manager protocol: + allow , and bools + within in reply message. + They suppress work fetch for that resource type from that project. + - scheduler: + check max_granted_credit after wu.rsc_fpops_bound, + so that max_granted_credit will be enforced + even if wu.rsc_fpops_bound is absurdly high + Fixes #1034. From Diggory Hardy. + + sched/ + credit.cpp + client/ + sim.cpp + acct_mgr.h + client_types.cpp + cs_statefile.cpp + acct_mgr.cpp diff --git a/client/acct_mgr.cpp b/client/acct_mgr.cpp index 6672abffa1..4d82303b17 100644 --- a/client/acct_mgr.cpp +++ b/client/acct_mgr.cpp @@ -209,6 +209,9 @@ int AM_ACCOUNT::parse(XML_PARSER& xp) { detach = false; update = false; + no_cpu = false; + no_cuda = false; + no_ati = false; dont_request_more_work.init(); detach_when_done.init(); suspend.init(); @@ -242,6 +245,9 @@ int AM_ACCOUNT::parse(XML_PARSER& xp) { if (xp.parse_string(tag, "authenticator", authenticator)) continue; if (xp.parse_bool(tag, "detach", detach)) continue; if (xp.parse_bool(tag, "update", update)) continue; + if (xp.parse_bool(tag, "no_cpu", no_cpu)) continue; + if (xp.parse_bool(tag, "no_cuda", no_cuda)) continue; + if (xp.parse_bool(tag, "no_ati", no_ati)) continue; if (xp.parse_bool(tag, "dont_request_more_work", btemp)) { dont_request_more_work.set(btemp); continue; @@ -535,6 +541,9 @@ void ACCT_MGR_OP::handle_reply(int http_op_retval) { pp->abort_not_started(); } } + pp->no_cpu_ams = acct.no_cpu; + pp->no_cuda_ams = acct.no_cuda; + pp->no_ati_ams = acct.no_ati; } } } else { @@ -548,16 +557,19 @@ void ACCT_MGR_OP::handle_reply(int http_op_retval) { gstate.add_project( acct.url.c_str(), acct.authenticator.c_str(), "", true ); - if (acct.dont_request_more_work.present) { - pp = gstate.lookup_project(acct.url.c_str()); - if (pp) { + pp = gstate.lookup_project(acct.url.c_str()); + if (pp) { + pp->no_cpu_ams = acct.no_cpu; + pp->no_cuda_ams = acct.no_cuda; + pp->no_ati_ams = acct.no_ati; + if (acct.dont_request_more_work.present) { pp->dont_request_more_work = acct.dont_request_more_work.value; - } else { - msg_printf(NULL, MSG_INTERNAL_ERROR, - "Project not found: %s", - acct.url.c_str() - ); } + } else { + msg_printf(NULL, MSG_INTERNAL_ERROR, + "Failed to add project: %s", + acct.url.c_str() + ); } } } diff --git a/client/acct_mgr.h b/client/acct_mgr.h index df60535e77..a0aee16b2a 100644 --- a/client/acct_mgr.h +++ b/client/acct_mgr.h @@ -96,6 +96,9 @@ struct AM_ACCOUNT { char url_signature[MAX_SIGNATURE_LEN]; bool detach; bool update; + bool no_cpu; + bool no_cuda; + bool no_ati; OPTIONAL_BOOL dont_request_more_work; OPTIONAL_BOOL detach_when_done; OPTIONAL_DOUBLE resource_share; diff --git a/client/client_types.cpp b/client/client_types.cpp index 1662a78bb2..22e1c1a611 100644 --- a/client/client_types.cpp +++ b/client/client_types.cpp @@ -71,6 +71,9 @@ void PROJECT::init() { no_cpu_apps = false; no_cuda_apps = false; no_ati_apps = false; + no_cpu_ams = false; + no_cuda_ams = false; + no_ati_ams = false; cuda_defer_sched = false; ati_defer_sched = false; strcpy(host_venue, ""); @@ -235,6 +238,9 @@ int PROJECT::parse_state(MIOFILE& in) { if (parse_bool(buf, "no_cpu_apps", no_cpu_apps)) continue; if (parse_bool(buf, "no_cuda_apps", no_cuda_apps)) continue; if (parse_bool(buf, "no_ati_apps", no_ati_apps)) continue; + if (parse_bool(buf, "no_cpu_ams", no_cpu_ams)) continue; + if (parse_bool(buf, "no_cuda_ams", no_cuda_ams)) continue; + if (parse_bool(buf, "no_ati_ams", no_ati_ams)) continue; // backwards compat - old state files had ams_resource_share = 0 if (parse_double(buf, "", ams_resource_share)) continue; @@ -317,6 +323,9 @@ int PROJECT::write_state(MIOFILE& out, bool gui_rpc) { " %d\n" " %d\n" " %d\n" + " %d\n" + " %d\n" + " %d\n" "%s%s%s%s%s%s%s%s%s%s%s%s%s%s", master_url, project_name, @@ -368,6 +377,9 @@ int PROJECT::write_state(MIOFILE& out, bool gui_rpc) { no_cpu_apps?1:0, no_cuda_apps?1:0, no_ati_apps?1:0, + no_cpu_ams?1:0, + no_cuda_ams?1:0, + no_ati_ams?1:0, anonymous_platform?" \n":"", master_url_fetch_pending?" \n":"", trickle_up_pending?" \n":"", diff --git a/client/cs_statefile.cpp b/client/cs_statefile.cpp index 367202053b..41c0b7d10e 100644 --- a/client/cs_statefile.cpp +++ b/client/cs_statefile.cpp @@ -274,10 +274,12 @@ int CLIENT_STATE::parse_state_file_aux(const char* fname) { // and then reverted to a 32-bit client. // Let's not throw away the app version and its WUs // +#ifndef SIM msg_printf(project, MSG_INTERNAL_ERROR, "App version has unsupported platform %s; changing to %s", avp->platform, get_primary_platform() ); +#endif strcpy(avp->platform, get_primary_platform()); } } diff --git a/client/sim.cpp b/client/sim.cpp index 3f755b2ff7..443bbeccc6 100644 --- a/client/sim.cpp +++ b/client/sim.cpp @@ -1153,6 +1153,9 @@ void cull_projects() { while (iter != gstate.projects.end()) { p = *iter; if (p->dont_request_more_work) { + msg_printf(p, MSG_INFO, + "Removing from simulation - no jobs in client_state.xml" + ); iter = gstate.projects.erase(iter); } else { iter++; diff --git a/sched/credit.cpp b/sched/credit.cpp index 0196680765..c69a0d3f49 100644 --- a/sched/credit.cpp +++ b/sched/credit.cpp @@ -737,18 +737,22 @@ int assign_credit_set( ); } } - if (max_granted_credit && pfc*COBBLESTONE_SCALE > max_granted_credit) { - log_messages.printf(MSG_NORMAL, - "[credit] Credit too high: %f\n", pfc*COBBLESTONE_SCALE - ); - pfc = wu_estimated_pfc(wu, app); - } if (pfc > wu.rsc_fpops_bound) { log_messages.printf(MSG_NORMAL, "[credit] PFC too high: %f\n", pfc*COBBLESTONE_SCALE ); pfc = wu_estimated_pfc(wu, app); } + + // max_granted_credit trumps rsc_fpops_bound; + // the latter may be set absurdly high + // + if (max_granted_credit && pfc*COBBLESTONE_SCALE > max_granted_credit) { + log_messages.printf(MSG_NORMAL, + "[credit] Credit too high: %f\n", pfc*COBBLESTONE_SCALE + ); + pfc = max_granted_credit/COBBLESTONE_SCALE; + } if (mode == PFC_MODE_NORMAL) { normal.push_back(pfc); } else {