From 5d6fc98de3d93a684a4285458e24305382f64a7c Mon Sep 17 00:00:00 2001 From: David Anderson Date: Wed, 25 Mar 2009 16:59:59 +0000 Subject: [PATCH] - client: give highest work-fetch priority to resources with idle instances svn path=/trunk/boinc/; revision=17660 --- checkin_notes | 6 ++++++ client/work_fetch.cpp | 23 +++++++++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/checkin_notes b/checkin_notes index 36f3b26d8f..d92fe334a3 100644 --- a/checkin_notes +++ b/checkin_notes @@ -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 diff --git a/client/work_fetch.cpp b/client/work_fetch.cpp index be380b484f..6af527e2ff 100644 --- a/client/work_fetch.cpp +++ b/client/work_fetch.cpp @@ -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); }