From 0bf6ddb2fd76cb92bc43dda7f73b425de422e68b Mon Sep 17 00:00:00 2001 From: David Anderson Date: Fri, 5 Jun 2009 21:11:50 +0000 Subject: [PATCH] - scheduler: improve example app plan function for multithread svn path=/trunk/boinc/; revision=18315 --- checkin_notes | 6 ++++++ sched/sched_plan.cpp | 22 +++++++++++++--------- sched/sched_plan.h | 1 + 3 files changed, 20 insertions(+), 9 deletions(-) diff --git a/checkin_notes b/checkin_notes index 180ef278d3..918c848533 100644 --- a/checkin_notes +++ b/checkin_notes @@ -5131,3 +5131,9 @@ Charlie 5 June 2009 BOINCClientManager.cpp, .h win_build/ boincmgr.vcproj + +David 5 June 2009 + - scheduler: improve example app plan function for multithread + + sched/ + sched_plan.cpp,h diff --git a/sched/sched_plan.cpp b/sched/sched_plan.cpp index e488476c89..e1d0010296 100644 --- a/sched/sched_plan.cpp +++ b/sched/sched_plan.cpp @@ -34,19 +34,20 @@ int app_plan(SCHEDULER_REQUEST& sreq, char* plan_class, HOST_USAGE& hu) { if (!strcmp(plan_class, "mt")) { - // the following is for an app that can use anywhere - // from 1 to 64 threads, can control this exactly, - // and whose speedup is .95N - // (on a uniprocessor, we'll use a sequential app if one is available) + // the following is for an app that: + // - can use from 1 to 64 threads, can control this exactly + // - if it uses N threads, will use .65N cores on average + // (hence on a uniprocessor we'll use a sequential app + // if one is available) // - int nthreads; - - nthreads = effective_ncpus(); + double ncpus = effective_ncpus(); // take prefs into account + int nthreads = (int)(ncpus/.65); + if (!nthreads) return PLAN_REJECT_INSUFFICIENT_CPUS; if (nthreads > 64) nthreads = 64; - hu.avg_ncpus = nthreads; + hu.avg_ncpus = nthreads*.65; hu.max_ncpus = nthreads; sprintf(hu.cmdline, "--nthreads %d", nthreads); - hu.flops = 0.95*sreq.host.p_fpops*nthreads; + hu.flops = sreq.host.p_fpops*hu.avg_ncpus; if (config.debug_version_select) { log_messages.printf(MSG_NORMAL, "[version] Multi-thread app estimate %.2f GFLOPS\n", @@ -146,6 +147,9 @@ int app_plan(SCHEDULER_REQUEST& sreq, char* plan_class, HOST_USAGE& hu) { return PLAN_REJECT_UNKNOWN; } +// the following is used to enforce limits on in-progress jobs +// for GPUs and CPUs (see handle_request.cpp) +// bool app_plan_uses_gpu(const char* plan_class) { if (!strcmp(plan_class, "cuda")) { return true; diff --git a/sched/sched_plan.h b/sched/sched_plan.h index 8621acadb2..8fd2c51ac6 100644 --- a/sched/sched_plan.h +++ b/sched/sched_plan.h @@ -26,6 +26,7 @@ #define PLAN_REJECT_CUDA_MEM 5 #define PLAN_REJECT_CUDA_SPEED 6 #define PLAN_REJECT_UNKNOWN 7 +#define PLAN_REJECT_INSUFFICIENT_CPUS 8 #define PLAN_CUDA_MIN_DRIVER_VERSION 17700 #define PLAN_CUDA_MIN_RAM (254*1024*1024)