From 9f9353542801538b36e30ec3471a2e48716110ea Mon Sep 17 00:00:00 2001 From: David Anderson Date: Wed, 14 Oct 2009 19:11:11 +0000 Subject: [PATCH] - client: bug fixes to the above. Don't fetch work for an unable resource. svn path=/trunk/boinc/; revision=19302 --- checkin_notes | 9 +++++++++ client/cpu_sched.cpp | 18 +++++++++++------- client/cs_scheduler.cpp | 3 +++ client/work_fetch.cpp | 23 +++++++++++++---------- 4 files changed, 36 insertions(+), 17 deletions(-) diff --git a/checkin_notes b/checkin_notes index 13dd8f875a..b860aec8a5 100644 --- a/checkin_notes +++ b/checkin_notes @@ -8656,3 +8656,12 @@ David 14 Oct 2009 coproc.cpp,h sched/ sched_locality.cpp + +David 14 Oct 2009 + - client: bug fixes to the above. + Don't fetch work for an unable resource. + + client/ + cpu_sched.cpp + cs_scheduler.cpp + work_fetch.cpp diff --git a/client/cpu_sched.cpp b/client/cpu_sched.cpp index a15ba17532..a74102a244 100644 --- a/client/cpu_sched.cpp +++ b/client/cpu_sched.cpp @@ -191,35 +191,39 @@ struct PROC_RESOURCES { // see whether there's been a change in coproc usability; // if so set or clear "coproc_missing" flags and return true. // +#include "filesys.h" bool check_coproc_usable(COPROC* cp) { - int i; + unsigned int i; + bool is_cuda = (cp==coproc_cuda); + bool new_usable = cp->is_usable(); + //bool new_usable = !boinc_file_exists("unusable"); if (cp->usable) { - if (!cp->is_usable()) { + if (!new_usable) { cp->usable = false; for (i=0; iavp->ncudas) { + if (is_cuda?rp->avp->ncudas:rp->avp->natis) { rp->coproc_missing = true; } } msg_printf(NULL, MSG_INFO, "%s GPU has become unusable; disabling tasks", - cp==coproc_cuda?"NVIDIA":"ATI" + is_cuda?"NVIDIA":"ATI" ); return true; } } else { - if (cp->is_usable()) { + if (new_usable) { cp->usable = true; for (i=0; iavp->ncudas) { + if (is_cuda?rp->avp->ncudas:rp->avp->natis) { rp->coproc_missing = false; } } msg_printf(NULL, MSG_INFO, "%s GPU has become usable; enabling tasks", - cp==coproc_cuda?"NVIDIA":"ATI" + is_cuda?"NVIDIA":"ATI" ); return true; } diff --git a/client/cs_scheduler.cpp b/client/cs_scheduler.cpp index 9d85669c5c..01ac42e560 100644 --- a/client/cs_scheduler.cpp +++ b/client/cs_scheduler.cpp @@ -833,8 +833,11 @@ int CLIENT_STATE::handle_scheduler_reply(PROJECT* project, char* scheduler_url) rp->set_state(RESULT_NEW, "handle_scheduler_reply"); if (rp->avp->ncudas) { est_cuda_duration += rp->estimated_duration(false); + coproc_cuda->usable = true; + // trigger a check of whether GPU is actually usable } else if (rp->avp->natis) { est_ati_duration += rp->estimated_duration(false); + coproc_ati->usable = true; } else { est_cpu_duration += rp->estimated_duration(false); } diff --git a/client/work_fetch.cpp b/client/work_fetch.cpp index 62250f37cf..22dc1e02e3 100644 --- a/client/work_fetch.cpp +++ b/client/work_fetch.cpp @@ -284,10 +284,10 @@ PROJECT* RSC_WORK_FETCH::choose_project(int criterion) { void WORK_FETCH::set_shortfall_requests(PROJECT* p) { cpu_work_fetch.set_shortfall_request(p); - if (coproc_cuda) { + if (coproc_cuda && coproc_cuda->usable) { cuda_work_fetch.set_shortfall_request(p); } - if (coproc_ati) { + if (coproc_ati && coproc_ati->usable) { ati_work_fetch.set_shortfall_request(p); } } @@ -480,28 +480,31 @@ PROJECT* WORK_FETCH::choose_project() { gstate.rr_simulation(); set_overall_debts(); - if (coproc_cuda) { + bool cuda_usable = coproc_cuda && coproc_cuda->usable; + bool ati_usable = coproc_ati && coproc_ati->usable; + + if (cuda_usable) { p = cuda_work_fetch.choose_project(FETCH_IF_IDLE_INSTANCE); } - if (coproc_ati) { + if (ati_usable) { p = ati_work_fetch.choose_project(FETCH_IF_IDLE_INSTANCE); } if (!p) { p = cpu_work_fetch.choose_project(FETCH_IF_IDLE_INSTANCE); } - if (!p && coproc_cuda) { + if (!p && cuda_usable) { p = cuda_work_fetch.choose_project(FETCH_IF_MAJOR_SHORTFALL); } - if (!p && coproc_ati) { + if (!p && ati_usable) { p = ati_work_fetch.choose_project(FETCH_IF_MAJOR_SHORTFALL); } if (!p) { p = cpu_work_fetch.choose_project(FETCH_IF_MAJOR_SHORTFALL); } - if (!p && coproc_cuda) { + if (!p && cuda_usable) { p = cuda_work_fetch.choose_project(FETCH_IF_MINOR_SHORTFALL); } - if (!p && coproc_ati) { + if (!p && ati_usable) { p = ati_work_fetch.choose_project(FETCH_IF_MINOR_SHORTFALL); } if (!p) { @@ -511,10 +514,10 @@ PROJECT* WORK_FETCH::choose_project() { // don't try to maintain GPU work for all projects, // since we don't use round-robin scheduling for GPUs // - if (!p && coproc_cuda) { + if (!p && cuda_usable) { p = cuda_work_fetch.choose_project(FETCH_IF_PROJECT_STARVED); } - if (!p && coproc_ati) { + if (!p && ati_usable) { p = ati_work_fetch.choose_project(FETCH_IF_PROJECT_STARVED); } #endif