- client: give highest work-fetch priority to resources with idle instances

svn path=/trunk/boinc/; revision=17660
This commit is contained in:
David Anderson 2009-03-25 16:59:59 +00:00
parent 47056a11f0
commit 5d6fc98de3
2 changed files with 29 additions and 0 deletions

View File

@ -3341,3 +3341,9 @@ David 25 Mar 2009
sched/
file_upload_handler.cpp
David 25 Mar 2009
- client: give highest work-fetch priority to resources with idle instances
client/
work_fetch.cpp

View File

@ -142,6 +142,10 @@ bool RSC_PROJECT_WORK_FETCH::overworked() {
return (debt < -x);
}
#define FETCH_IF_IDLE_INSTANCE 0
// If resource has an idle instance,
// get work for it from the project with greatest LTD,
// even if it's overworked.
#define FETCH_IF_MAJOR_SHORTFALL 1
// If resource is saturated for less than work_buf_min(),
// get work for it from the project with greatest LTD,
@ -162,6 +166,9 @@ PROJECT* RSC_WORK_FETCH::choose_project(int criterion) {
PROJECT* pbest = NULL;
switch (criterion) {
case FETCH_IF_IDLE_INSTANCE:
if (nidle_now == 0) return NULL;
break;
case FETCH_IF_MAJOR_SHORTFALL:
if (estimated_delay > gstate.work_buf_min()) return NULL;
break;
@ -201,6 +208,16 @@ PROJECT* RSC_WORK_FETCH::choose_project(int criterion) {
//
work_fetch.clear_request();
switch (criterion) {
case FETCH_IF_IDLE_INSTANCE:
if (log_flags.work_fetch_debug) {
msg_printf(pbest, MSG_INFO,
"chosen: %s idle instance", rsc_name(rsc_type)
);
}
req = share_request(pbest);
if (req > shortfall) req = shortfall;
set_request(pbest, req);
break;
case FETCH_IF_MAJOR_SHORTFALL:
if (log_flags.work_fetch_debug) {
msg_printf(pbest, MSG_INFO,
@ -402,6 +419,12 @@ PROJECT* WORK_FETCH::choose_project() {
gstate.rr_simulation();
set_overall_debts();
if (coproc_cuda) {
p = cuda_work_fetch.choose_project(FETCH_IF_IDLE_INSTANCE);
}
if (!p) {
p = cpu_work_fetch.choose_project(FETCH_IF_IDLE_INSTANCE);
}
if (coproc_cuda) {
p = cuda_work_fetch.choose_project(FETCH_IF_MAJOR_SHORTFALL);
}