2008-08-06 18:36:30 +00:00
|
|
|
// This file is part of BOINC.
|
2005-01-20 23:22:22 +00:00
|
|
|
// http://boinc.berkeley.edu
|
2008-08-06 18:36:30 +00:00
|
|
|
// Copyright (C) 2008 University of California
|
2004-07-13 13:54:09 +00:00
|
|
|
//
|
2008-08-06 18:36:30 +00:00
|
|
|
// BOINC is free software; you can redistribute it and/or modify it
|
|
|
|
// under the terms of the GNU Lesser General Public License
|
|
|
|
// as published by the Free Software Foundation,
|
|
|
|
// either version 3 of the License, or (at your option) any later version.
|
2004-07-13 13:54:09 +00:00
|
|
|
//
|
2008-08-06 18:36:30 +00:00
|
|
|
// BOINC is distributed in the hope that it will be useful,
|
2005-01-20 23:22:22 +00:00
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
// See the GNU Lesser General Public License for more details.
|
2002-04-30 22:22:54 +00:00
|
|
|
//
|
2008-08-06 18:36:30 +00:00
|
|
|
// You should have received a copy of the GNU Lesser General Public License
|
|
|
|
// along with BOINC. If not, see <http://www.gnu.org/licenses/>.
|
2002-04-30 22:22:54 +00:00
|
|
|
|
2003-10-16 19:03:49 +00:00
|
|
|
#include "cpp.h"
|
2004-03-04 11:41:43 +00:00
|
|
|
|
|
|
|
#ifdef _WIN32
|
2004-06-16 23:16:08 +00:00
|
|
|
#include "boinc_win.h"
|
2009-08-22 17:00:19 +00:00
|
|
|
#ifdef _MSC_VER
|
|
|
|
#define chdir _chdir
|
|
|
|
#endif
|
2010-05-11 19:10:29 +00:00
|
|
|
#else
|
2005-11-21 18:34:44 +00:00
|
|
|
#include "config.h"
|
2004-07-13 13:54:09 +00:00
|
|
|
#include <cstdio>
|
|
|
|
#include <cstring>
|
2007-10-10 15:57:59 +00:00
|
|
|
#include <unistd.h>
|
2004-03-04 11:41:43 +00:00
|
|
|
#endif
|
2002-04-30 22:22:54 +00:00
|
|
|
|
2006-09-01 21:06:30 +00:00
|
|
|
#include "common_defs.h"
|
2010-12-09 23:27:11 +00:00
|
|
|
#include "diagnostics.h"
|
|
|
|
#include "error_numbers.h"
|
|
|
|
#include "filesys.h"
|
2002-04-30 22:22:54 +00:00
|
|
|
#include "parse.h"
|
2008-02-07 17:46:56 +00:00
|
|
|
#include "str_util.h"
|
2002-04-30 22:22:54 +00:00
|
|
|
|
2009-12-05 00:51:05 +00:00
|
|
|
#include "file_names.h"
|
|
|
|
#include "client_state.h"
|
|
|
|
#include "client_msgs.h"
|
|
|
|
#include "cs_proxy.h"
|
|
|
|
|
2007-10-20 16:10:57 +00:00
|
|
|
using std::string;
|
|
|
|
|
2002-04-30 22:22:54 +00:00
|
|
|
LOG_FLAGS log_flags;
|
2006-05-21 21:11:28 +00:00
|
|
|
CONFIG config;
|
2002-04-30 22:22:54 +00:00
|
|
|
|
2006-09-07 17:38:54 +00:00
|
|
|
static void show_flag(char* buf, bool flag, const char* flag_name) {
|
|
|
|
if (!flag) return;
|
2006-09-07 18:19:25 +00:00
|
|
|
int n = (int)strlen(buf);
|
2006-09-07 17:38:54 +00:00
|
|
|
if (!n) {
|
|
|
|
strcpy(buf, flag_name);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
strcat(buf, ", ");
|
|
|
|
strcat(buf, flag_name);
|
|
|
|
if (strlen(buf) > 60) {
|
|
|
|
msg_printf(NULL, MSG_INFO, "log flags: %s", buf);
|
|
|
|
strcpy(buf, "");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void LOG_FLAGS::show() {
|
|
|
|
char buf[256];
|
|
|
|
strcpy(buf, "");
|
|
|
|
show_flag(buf, file_xfer, "file_xfer");
|
|
|
|
show_flag(buf, sched_ops, "sched_ops");
|
2009-09-16 20:05:36 +00:00
|
|
|
show_flag(buf, task, "task");
|
|
|
|
|
|
|
|
show_flag(buf, app_msg_receive, "app_msg_receive");
|
|
|
|
show_flag(buf, app_msg_send, "app_msg_send");
|
|
|
|
show_flag(buf, benchmark_debug, "benchmark_debug");
|
|
|
|
show_flag(buf, checkpoint_debug, "checkpoint_debug");
|
|
|
|
show_flag(buf, coproc_debug, "coproc_debug");
|
2006-09-07 17:38:54 +00:00
|
|
|
show_flag(buf, cpu_sched, "cpu_sched");
|
|
|
|
show_flag(buf, cpu_sched_debug, "cpu_sched_debug");
|
2009-11-28 00:07:39 +00:00
|
|
|
show_flag(buf, cpu_sched_status, "cpu_sched_status");
|
2009-09-16 20:05:36 +00:00
|
|
|
show_flag(buf, dcf_debug, "dcf_debug");
|
2011-10-19 06:37:03 +00:00
|
|
|
show_flag(buf, priority_debug, "priority_debug");
|
2006-09-07 17:38:54 +00:00
|
|
|
show_flag(buf, file_xfer_debug, "file_xfer_debug");
|
2010-04-29 20:32:51 +00:00
|
|
|
show_flag(buf, gui_rpc_debug, "gui_rpc_debug");
|
2011-04-14 01:04:10 +00:00
|
|
|
show_flag(buf, heartbeat_debug, "heartbeat_debug");
|
2006-09-07 17:38:54 +00:00
|
|
|
show_flag(buf, http_debug, "http_debug");
|
|
|
|
show_flag(buf, http_xfer_debug, "http_xfer_debug");
|
|
|
|
show_flag(buf, mem_usage_debug, "mem_usage_debug");
|
|
|
|
show_flag(buf, network_status_debug, "network_status_debug");
|
2009-09-16 20:05:36 +00:00
|
|
|
show_flag(buf, poll_debug, "poll_debug");
|
|
|
|
show_flag(buf, proxy_debug, "proxy_debug");
|
|
|
|
show_flag(buf, rr_simulation, "rr_simulation");
|
|
|
|
show_flag(buf, sched_op_debug, "sched_op_debug");
|
|
|
|
show_flag(buf, scrsave_debug, "scrsave_debug");
|
2009-05-28 19:26:27 +00:00
|
|
|
show_flag(buf, slot_debug, "slot_debug");
|
2009-09-16 20:05:36 +00:00
|
|
|
show_flag(buf, state_debug, "state_debug");
|
|
|
|
show_flag(buf, statefile_debug, "statefile_debug");
|
2009-11-28 00:07:39 +00:00
|
|
|
show_flag(buf, std_debug, "std_debug");
|
2009-09-16 20:05:36 +00:00
|
|
|
show_flag(buf, task_debug, "task_debug");
|
|
|
|
show_flag(buf, time_debug, "time_debug");
|
|
|
|
show_flag(buf, unparsed_xml, "unparsed_xml");
|
|
|
|
show_flag(buf, work_fetch_debug, "work_fetch_debug");
|
2009-12-22 23:00:55 +00:00
|
|
|
show_flag(buf, notice_debug, "notice_debug");
|
2009-09-16 20:05:36 +00:00
|
|
|
|
2006-09-07 17:38:54 +00:00
|
|
|
if (strlen(buf)) {
|
|
|
|
msg_printf(NULL, MSG_INFO, "log flags: %s", buf);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-11-12 23:44:49 +00:00
|
|
|
static void show_gpu_ignore(vector<int>& devs, const char* name) {
|
|
|
|
for (unsigned int i=0; i<devs.size(); i++) {
|
|
|
|
msg_printf(NULL, MSG_INFO, "Config: ignoring %s GPU %d", name, devs[i]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-09-26 23:34:40 +00:00
|
|
|
static void show_exclude_gpu(EXCLUDE_GPU& e) {
|
2011-11-14 23:31:12 +00:00
|
|
|
char t[256], app_name[256], dev[256];
|
2011-09-26 23:34:40 +00:00
|
|
|
PROJECT *p = gstate.lookup_project(e.url.c_str());
|
|
|
|
if (!p) return;
|
|
|
|
if (e.type.empty()) {
|
|
|
|
strcpy(t, "all");
|
|
|
|
} else {
|
|
|
|
strcpy(t, e.type.c_str());
|
|
|
|
}
|
|
|
|
if (e.appname.empty()) {
|
2011-11-14 23:31:12 +00:00
|
|
|
strcpy(app_name, "all");
|
2011-09-26 23:34:40 +00:00
|
|
|
} else {
|
2011-11-14 23:31:12 +00:00
|
|
|
strcpy(app_name, e.appname.c_str());
|
2011-09-26 23:34:40 +00:00
|
|
|
}
|
|
|
|
if (e.device_num < 0) {
|
|
|
|
strcpy(dev, "all");
|
|
|
|
} else {
|
|
|
|
sprintf(dev, "%d", e.device_num);
|
|
|
|
}
|
|
|
|
msg_printf(p, MSG_INFO,
|
|
|
|
"Config: excluded GPU. Type: %s. App: %s. Device: %s",
|
2011-11-14 23:31:12 +00:00
|
|
|
t, app_name, dev
|
2011-09-26 23:34:40 +00:00
|
|
|
);
|
2011-11-14 23:31:12 +00:00
|
|
|
if (!e.appname.empty()) {
|
|
|
|
APP* app = gstate.lookup_app(p, e.appname.c_str());
|
|
|
|
if (!app) {
|
|
|
|
string app_list;
|
|
|
|
for (unsigned int i=0; i<gstate.apps.size(); i++) {
|
|
|
|
app = gstate.apps[i];
|
|
|
|
if (app->project != p) continue;
|
2011-11-14 23:45:08 +00:00
|
|
|
if (!app_list.empty()) {
|
|
|
|
app_list += ", ";
|
|
|
|
}
|
|
|
|
app_list += "'";
|
2011-11-14 23:31:12 +00:00
|
|
|
app_list += app->name;
|
2011-11-14 23:45:08 +00:00
|
|
|
app_list += "'";
|
2011-11-14 23:31:12 +00:00
|
|
|
}
|
|
|
|
msg_printf(p, MSG_USER_ALERT,
|
|
|
|
"A GPU exclusion in your cc_config.xml file specifies a non-existent application '%s'. Existing applications: %s",
|
|
|
|
e.appname.c_str(),
|
|
|
|
app_list.c_str()
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
2011-09-26 23:34:40 +00:00
|
|
|
}
|
|
|
|
|
2011-11-14 23:31:12 +00:00
|
|
|
// Print config info.
|
|
|
|
// This is called during startup (after client_state.xml has been read)
|
|
|
|
// and also from the handle_read_cc_config GUI RPC.
|
|
|
|
//
|
2009-04-07 20:02:49 +00:00
|
|
|
// TODO: show other config options
|
|
|
|
//
|
|
|
|
void CONFIG::show() {
|
2009-11-13 21:57:25 +00:00
|
|
|
unsigned int i;
|
2010-04-07 21:11:15 +00:00
|
|
|
if (ncpus>0) {
|
2009-11-17 21:38:44 +00:00
|
|
|
msg_printf(NULL, MSG_INFO, "Config: simulate %d CPUs", config.ncpus);
|
2009-09-26 05:23:05 +00:00
|
|
|
}
|
2010-04-07 21:11:15 +00:00
|
|
|
if (no_gpus) {
|
2009-09-26 05:23:05 +00:00
|
|
|
msg_printf(NULL, MSG_INFO, "Config: don't use coprocessors");
|
2009-04-07 20:02:49 +00:00
|
|
|
}
|
2010-09-27 20:34:47 +00:00
|
|
|
if (no_info_fetch) {
|
|
|
|
msg_printf(NULL, MSG_INFO, "Config: don't fetch project list or client version info");
|
|
|
|
}
|
2010-04-07 21:11:15 +00:00
|
|
|
if (no_priority_change) {
|
2009-09-26 05:23:05 +00:00
|
|
|
msg_printf(NULL, MSG_INFO, "Config: run apps at regular priority");
|
|
|
|
}
|
2010-04-07 21:11:15 +00:00
|
|
|
if (report_results_immediately) {
|
2009-09-26 05:23:05 +00:00
|
|
|
msg_printf(NULL, MSG_INFO, "Config: report completed tasks immediately");
|
2009-04-07 20:02:49 +00:00
|
|
|
}
|
2010-04-07 21:11:15 +00:00
|
|
|
if (use_all_gpus) {
|
2009-09-26 05:23:05 +00:00
|
|
|
msg_printf(NULL, MSG_INFO, "Config: use all coprocessors");
|
|
|
|
}
|
2010-04-07 21:11:15 +00:00
|
|
|
if (zero_debts) {
|
2009-09-26 05:23:05 +00:00
|
|
|
msg_printf(NULL, MSG_INFO, "Config: zero long-term debts on startup");
|
2009-04-27 23:51:46 +00:00
|
|
|
}
|
2010-06-02 17:50:47 +00:00
|
|
|
if (fetch_minimal_work) {
|
|
|
|
msg_printf(NULL, MSG_INFO, "Config: fetch minimal work");
|
|
|
|
}
|
2011-08-31 11:08:13 +00:00
|
|
|
show_gpu_ignore(ignore_nvidia_dev, GPU_TYPE_NVIDIA);
|
|
|
|
show_gpu_ignore(ignore_ati_dev, GPU_TYPE_ATI);
|
2011-09-26 23:34:40 +00:00
|
|
|
for (i=0; i<exclude_gpus.size(); i++) {
|
|
|
|
show_exclude_gpu(exclude_gpus[i]);
|
|
|
|
}
|
2009-11-13 21:57:25 +00:00
|
|
|
for (i=0; i<exclusive_apps.size(); i++) {
|
|
|
|
msg_printf(NULL, MSG_INFO,
|
|
|
|
"Config: don't compute while %s is running",
|
|
|
|
exclusive_apps[i].c_str()
|
|
|
|
);
|
|
|
|
}
|
|
|
|
for (i=0; i<exclusive_gpu_apps.size(); i++) {
|
|
|
|
msg_printf(NULL, MSG_INFO,
|
|
|
|
"Config: don't use GPUs while %s is running",
|
|
|
|
exclusive_gpu_apps[i].c_str()
|
|
|
|
);
|
|
|
|
}
|
2010-04-07 21:11:15 +00:00
|
|
|
if (allow_remote_gui_rpc) {
|
|
|
|
msg_printf(NULL, MSG_INFO,
|
|
|
|
"Config: GUI RPC allowed from any host"
|
|
|
|
);
|
|
|
|
}
|
|
|
|
FILE* f = fopen(REMOTEHOST_FILE_NAME, "r");
|
|
|
|
if (f) {
|
|
|
|
msg_printf(NULL, MSG_INFO,
|
|
|
|
"Config: GUI RPC allowed from:"
|
|
|
|
);
|
|
|
|
char buf[256];
|
|
|
|
while (fgets(buf, 256, f)) {
|
|
|
|
strip_whitespace(buf);
|
|
|
|
if (!(buf[0] =='#' || buf[0] == ';') && strlen(buf) > 0 ) {
|
|
|
|
msg_printf(NULL, MSG_INFO,
|
|
|
|
"Config: %s", buf
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
fclose(f);
|
|
|
|
}
|
2007-04-26 21:57:42 +00:00
|
|
|
}
|
|
|
|
|
2011-11-14 23:31:12 +00:00
|
|
|
// This is used by the BOINC client.
|
|
|
|
// KEEP IN SYNCH WITH CONFIG::parse_options()!!
|
|
|
|
|
2011-04-25 03:18:26 +00:00
|
|
|
int CONFIG::parse_options_client(XML_PARSER& xp) {
|
2011-08-10 17:11:08 +00:00
|
|
|
char path[256];
|
2007-10-20 16:10:57 +00:00
|
|
|
string s;
|
2011-03-25 03:44:09 +00:00
|
|
|
int n, retval;
|
2006-08-21 22:25:21 +00:00
|
|
|
|
2009-12-03 19:09:45 +00:00
|
|
|
//clear();
|
2009-12-22 23:13:11 +00:00
|
|
|
// don't do this here because some options are set by cmdline args,
|
2009-12-03 19:09:45 +00:00
|
|
|
// which are parsed first
|
2009-12-22 23:13:11 +00:00
|
|
|
// but do clear these, which aren't accessable via cmdline:
|
|
|
|
//
|
|
|
|
alt_platforms.clear();
|
|
|
|
exclusive_apps.clear();
|
|
|
|
exclusive_gpu_apps.clear();
|
2011-06-24 03:58:52 +00:00
|
|
|
ignore_nvidia_dev.clear();
|
2009-12-22 23:13:11 +00:00
|
|
|
ignore_ati_dev.clear();
|
2009-12-03 19:09:45 +00:00
|
|
|
|
2011-08-10 17:11:08 +00:00
|
|
|
while (!xp.get_tag()) {
|
|
|
|
if (!xp.is_tag) {
|
2010-10-18 20:09:51 +00:00
|
|
|
msg_printf_notice(NULL, false,
|
2010-07-21 19:04:46 +00:00
|
|
|
"http://boinc.berkeley.edu/manager_links.php?target=notice&controlid=config",
|
2010-08-04 18:41:24 +00:00
|
|
|
"%s: %s",
|
|
|
|
_("Unexpected text in cc_config.xml"),
|
2011-08-10 17:11:08 +00:00
|
|
|
xp.parsed_tag
|
2006-08-21 22:25:21 +00:00
|
|
|
);
|
|
|
|
continue;
|
|
|
|
}
|
2011-08-10 17:11:08 +00:00
|
|
|
if (xp.match_tag("/options")) {
|
2006-07-11 22:52:17 +00:00
|
|
|
return 0;
|
2006-08-21 22:25:21 +00:00
|
|
|
}
|
2011-08-10 17:11:08 +00:00
|
|
|
if (xp.parse_bool("abort_jobs_on_exit", abort_jobs_on_exit)) continue;
|
|
|
|
if (xp.parse_bool("allow_multiple_clients", allow_multiple_clients)) continue;
|
|
|
|
if (xp.parse_bool("allow_remote_gui_rpc", allow_remote_gui_rpc)) continue;
|
|
|
|
if (xp.parse_string("alt_platform", s)) {
|
2007-10-20 16:10:57 +00:00
|
|
|
alt_platforms.push_back(s);
|
2007-10-22 23:56:10 +00:00
|
|
|
continue;
|
2007-10-20 16:10:57 +00:00
|
|
|
}
|
2011-08-10 17:11:08 +00:00
|
|
|
if (xp.parse_string("client_download_url", client_download_url)) {
|
2009-09-16 20:05:36 +00:00
|
|
|
downcase_string(client_download_url);
|
|
|
|
continue;
|
|
|
|
}
|
2011-08-10 17:11:08 +00:00
|
|
|
if (xp.parse_string("client_version_check_url", client_version_check_url)) {
|
2009-09-16 20:05:36 +00:00
|
|
|
downcase_string(client_version_check_url);
|
|
|
|
continue;
|
|
|
|
}
|
2011-08-10 17:11:08 +00:00
|
|
|
if (xp.match_tag("coproc")) {
|
2011-03-25 03:44:09 +00:00
|
|
|
COPROC c;
|
|
|
|
retval = c.parse(xp);
|
|
|
|
if (retval) {
|
2011-11-14 23:45:08 +00:00
|
|
|
msg_printf_notice(NULL, false, NULL,
|
|
|
|
"Can't parse <coproc> element in cc_config.xml"
|
2011-03-25 03:44:09 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
retval = coprocs.add(c);
|
|
|
|
if (retval) {
|
2011-11-14 23:45:08 +00:00
|
|
|
msg_printf_notice(NULL, false, NULL,
|
|
|
|
"Duplicate <coproc> element in cc_config.xml"
|
2011-03-25 03:44:09 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
continue;
|
|
|
|
}
|
2011-08-10 17:11:08 +00:00
|
|
|
if (xp.parse_str("data_dir", path, sizeof(path))) {
|
2007-08-16 17:33:41 +00:00
|
|
|
if (chdir(path)) {
|
|
|
|
perror("chdir");
|
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
continue;
|
|
|
|
}
|
2011-08-10 17:11:08 +00:00
|
|
|
if (xp.parse_bool("disallow_attach", disallow_attach)) continue;
|
|
|
|
if (xp.parse_bool("dont_check_file_sizes", dont_check_file_sizes)) continue;
|
|
|
|
if (xp.parse_bool("dont_contact_ref_site", dont_contact_ref_site)) continue;
|
2011-11-14 23:31:12 +00:00
|
|
|
if (xp.match_tag("exclude_gpu")) {
|
|
|
|
EXCLUDE_GPU eg;
|
|
|
|
retval = eg.parse(xp);
|
|
|
|
if (retval) {
|
2011-11-14 23:45:08 +00:00
|
|
|
msg_printf_notice(NULL, false, NULL,
|
|
|
|
"Can't parse <exclude_gpu> element in cc_config.xml"
|
2011-11-14 23:31:12 +00:00
|
|
|
);
|
|
|
|
} else {
|
|
|
|
exclude_gpus.push_back(eg);
|
|
|
|
}
|
|
|
|
continue;
|
|
|
|
}
|
2011-08-10 17:11:08 +00:00
|
|
|
if (xp.parse_string("exclusive_app", s)) {
|
2010-10-20 23:45:49 +00:00
|
|
|
if (!strstr(s.c_str(), "boinc")) {
|
|
|
|
exclusive_apps.push_back(s);
|
|
|
|
}
|
2008-09-29 16:47:10 +00:00
|
|
|
continue;
|
|
|
|
}
|
2011-08-10 17:11:08 +00:00
|
|
|
if (xp.parse_string("exclusive_gpu_app", s)) {
|
2010-10-20 23:45:49 +00:00
|
|
|
if (!strstr(s.c_str(), "boinc")) {
|
|
|
|
exclusive_gpu_apps.push_back(s);
|
|
|
|
}
|
2009-11-13 17:49:18 +00:00
|
|
|
continue;
|
|
|
|
}
|
2011-08-10 17:11:08 +00:00
|
|
|
if (xp.parse_bool("exit_after_finish", exit_after_finish)) continue;
|
2011-11-15 07:50:02 +00:00
|
|
|
if (xp.parse_bool("exit_before_start", exit_before_start)) continue;
|
2011-08-10 17:11:08 +00:00
|
|
|
if (xp.parse_bool("exit_when_idle", exit_when_idle)) {
|
2010-10-01 19:54:09 +00:00
|
|
|
if (exit_when_idle) {
|
|
|
|
report_results_immediately = true;
|
|
|
|
}
|
2010-06-02 18:09:05 +00:00
|
|
|
continue;
|
|
|
|
}
|
2011-08-10 17:11:08 +00:00
|
|
|
if (xp.parse_bool("fetch_minimal_work", fetch_minimal_work)) continue;
|
|
|
|
if (xp.parse_string("force_auth", force_auth)) {
|
2009-09-16 20:05:36 +00:00
|
|
|
downcase_string(force_auth);
|
2008-10-14 23:07:40 +00:00
|
|
|
continue;
|
|
|
|
}
|
2011-08-10 17:11:08 +00:00
|
|
|
if (xp.parse_bool("http_1_0", http_1_0)) continue;
|
2011-11-15 07:50:02 +00:00
|
|
|
if (xp.parse_int("http_transfer_timeout", http_transfer_timeout)) continue;
|
|
|
|
if (xp.parse_int("http_transfer_timeout_bps", http_transfer_timeout_bps)) continue;
|
2011-08-10 17:11:08 +00:00
|
|
|
if (xp.parse_int("ignore_cuda_dev", n)||xp.parse_int("ignore_nvidia_dev", n)) {
|
2011-06-24 03:58:52 +00:00
|
|
|
ignore_nvidia_dev.push_back(n);
|
2009-11-12 23:44:49 +00:00
|
|
|
continue;
|
|
|
|
}
|
2011-08-10 17:11:08 +00:00
|
|
|
if (xp.parse_int("ignore_ati_dev", n)) {
|
2009-11-12 23:44:49 +00:00
|
|
|
ignore_ati_dev.push_back(n);
|
|
|
|
continue;
|
|
|
|
}
|
2011-08-10 17:11:08 +00:00
|
|
|
if (xp.parse_int("max_file_xfers", max_file_xfers)) continue;
|
|
|
|
if (xp.parse_int("max_file_xfers_per_project", max_file_xfers_per_project)) continue;
|
|
|
|
if (xp.parse_int("max_stderr_file_size", max_stderr_file_size)) continue;
|
|
|
|
if (xp.parse_int("max_stdout_file_size", max_stdout_file_size)) continue;
|
|
|
|
if (xp.parse_int("max_tasks_reported", max_tasks_reported)) continue;
|
|
|
|
if (xp.parse_int("ncpus", ncpus)) continue;
|
|
|
|
if (xp.parse_string("network_test_url", network_test_url)) {
|
2008-10-14 23:07:40 +00:00
|
|
|
downcase_string(network_test_url);
|
|
|
|
continue;
|
|
|
|
}
|
2011-08-10 17:11:08 +00:00
|
|
|
if (xp.parse_bool("no_alt_platform", no_alt_platform)) continue;
|
|
|
|
if (xp.parse_bool("no_gpus", no_gpus)) continue;
|
|
|
|
if (xp.parse_bool("no_info_fetch", no_info_fetch)) continue;
|
|
|
|
if (xp.parse_bool("no_priority_change", no_priority_change)) continue;
|
|
|
|
if (xp.parse_bool("os_random_only", os_random_only)) continue;
|
2009-02-26 01:00:46 +00:00
|
|
|
#ifndef SIM
|
2011-08-10 17:11:08 +00:00
|
|
|
if (xp.match_tag("proxy_info")) {
|
2011-08-09 21:44:14 +00:00
|
|
|
retval = config_proxy_info.parse_config(xp);
|
2011-11-14 23:31:12 +00:00
|
|
|
if (retval) {
|
2011-11-14 23:45:08 +00:00
|
|
|
msg_printf_notice(NULL, false, NULL,
|
|
|
|
"Can't parse <proxy_info> element in cc_config.xml"
|
2011-11-14 23:31:12 +00:00
|
|
|
);
|
|
|
|
}
|
2009-11-09 23:25:04 +00:00
|
|
|
continue;
|
2009-02-25 19:18:41 +00:00
|
|
|
}
|
2009-02-26 01:00:46 +00:00
|
|
|
#endif
|
2011-11-14 23:31:12 +00:00
|
|
|
if (xp.parse_double("rec_half_life_days", rec_half_life)) {
|
|
|
|
if (rec_half_life <= 0) rec_half_life = 10;
|
|
|
|
rec_half_life *= 86400;
|
|
|
|
continue;
|
|
|
|
}
|
2011-08-10 17:11:08 +00:00
|
|
|
if (xp.parse_bool("report_results_immediately", report_results_immediately)) continue;
|
|
|
|
if (xp.parse_bool("run_apps_manually", run_apps_manually)) continue;
|
|
|
|
if (xp.parse_int("save_stats_days", save_stats_days)) continue;
|
|
|
|
if (xp.parse_bool("simple_gui_only", simple_gui_only)) continue;
|
|
|
|
if (xp.parse_bool("skip_cpu_benchmarks", skip_cpu_benchmarks)) continue;
|
|
|
|
if (xp.parse_double("start_delay", start_delay)) continue;
|
|
|
|
if (xp.parse_bool("stderr_head", stderr_head)) continue;
|
|
|
|
if (xp.parse_bool("suppress_net_info", suppress_net_info)) continue;
|
|
|
|
if (xp.parse_bool("unsigned_apps_ok", unsigned_apps_ok)) continue;
|
|
|
|
if (xp.parse_bool("use_all_gpus", use_all_gpus)) continue;
|
|
|
|
if (xp.parse_bool("use_certs", use_certs)) continue;
|
|
|
|
if (xp.parse_bool("use_certs_only", use_certs_only)) continue;
|
|
|
|
if (xp.parse_bool("zero_debts", zero_debts)) continue;
|
2009-09-16 20:05:36 +00:00
|
|
|
|
2010-10-18 20:09:51 +00:00
|
|
|
msg_printf_notice(NULL, false,
|
2010-07-21 19:04:46 +00:00
|
|
|
"http://boinc.berkeley.edu/manager_links.php?target=notice&controlid=config",
|
2010-08-04 18:41:24 +00:00
|
|
|
"%s: <%s>",
|
|
|
|
_("Unrecognized tag in cc_config.xml"),
|
2011-08-10 17:11:08 +00:00
|
|
|
xp.parsed_tag
|
2007-06-08 07:55:27 +00:00
|
|
|
);
|
2011-08-10 17:11:08 +00:00
|
|
|
xp.skip_unexpected(true, "CONFIG::parse_options");
|
2006-07-11 22:52:17 +00:00
|
|
|
}
|
|
|
|
return ERR_XML_PARSE;
|
|
|
|
}
|
|
|
|
|
2011-04-25 03:18:26 +00:00
|
|
|
int CONFIG::parse_client(FILE* f) {
|
2006-08-22 21:52:44 +00:00
|
|
|
MIOFILE mf;
|
|
|
|
XML_PARSER xp(&mf);
|
2006-08-21 22:25:21 +00:00
|
|
|
|
2006-08-22 21:52:44 +00:00
|
|
|
mf.init_file(f);
|
2006-09-11 19:03:00 +00:00
|
|
|
if (!xp.parse_start("cc_config")) {
|
2010-10-18 20:09:51 +00:00
|
|
|
msg_printf_notice(NULL, false,
|
2010-07-21 19:04:46 +00:00
|
|
|
"http://boinc.berkeley.edu/manager_links.php?target=notice&controlid=config",
|
2010-08-04 18:41:24 +00:00
|
|
|
"%s",
|
|
|
|
_("Missing start tag in cc_config.xml")
|
2010-06-08 23:37:44 +00:00
|
|
|
);
|
2006-09-11 19:03:00 +00:00
|
|
|
return ERR_XML_PARSE;
|
|
|
|
}
|
2011-08-10 17:11:08 +00:00
|
|
|
while (!xp.get_tag()) {
|
|
|
|
if (!xp.is_tag) {
|
2010-10-18 20:09:51 +00:00
|
|
|
msg_printf_notice(NULL, false,
|
2010-07-21 19:04:46 +00:00
|
|
|
"http://boinc.berkeley.edu/manager_links.php?target=notice&controlid=config",
|
2010-08-04 18:41:24 +00:00
|
|
|
"%s: %s",
|
|
|
|
_("Unexpected text in cc_config.xml"),
|
2011-08-10 17:11:08 +00:00
|
|
|
xp.parsed_tag
|
2006-08-21 22:25:21 +00:00
|
|
|
);
|
|
|
|
continue;
|
|
|
|
}
|
2011-08-10 17:11:08 +00:00
|
|
|
if (xp.match_tag("/cc_config")) return 0;
|
|
|
|
if (xp.match_tag("log_flags")) {
|
2006-08-21 22:25:21 +00:00
|
|
|
log_flags.parse(xp);
|
2006-05-21 21:11:28 +00:00
|
|
|
continue;
|
2007-06-11 21:30:26 +00:00
|
|
|
}
|
2011-08-10 17:11:08 +00:00
|
|
|
if (xp.match_tag("options")) {
|
2011-11-14 23:31:12 +00:00
|
|
|
int retval = parse_options_client(xp);
|
2011-09-08 18:55:55 +00:00
|
|
|
if (retval) {
|
|
|
|
msg_printf_notice(NULL, false,
|
|
|
|
"http://boinc.berkeley.edu/manager_links.php?target=notice&controlid=config",
|
2011-11-14 23:05:42 +00:00
|
|
|
"%s",
|
|
|
|
_("Error in cc_config.xml options")
|
2011-09-08 18:55:55 +00:00
|
|
|
);
|
|
|
|
}
|
2007-06-11 21:30:26 +00:00
|
|
|
continue;
|
2006-05-21 21:11:28 +00:00
|
|
|
}
|
2011-08-10 17:11:08 +00:00
|
|
|
if (xp.match_tag("options/")) continue;
|
|
|
|
if (xp.match_tag("log_flags/")) continue;
|
2010-10-18 20:09:51 +00:00
|
|
|
msg_printf_notice(NULL, false,
|
2010-07-21 19:04:46 +00:00
|
|
|
"http://boinc.berkeley.edu/manager_links.php?target=notice&controlid=config",
|
2010-08-04 18:41:24 +00:00
|
|
|
"%s: <%s>",
|
|
|
|
_("Unrecognized tag in cc_config.xml"),
|
2011-08-10 17:11:08 +00:00
|
|
|
xp.parsed_tag
|
2007-06-11 21:30:26 +00:00
|
|
|
);
|
2011-08-10 17:11:08 +00:00
|
|
|
xp.skip_unexpected(true, "CONFIG.parse");
|
2002-04-30 22:22:54 +00:00
|
|
|
}
|
2010-10-18 20:09:51 +00:00
|
|
|
msg_printf_notice(NULL, false,
|
2010-07-21 19:04:46 +00:00
|
|
|
"http://boinc.berkeley.edu/manager_links.php?target=notice&controlid=config",
|
2010-08-04 18:41:24 +00:00
|
|
|
"%s",
|
|
|
|
_("Missing end tag in cc_config.xml")
|
2010-06-08 23:37:44 +00:00
|
|
|
);
|
2002-04-30 22:22:54 +00:00
|
|
|
return ERR_XML_PARSE;
|
|
|
|
}
|
2002-08-12 23:18:47 +00:00
|
|
|
|
2011-11-14 23:31:12 +00:00
|
|
|
int CONFIG::parse(FILE* f) {
|
2011-04-25 03:18:26 +00:00
|
|
|
MIOFILE mf;
|
|
|
|
mf.init_file(f);
|
2011-08-09 21:44:14 +00:00
|
|
|
XML_PARSER xp(&mf);
|
2011-04-27 11:01:07 +00:00
|
|
|
|
2011-08-09 21:44:14 +00:00
|
|
|
return parse(xp, log_flags);
|
2011-04-25 03:18:26 +00:00
|
|
|
}
|
|
|
|
|
2010-10-07 21:41:31 +00:00
|
|
|
int read_config_file(bool init, const char* fname) {
|
2008-10-10 17:23:51 +00:00
|
|
|
if (!init) {
|
2010-10-07 21:41:31 +00:00
|
|
|
msg_printf(NULL, MSG_INFO, "Re-reading %s", fname);
|
2011-04-25 03:18:26 +00:00
|
|
|
config.defaults();
|
2011-01-25 19:05:44 +00:00
|
|
|
log_flags.init();
|
2008-10-10 17:23:51 +00:00
|
|
|
}
|
2010-10-07 21:41:31 +00:00
|
|
|
FILE* f = boinc_fopen(fname, "r");
|
2011-09-26 23:34:40 +00:00
|
|
|
if (!f) {
|
|
|
|
msg_printf(NULL, MSG_INFO, "No config file found - using defaults");
|
|
|
|
return ERR_FOPEN;
|
|
|
|
}
|
2011-11-14 23:31:12 +00:00
|
|
|
config.parse_client(f);
|
2006-06-21 22:08:20 +00:00
|
|
|
fclose(f);
|
2010-12-18 17:09:57 +00:00
|
|
|
#ifndef SIM
|
2010-12-09 23:27:11 +00:00
|
|
|
diagnostics_set_max_file_sizes(
|
|
|
|
config.max_stdout_file_size, config.max_stderr_file_size
|
|
|
|
);
|
2010-12-18 17:09:57 +00:00
|
|
|
#endif
|
2011-04-25 03:18:26 +00:00
|
|
|
if (init) {
|
|
|
|
coprocs = config.config_coprocs;
|
|
|
|
config_proxy_info = config.proxy_info;
|
|
|
|
if (strlen(config.data_dir)) {
|
|
|
|
#ifdef _WIN32
|
|
|
|
_chdir(config.data_dir);
|
|
|
|
#else
|
|
|
|
chdir(config.data_dir);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
}
|
2006-12-17 02:48:19 +00:00
|
|
|
return 0;
|
2002-08-12 23:18:47 +00:00
|
|
|
}
|
2004-12-08 00:40:19 +00:00
|
|
|
|
2011-10-03 06:18:58 +00:00
|
|
|
// Do stuff involving GPU exclusions.
|
|
|
|
// - Count excluded GPUS per project.
|
|
|
|
// NOTE: this is currently done just on the project level.
|
|
|
|
// Could do it at the app level also.
|
|
|
|
// - Flag app versions and results for which all GPUs are excluded
|
2011-10-01 16:23:28 +00:00
|
|
|
//
|
2011-10-03 06:18:58 +00:00
|
|
|
void process_gpu_exclusions() {
|
2011-10-01 16:23:28 +00:00
|
|
|
unsigned int i, j;
|
|
|
|
PROJECT *p;
|
|
|
|
|
|
|
|
for (i=0; i<gstate.projects.size(); i++) {
|
|
|
|
p = gstate.projects[i];
|
|
|
|
for (int k=1; k<coprocs.n_rsc; k++) {
|
|
|
|
int n=0;
|
|
|
|
COPROC& cp = coprocs.coprocs[k];
|
|
|
|
for (j=0; j<config.exclude_gpus.size(); j++) {
|
|
|
|
EXCLUDE_GPU& eg = config.exclude_gpus[j];
|
|
|
|
if (strcmp(eg.url.c_str(), p->master_url)) continue;
|
|
|
|
if (!eg.appname.empty()) continue;
|
|
|
|
if (!eg.type.empty() && (eg.type != cp.type)) continue;
|
|
|
|
if (eg.device_num >= 0) {
|
2011-10-03 03:29:58 +00:00
|
|
|
// exclusion may refer to nonexistent GPU
|
|
|
|
//
|
|
|
|
if (cp.device_num_exists(eg.device_num)) {
|
|
|
|
n++;
|
|
|
|
}
|
2011-10-01 16:23:28 +00:00
|
|
|
} else {
|
|
|
|
n = cp.count;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
p->ncoprocs_excluded[k] = n;
|
|
|
|
}
|
|
|
|
}
|
2011-10-03 06:18:58 +00:00
|
|
|
|
|
|
|
for (i=0; i<gstate.app_versions.size(); i++) {
|
|
|
|
APP_VERSION* avp = gstate.app_versions[i];
|
|
|
|
if (avp->missing_coproc) continue;
|
|
|
|
int rt = avp->gpu_usage.rsc_type;
|
|
|
|
if (!rt) continue;
|
|
|
|
COPROC& cp = coprocs.coprocs[rt];
|
|
|
|
bool found = false;
|
|
|
|
for (int k=0; k<cp.count; k++) {
|
|
|
|
if (!gpu_excluded(avp->app, cp, k)) {
|
|
|
|
found = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (found) continue;
|
|
|
|
avp->missing_coproc = true;
|
2011-11-03 22:27:20 +00:00
|
|
|
strcpy(avp->missing_coproc_name, "");
|
2011-10-03 06:18:58 +00:00
|
|
|
for (j=0; j<gstate.results.size(); j++) {
|
|
|
|
RESULT* rp = gstate.results[j];
|
|
|
|
if (rp->avp != avp) continue;
|
|
|
|
rp->coproc_missing = true;
|
|
|
|
msg_printf(avp->project, MSG_INFO,
|
|
|
|
"marking %s as coproc missing",
|
|
|
|
rp->name
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
bool gpu_excluded(APP* app, COPROC& cp, int ind) {
|
|
|
|
PROJECT* p = app->project;
|
|
|
|
for (unsigned int i=0; i<config.exclude_gpus.size(); i++) {
|
|
|
|
EXCLUDE_GPU& eg = config.exclude_gpus[i];
|
|
|
|
if (strcmp(eg.url.c_str(), p->master_url)) continue;
|
|
|
|
if (!eg.type.empty() && (eg.type != cp.type)) continue;
|
|
|
|
if (!eg.appname.empty() && (eg.appname != app->name)) continue;
|
|
|
|
if (eg.device_num >= 0 && eg.device_num != cp.device_nums[ind]) continue;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
2011-10-01 16:23:28 +00:00
|
|
|
}
|