From 8ca24cbbab44bf23c48b6c4ced6e389b894d930f Mon Sep 17 00:00:00 2001 From: David Anderson Date: Wed, 13 Jul 2011 19:46:03 +0000 Subject: [PATCH] - client, work fetch policy: adjust project REC by the amount of work queued, to increase variety NOTE: at some point I think I had a reason to not do this, but I can't remember what it is. - client, job scheduling policy: fix how project REC is adjusted svn path=/trunk/boinc/; revision=23838 --- checkin_notes | 16 ++++++++++++++++ client/cpu_sched.cpp | 24 ++++++++++++++++++------ client/work_fetch.cpp | 4 ++++ client/work_fetch.h | 3 ++- lib/common_defs.h | 3 +++ sched/credit.cpp | 3 +-- sched/credit.h | 6 ------ sched/trickle_credit.cpp | 3 ++- 8 files changed, 46 insertions(+), 16 deletions(-) diff --git a/checkin_notes b/checkin_notes index af0fd6a523..74c7f5d5c9 100644 --- a/checkin_notes +++ b/checkin_notes @@ -4078,3 +4078,19 @@ David 12 July 2011 sched/ credit.cpp + +David 13 July 2011 + - client, work fetch policy: + adjust project REC by the amount of work queued, to increase variety + NOTE: at some point I think I had a reason to not do this, + but I can't remember what it is. + - client, job scheduling policy: fix how project REC is adjusted + + client/ + work_fetch.cpp,h + cpu_sched.cpp + lib/ + common_defs.h + sched/ + credit.cpp,h + trickle_credit.cpp diff --git a/client/cpu_sched.cpp b/client/cpu_sched.cpp index fac5b0700f..c29882c21e 100644 --- a/client/cpu_sched.cpp +++ b/client/cpu_sched.cpp @@ -539,7 +539,7 @@ static void update_rec() { for (int j=0; jrsc_pwf[j].secs_this_debt_interval * f * rsc_work_fetch[j].relative_speed; } - x /= 1e9; + x *= COBBLESTONE_SCALE; double old = p->pwf.rec; // start averages at zero @@ -619,12 +619,24 @@ double project_priority(PROJECT* p) { return x; } -// we plan to run this job. -// bump the project's REC accordingly +// called from the scheduler's job-selection loop; +// we plan to run this job; +// bump the project's temp REC by the amount credit for 1 scheduling period. +// This encourages a mixture jobs from different projects. // -void adjust_rec_temp(RESULT* rp) { +void adjust_rec_sched(RESULT* rp) { PROJECT* p = rp->project; - p->pwf.rec_temp += peak_flops(rp->avp)/86400; + double f = peak_flops(rp->avp)*gstate.global_prefs.cpu_scheduling_period(); + p->pwf.rec_temp += f*COBBLESTONE_SCALE; +} + +// called from work fetch initialization; +// bump the project's temp REC by the amount of credit +// projected for the rest of the job. +// +void adjust_rec_work_fetch(RESULT* rp) { + PROJECT* p = rp->project; + p->pwf.rec_temp += rp->estimated_flops_remaining()*COBBLESTONE_SCALE; } // adjust project debts (short, long-term) or REC @@ -744,7 +756,7 @@ static bool schedule_if_possible( proc_rsc.schedule(rp, atp); if (use_rec) { - adjust_rec_temp(rp); + adjust_rec_sched(rp); } else { // project STD at end of time slice // diff --git a/client/work_fetch.cpp b/client/work_fetch.cpp index 209f505083..c9796d9890 100644 --- a/client/work_fetch.cpp +++ b/client/work_fetch.cpp @@ -898,6 +898,10 @@ PROJECT* WORK_FETCH::choose_project() { compute_shares(); if (use_rec) { project_priority_init(); + for (unsigned int i=0; ix // -// NOTE: there is no cheat-prevention mechanism here. +// NOTE: there is no cheat-prevention mechanism here; add your own. +// NOTE: doesn't work for GPU apps #include "error_numbers.h" #include "util.h"