diff --git a/checkin_notes b/checkin_notes index 9ebcb9ccf3..ae5992bdaf 100644 --- a/checkin_notes +++ b/checkin_notes @@ -2647,3 +2647,11 @@ David 4 Mar 2009 client/ cs_scheduler.cpp scheduler_op.cpp + +David 4 Mar 2009 + - scheduler: use simpler variables in HOST_USAGE + + sched/ + server_types.cpp,h + sched_send.cpp + sched_plan.cpp diff --git a/sched/sched_plan.cpp b/sched/sched_plan.cpp index 12c96a54d5..6b2ca656e4 100644 --- a/sched/sched_plan.cpp +++ b/sched/sched_plan.cpp @@ -138,10 +138,8 @@ int app_plan(SCHEDULER_REQUEST& sreq, char* plan_class, HOST_USAGE& hu) { hu.avg_ncpus = x; hu.max_ncpus = x; - COPROC* cu = new COPROC (cp->type); - cu->count = 1; - hu.coprocs.coprocs.push_back(cu); - // + hu.ncudas = 1; + if (config.debug_version_select) { log_messages.printf(MSG_NORMAL, "[version] CUDA app estimated %.2f GFLOPS (clock %d count %d)\n", diff --git a/sched/sched_send.cpp b/sched/sched_send.cpp index 85b4ae9632..7d805aba34 100644 --- a/sched/sched_send.cpp +++ b/sched/sched_send.cpp @@ -161,7 +161,7 @@ BEST_APP_VERSION* get_app_version(WORKUNIT& wu) { // delete record, fall through, and find another version // if (g_wreq->rsc_spec_request - && bavp->host_usage.cuda_instances() > 0 + && bavp->host_usage.ncudas > 0 && !g_wreq->need_cuda() ) { g_wreq->best_app_versions.erase(bavi); @@ -261,7 +261,7 @@ BEST_APP_VERSION* get_app_version(WORKUNIT& wu) { // for new-style requests, check that the app version is relevant // if (g_wreq->rsc_spec_request) { - if (host_usage.cuda_instances()) { + if (host_usage.ncudas) { if (!g_wreq->need_cuda()) { if (config.debug_version_select) { log_messages.printf(MSG_NORMAL, @@ -718,7 +718,7 @@ static inline bool hard_app(APP& app) { } static inline double get_estimated_delay(BEST_APP_VERSION& bav) { - if (bav.host_usage.cuda_instances()) { + if (bav.host_usage.ncudas) { return g_request->coproc_cuda->estimated_delay; } else { return g_request->cpu_estimated_delay; @@ -726,7 +726,7 @@ static inline double get_estimated_delay(BEST_APP_VERSION& bav) { } static inline void update_estimated_delay(BEST_APP_VERSION& bav, double dt) { - if (bav.host_usage.cuda_instances()) { + if (bav.host_usage.ncudas) { g_request->coproc_cuda->estimated_delay += dt; } else { g_request->cpu_estimated_delay += dt; @@ -911,7 +911,7 @@ int add_wu_to_reply( // add the app, app_version, and workunit to the reply, // but only if they aren't already there // - if (avp) { + if (!bavp->anonymous_platform) { APP_VERSION av2=*avp, *avp2=&av2; if (strlen(config.replace_download_url_by_timezone)) { @@ -1209,10 +1209,9 @@ int add_result_to_reply( result.bavp = bavp; g_reply->insert_result(result); if (g_wreq->rsc_spec_request) { - double cuda_instances = bavp->host_usage.cuda_instances(); - if (cuda_instances) { + if (bavp->host_usage.ncudas) { g_wreq->cuda_req_secs -= est_dur; - g_wreq->cuda_req_instances -= cuda_instances; + g_wreq->cuda_req_instances -= bavp->host_usage.ncudas; } else { g_wreq->cpu_req_secs -= est_dur; g_wreq->cpu_req_instances -= bavp->host_usage.avg_ncpus; diff --git a/sched/server_types.cpp b/sched/server_types.cpp index 70a6134cc4..1a3357c7b9 100644 --- a/sched/server_types.cpp +++ b/sched/server_types.cpp @@ -894,15 +894,13 @@ int APP_VERSION::write(FILE* fout) { bavp->host_usage.cmdline ); } - for (i=0; ihost_usage.coprocs.coprocs.size(); i++) { - COPROC* cp = bavp->host_usage.coprocs.coprocs[i]; + if (bavp->host_usage.ncudas) { fprintf(fout, " \n" - " %s\n" + " CUDA\n" " %d\n" " \n", - cp->type, - cp->count + bavp->host_usage.ncudas ); } fputs("\n", fout); diff --git a/sched/server_types.h b/sched/server_types.h index d57ce4b9c1..ffdfd51aea 100644 --- a/sched/server_types.h +++ b/sched/server_types.h @@ -61,33 +61,27 @@ struct USER_MESSAGE { }; struct HOST_USAGE { - COPROCS coprocs; + int ncudas; double avg_ncpus; double max_ncpus; double flops; char cmdline[256]; - HOST_USAGE() { - coprocs.coprocs.clear(); + ncudas = 0; avg_ncpus = 1; max_ncpus = 1; flops = 0; strcpy(cmdline, ""); } void sequential_app(double x) { - coprocs.coprocs.clear(); + ncudas = 0; avg_ncpus = 1; max_ncpus = 1; flops = x; if (flops <= 0) flops = 1e9; strcpy(cmdline, ""); } - double cuda_instances() { - COPROC* cp = coprocs.lookup("CUDA"); - if (cp) return cp->count; - return 0; - } ~HOST_USAGE(){} }; @@ -97,6 +91,7 @@ struct BEST_APP_VERSION { int appid; APP_VERSION* avp; // NULL if none exists HOST_USAGE host_usage; + bool anonymous_platform; // client has app_version }; // summary of a client's request for work, and our response to it