From 31541e166d9626fd5a60ec49db965341d0a29f73 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Sat, 9 Aug 2014 21:44:39 -0700 Subject: [PATCH] client: set work requests for coprocs specified in cc_config.xml We weren't copying the request fields from RSC_WORK_FETCH to COPROC. Do this, and clean up the code a bit. Note: the arrays that parallel the COPROCS::coprocs array are a bit of a kludge; that stuff logically belongs in COPROC. But it's specific to the client, so I can't put it there. Maybe I could do something fancy with derived classes, not sure. --- client/cs_scheduler.cpp | 24 ++---------------------- client/work_fetch.cpp | 27 +++++++++++++++++++++++++++ client/work_fetch.h | 2 ++ lib/coproc.cpp | 27 +++++++++++++-------------- 4 files changed, 44 insertions(+), 36 deletions(-) diff --git a/client/cs_scheduler.cpp b/client/cs_scheduler.cpp index ead7e56a8b..9a275255d3 100644 --- a/client/cs_scheduler.cpp +++ b/client/cs_scheduler.cpp @@ -227,28 +227,8 @@ int CLIENT_STATE::make_scheduler_request(PROJECT* p) { total_disk_usage, p->disk_usage, p->disk_share ); - // copy request values from RSC_WORK_FETCH to COPROC - // - int j = rsc_index(GPU_TYPE_NVIDIA); - if (j > 0) { - coprocs.nvidia.req_secs = rsc_work_fetch[j].req_secs; - coprocs.nvidia.req_instances = rsc_work_fetch[j].req_instances; - coprocs.nvidia.estimated_delay = rsc_work_fetch[j].req_secs?rsc_work_fetch[j].busy_time_estimator.get_busy_time():0; - } - j = rsc_index(GPU_TYPE_ATI); - if (j > 0) { - coprocs.ati.req_secs = rsc_work_fetch[j].req_secs; - coprocs.ati.req_instances = rsc_work_fetch[j].req_instances; - coprocs.ati.estimated_delay = rsc_work_fetch[j].req_secs?rsc_work_fetch[j].busy_time_estimator.get_busy_time():0; - } - j = rsc_index(GPU_TYPE_INTEL); - if (j > 0) { - coprocs.intel_gpu.req_secs = rsc_work_fetch[j].req_secs; - coprocs.intel_gpu.req_instances = rsc_work_fetch[j].req_instances; - coprocs.intel_gpu.estimated_delay = rsc_work_fetch[j].req_secs?rsc_work_fetch[j].busy_time_estimator.get_busy_time():0; - } - if (coprocs.n_rsc > 1) { + work_fetch.copy_requests(); coprocs.write_xml(mf, true); } @@ -303,7 +283,7 @@ int CLIENT_STATE::make_scheduler_request(PROJECT* p) { // send descriptions of app versions // fprintf(f, "\n"); - j=0; + int j=0; for (i=0; iproject != p) continue; diff --git a/client/work_fetch.cpp b/client/work_fetch.cpp index 68bb047e24..63dd0c4908 100644 --- a/client/work_fetch.cpp +++ b/client/work_fetch.cpp @@ -148,6 +148,12 @@ void RSC_PROJECT_WORK_FETCH::resource_backoff(PROJECT* p, const char* name) { /////////////// RSC_WORK_FETCH /////////////// +void RSC_WORK_FETCH::copy_request(COPROC& c) { + c.req_secs = req_secs; + c.req_instances = req_instances; + c.estimated_delay = req_secs?busy_time_estimator.get_busy_time():0; +} + RSC_PROJECT_WORK_FETCH& RSC_WORK_FETCH::project_state(PROJECT* p) { return p->rsc_pwf[rsc_type]; } @@ -423,6 +429,27 @@ void WORK_FETCH::set_all_requests(PROJECT* p) { } #endif +// copy request fields from RSC_WORK_FETCH to COPROCS +// +void WORK_FETCH::copy_requests() { + for (int i=0; i\n"); - if (nvidia.count) { - nvidia.write_xml(mf, scheduler_rpc); - } - if (ati.count) { - ati.write_xml(mf, scheduler_rpc); - } - if (intel_gpu.count) { - intel_gpu.write_xml(mf, scheduler_rpc); - } for (int i=1; i\n");