From e8657adfd2f8ac4234e3a1af3b8738df17bdd979 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Sun, 8 Jan 2012 01:28:39 +0000 Subject: [PATCH] - scheduler: change vbox_mt app plan function to use 1, 2 or 3 CPUs depending on how many the host has, and whether CPU VM extensions are present (this reflects the requirements of CernVM). svn path=/trunk/boinc/; revision=25009 --- checkin_notes | 13 +++++++++++++ db/boinc_db.h | 4 +--- sched/sched_customize.cpp | 25 ++++++++++++++----------- sched/sched_types.h | 8 ++++---- sched/validator.cpp | 6 ++++++ 5 files changed, 38 insertions(+), 18 deletions(-) diff --git a/checkin_notes b/checkin_notes index 11183f69aa..212f0660f1 100644 --- a/checkin_notes +++ b/checkin_notes @@ -277,3 +277,16 @@ Rom 7 Jan 2012 samples/vboxwrapper/ vbox.cpp, .h vboxwrapper.cpp, .h + +David 7 Jan 2012 + - scheduler: change vbox_mt app plan function to use 1, 2 or 3 CPUs + depending on how many the host has, + and whether CPU VM extensions are present + (this reflects the requirements of CernVM). + + db/ + boinc_db.h + sched/ + sched_types.h + sched_customize.cpp + validator.cpp diff --git a/db/boinc_db.h b/db/boinc_db.h index 5bbb8bdd66..efa5f32161 100644 --- a/db/boinc_db.h +++ b/db/boinc_db.h @@ -548,9 +548,7 @@ struct RESULT { double elapsed_time; // AKA runtime; returned by 6.10+ clients double flops_estimate; - // misnomer: actually the peak device FLOPS, - // returned by app_plan() - // An adjusted version of this is sent to clients. + // misnomer: actually the peak device FLOPS, returned by app_plan(). int app_version_id; // ID of app version used to compute this // 0 if unknown (relic of old scheduler) diff --git a/sched/sched_customize.cpp b/sched/sched_customize.cpp index 287ec1d9be..6996ac2eea 100644 --- a/sched/sched_customize.cpp +++ b/sched/sched_customize.cpp @@ -514,9 +514,15 @@ static inline bool app_plan_opencl( } } +// handles vbox_[32|64][_mt] +// "mt" is tailored to the needs of CERN: +// use 1, 2 or 3 CPUs + static inline bool app_plan_vbox( SCHEDULER_REQUEST& sreq, char* plan_class, HOST_USAGE& hu ) { + bool can_use_multicore = true; + // host must have VirtualBox 3.2 or later // if (strlen(sreq.host.virtualbox_version) == 0) return false; @@ -528,14 +534,12 @@ static inline bool app_plan_vbox( // host must have VM acceleration in order to run multi-core jobs // - if (strstr(plan_class, "mt") - && (!strstr(sreq.host.p_features, "vmx") - && !strstr(sreq.host.p_features, "svm")) - ) { - return false; - } - if (strstr(plan_class, "mt") && sreq.host.p_vm_extensions_disabled) { - return false; + if (strstr(plan_class, "mt")) { + if ((!strstr(sreq.host.p_features, "vmx") && !strstr(sreq.host.p_features, "svm")) + || sreq.host.p_vm_extensions_disabled + ) { + can_use_multicore = false; + } } // only send the version for host's primary platform. @@ -549,12 +553,11 @@ static inline bool app_plan_vbox( if (strstr(plan_class, "64")) return false; } - if (strstr(plan_class, "mt")) { + if (strstr(plan_class, "mt") && can_use_multicore) { double ncpus = g_wreq->effective_ncpus; // number of usable CPUs, taking user prefs into account - if (ncpus < 2) return false; int nthreads = (int)ncpus; - if (nthreads > 2) nthreads = 2; + if (nthreads > 3) nthreads = 3; hu.avg_ncpus = nthreads; sprintf(hu.cmdline, "--nthreads %d", nthreads); } else { diff --git a/sched/sched_types.h b/sched/sched_types.h index bf00bac471..68822801f3 100644 --- a/sched/sched_types.h +++ b/sched/sched_types.h @@ -84,15 +84,15 @@ struct HOST_USAGE { peak_flops = 0; strcpy(cmdline, ""); } - void sequential_app(double x) { + void sequential_app(double flops) { ncudas = 0; natis = 0; gpu_ram = 0; avg_ncpus = 1; max_ncpus = 1; - if (x <= 0) x = 1e9; - projected_flops = x; - peak_flops = x; + if (flops <= 0) flops = 1e9; + projected_flops = flops; + peak_flops = flops; strcpy(cmdline, ""); } inline bool is_sequential_app() { diff --git a/sched/validator.cpp b/sched/validator.cpp index a4cb2e043b..310052400f 100644 --- a/sched/validator.cpp +++ b/sched/validator.cpp @@ -413,6 +413,11 @@ int handle_wu( runtime = max_runtime; } credit = result.flops_estimate * runtime * COBBLESTONE_SCALE; + log_messages.printf(MSG_NORMAL, + "[WU#%d][RESULT#%d] credit_from_runtime %.2f = %.0fs * %.2fGFLOPS\n", + wu.id, result.id, + credit, runtime, result.flops_estimate/1e9 + ); break; } } @@ -688,6 +693,7 @@ int main(int argc, char** argv) { " --max_granted_credit X Grant no more than this amount of credit to a result\n" " --update_credited_job Add record to credited_job table after granting credit\n" " --credit_from_wu Credit is specified in WU XML\n" + " --credit_from_runtime X Grant credit based on runtime (max X seconds)and estimated FLOPS\n" " --no_credit Don't grant credit\n" " --sleep_interval n Set sleep-interval to n\n" " -d n, --debug_level n Set log verbosity level, 1-4\n"