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"