- client: restore support for max_ncpus preference.

This and max_ncpus_pct can both be specified.
    If both are specified, we take the min.

svn path=/trunk/boinc/; revision=16268
This commit is contained in:
David Anderson 2008-10-22 21:25:26 +00:00
parent a899b9c079
commit 760cd90c7b
6 changed files with 42 additions and 4 deletions

View File

@ -8563,3 +8563,18 @@ David 22 Oct 2008
html/inc/
uotd.inc
boinc_db.inc
David 22 Oct 2008
- client: restore support for max_ncpus preference.
This and max_ncpus_pct can both be specified.
If both are specified, we take the min.
client/
cpu_sched.cpp
html/
ops/
index.php
project.sample/
project.inc
lib/
prefs.cpp,h

View File

@ -1631,12 +1631,19 @@ void CLIENT_STATE::set_ncpus() {
if (config.ncpus>0) {
ncpus = config.ncpus;
} else if (host_info.p_ncpus>0) {
ncpus = (int)((host_info.p_ncpus * global_prefs.max_ncpus_pct)/100);
if (ncpus == 0) ncpus = 1;
ncpus = host_info.p_ncpus;
} else {
ncpus = 1;
}
if (global_prefs.max_ncpus_pct) {
ncpus = (int)((host_info.p_ncpus * global_prefs.max_ncpus_pct)/100);
}
if (ncpus == 0) ncpus = 1;
if (global_prefs.max_ncpus && global_prefs.max_ncpus < ncpus) {
ncpus = global_prefs.max_ncpus;
}
if (initialized && ncpus != ncpus_old) {
msg_printf(0, MSG_INFO,
"Number of usable CPUs has changed from %d to %d. Running benchmarks.",

View File

@ -51,6 +51,7 @@ if (file_exists("../cache/remote.revision")
$context = stream_context_create(
array(
'http' => array(
'request_fulluri' = true,
'proxy' => $project_http_proxy
)
)

View File

@ -26,7 +26,7 @@ define("POST_REPORT_EMAILS", "moderator1@$master_url|moderator2@$master_url");
// set the following var if your project is behind a proxy.
// This is used on ops/index.php to get the current SVN rev from BOINC
//$project_http_proxy = "http://host.domain:port"
//$project_http_proxy = "tcp://proxyname:port"
function project_banner($title, $prefix) {
// Put your project title and logo here

View File

@ -58,6 +58,7 @@ void GLOBAL_PREFS_MASK::set_all() {
work_buf_min_days = true;
work_buf_additional_days = true;
max_ncpus_pct = true;
max_ncpus= true;
cpu_scheduling_period_minutes = true;
disk_interval = true;
disk_max_used_gb = true;
@ -88,6 +89,7 @@ bool GLOBAL_PREFS_MASK::are_prefs_set() {
if (work_buf_min_days) return true;
if (work_buf_additional_days) return true;
if (max_ncpus_pct) return true;
if (max_ncpus) return true;
if (cpu_scheduling_period_minutes) return true;
if (disk_interval) return true;
if (disk_max_used_gb) return true;
@ -278,7 +280,8 @@ void GLOBAL_PREFS::defaults() {
dont_verify_images = false;
work_buf_min_days = 0.1;
work_buf_additional_days = 0.25;
max_ncpus_pct = 100;
max_ncpus_pct = 0;
max_ncpus = 0;
cpu_scheduling_period_minutes = 60;
disk_interval = 60;
disk_max_used_gb = 10;
@ -510,6 +513,10 @@ int GLOBAL_PREFS::parse_override(
mask.max_ncpus_pct = true;
continue;
}
if (xp.parse_int(tag, "max_ncpus", max_ncpus)) {
if (max_ncpus < 0) max_ncpus = 0;
mask.max_ncpus = true;
}
if (xp.parse_double(tag, "disk_interval", disk_interval)) {
if (disk_interval<0) disk_interval = 0;
mask.disk_interval = true;
@ -658,6 +665,9 @@ int GLOBAL_PREFS::write(MIOFILE& f) {
max_bytes_sec_down,
cpu_usage_limit
);
if (max_ncpus) {
f.printf(" <max_ncpus>%d<</max_ncpus>\n", max_ncpus);
}
for (int i=0; i<7; i++) {
TIME_SPAN* cpu = cpu_times.week.get(i);
@ -750,6 +760,9 @@ int GLOBAL_PREFS::write_subset(MIOFILE& f, GLOBAL_PREFS_MASK& mask) {
if (mask.max_ncpus_pct) {
f.printf(" <max_ncpus_pct>%f</max_ncpus_pct>\n", max_ncpus_pct);
}
if (mask.max_ncpus) {
f.printf(" <max_ncpus>%d</max_ncpus>\n", max_ncpus);
}
if (mask.cpu_scheduling_period_minutes) {
f.printf(" <cpu_scheduling_period_minutes>%f</cpu_scheduling_period_minutes>\n", cpu_scheduling_period_minutes);
}

View File

@ -50,6 +50,7 @@ struct GLOBAL_PREFS_MASK {
bool work_buf_min_days;
bool work_buf_additional_days;
bool max_ncpus_pct;
bool max_ncpus;
bool cpu_scheduling_period_minutes;
bool disk_interval;
bool disk_max_used_gb;
@ -144,6 +145,7 @@ struct GLOBAL_PREFS {
double work_buf_min_days;
double work_buf_additional_days;
double max_ncpus_pct;
int max_ncpus;
double cpu_scheduling_period_minutes;
double disk_interval;
double disk_max_used_gb;