- client: reorganize and improve the logic for deciding

when to do a scheduler RPC:
    if user request or acct mgr request, ignore backoff and suspend via GUI;
    in all other cases honor both of these.

svn path=/trunk/boinc/; revision=17504
This commit is contained in:
David Anderson 2009-03-05 00:10:16 +00:00
parent c750daed46
commit 8544b20886
5 changed files with 24 additions and 26 deletions

View File

@ -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

View File

@ -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",

View File

@ -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;

View File

@ -894,15 +894,13 @@ int APP_VERSION::write(FILE* fout) {
bavp->host_usage.cmdline
);
}
for (i=0; i<bavp->host_usage.coprocs.coprocs.size(); i++) {
COPROC* cp = bavp->host_usage.coprocs.coprocs[i];
if (bavp->host_usage.ncudas) {
fprintf(fout,
" <coproc>\n"
" <type>%s</type>\n"
" <type>CUDA</type>\n"
" <count>%d</count>\n"
" </coproc>\n",
cp->type,
cp->count
bavp->host_usage.ncudas
);
}
fputs("</app_version>\n", fout);

View File

@ -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