cc_config.h 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274
  1. // This file is part of BOINC.
  2. // http://boinc.berkeley.edu
  3. // Copyright (C) 2018 University of California
  4. //
  5. // BOINC is free software; you can redistribute it and/or modify it
  6. // under the terms of the GNU Lesser General Public License
  7. // as published by the Free Software Foundation,
  8. // either version 3 of the License, or (at your option) any later version.
  9. //
  10. // BOINC is distributed in the hope that it will be useful,
  11. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  13. // See the GNU Lesser General Public License for more details.
  14. //
  15. // You should have received a copy of the GNU Lesser General Public License
  16. // along with BOINC. If not, see <http://www.gnu.org/licenses/>.
  17. // flags determining what is written to standard out.
  18. // (errors go to stderr)
  19. //
  20. // NOTE: all writes to stdout should have an if (log_flags.*) {} around them.
  21. //
  22. #ifndef BOINC_CC_CONFIG_H
  23. #define BOINC_CC_CONFIG_H
  24. #include <vector>
  25. #include <string>
  26. #include "proxy_info.h"
  27. #include "coproc.h"
  28. #define DEFAULT_MAX_EVENT_LOG_LINES 2000
  29. struct XML_PARSER;
  30. struct PROJECT;
  31. struct RESULT;
  32. #define MAX_FILE_XFERS_PER_PROJECT 2
  33. #define MAX_FILE_XFERS 8
  34. // kind of arbitrary
  35. struct LOG_FLAGS {
  36. // If you add anything, you must add it to parse() and write()
  37. // on by default; intended for all users
  38. //
  39. bool file_xfer;
  40. // file transfer start and finish
  41. bool sched_ops;
  42. // interactions with schedulers
  43. bool task;
  44. // task start and finish, and suspend/resume
  45. // off by default; intended for developers and testers
  46. //
  47. bool android_debug;
  48. // show Android-specific info (battery etc.)
  49. bool app_msg_receive;
  50. // show shared-mem message from apps
  51. bool app_msg_send;
  52. // show shared-mem message to apps
  53. bool async_file_debug;
  54. // show asynchronous file operations (copy, MD5, decompress)
  55. bool benchmark_debug;
  56. // debug CPU benchmarks
  57. bool checkpoint_debug;
  58. bool coproc_debug;
  59. // show coproc reserve/free and startup msgs
  60. bool cpu_sched;
  61. // preemption and resumption
  62. bool cpu_sched_debug;
  63. // explain scheduler decisions
  64. bool cpu_sched_status;
  65. // show what's running
  66. bool dcf_debug;
  67. // show changes to duration correction factors
  68. bool disk_usage_debug;
  69. // disk usage and project share info
  70. bool priority_debug;
  71. // info related to REC and scheduling priority
  72. bool file_xfer_debug;
  73. // show completion of FILE_XFER
  74. bool gui_rpc_debug;
  75. bool heartbeat_debug;
  76. bool http_debug;
  77. bool http_xfer_debug;
  78. bool idle_detection_debug;
  79. // show details leading to idle/not-idle determinations.
  80. bool mem_usage_debug;
  81. // memory usage
  82. bool network_status_debug;
  83. bool notice_debug;
  84. bool poll_debug;
  85. // show what polls are responding
  86. bool proxy_debug;
  87. bool rr_simulation;
  88. // results of RR sim
  89. bool rrsim_detail;
  90. // details of RR sim
  91. bool sched_op_debug;
  92. bool scrsave_debug;
  93. bool slot_debug;
  94. // allocation of slots
  95. bool state_debug;
  96. // print textual summary of CLIENT_STATE initially
  97. // and after each scheduler RPC and garbage collect
  98. // also show actions of garbage collector
  99. bool statefile_debug;
  100. // show when and why state file is written
  101. bool suspend_debug;
  102. // details of processing and network suspend/resume
  103. bool task_debug;
  104. // task start and control details, and when apps checkpoint
  105. bool time_debug;
  106. // changes in on_frac, active_frac, connected_frac
  107. bool trickle_debug;
  108. // show trickle messages
  109. bool unparsed_xml;
  110. // show unparsed XML lines
  111. bool work_fetch_debug;
  112. // work fetch policy
  113. LOG_FLAGS() {
  114. task = true;
  115. file_xfer = true;
  116. sched_ops = true;
  117. }
  118. void init();
  119. int parse(XML_PARSER&);
  120. void show();
  121. int write(MIOFILE& out);
  122. };
  123. struct EXCLUDE_GPU {
  124. std::string url;
  125. std::string type; // empty means all types
  126. std::string appname; // empty means all apps
  127. int device_num; // -1 means all instances
  128. int parse(XML_PARSER&);
  129. void write(MIOFILE&);
  130. };
  131. // if you add anything here, add it to
  132. // defaults(), parse_options(), parse_options_client(), write(),
  133. // and possibly show()
  134. //
  135. struct CC_CONFIG {
  136. bool abort_jobs_on_exit;
  137. bool allow_gui_rpc_get;
  138. bool allow_multiple_clients;
  139. bool allow_remote_gui_rpc;
  140. std::vector<std::string> alt_platforms;
  141. COPROCS config_coprocs;
  142. bool disallow_attach;
  143. bool dont_check_file_sizes;
  144. bool dont_contact_ref_site;
  145. bool dont_suspend_nci;
  146. bool dont_use_vbox;
  147. bool dont_use_wsl;
  148. std::vector<EXCLUDE_GPU> exclude_gpus;
  149. std::vector<std::string> exclusive_apps;
  150. std::vector<std::string> exclusive_gpu_apps;
  151. bool exit_after_finish;
  152. bool exit_before_start;
  153. bool exit_when_idle;
  154. bool fetch_minimal_work;
  155. bool fetch_on_update;
  156. std::string force_auth;
  157. bool http_1_0;
  158. int http_transfer_timeout_bps;
  159. int http_transfer_timeout;
  160. std::vector<int> ignore_gpu_instance[NPROC_TYPES];
  161. bool lower_client_priority;
  162. int max_event_log_lines;
  163. int max_file_xfers;
  164. int max_file_xfers_per_project;
  165. double max_stderr_file_size;
  166. double max_stdout_file_size;
  167. int max_tasks_reported;
  168. int ncpus;
  169. bool no_alt_platform;
  170. bool no_gpus;
  171. bool no_info_fetch;
  172. bool no_opencl;
  173. bool no_priority_change;
  174. bool os_random_only;
  175. int process_priority;
  176. int process_priority_special;
  177. PROXY_INFO proxy_info;
  178. double rec_half_life;
  179. bool report_results_immediately;
  180. bool run_apps_manually;
  181. int save_stats_days;
  182. bool skip_cpu_benchmarks;
  183. bool simple_gui_only;
  184. double start_delay;
  185. bool stderr_head;
  186. bool suppress_net_info;
  187. bool unsigned_apps_ok;
  188. bool use_all_gpus;
  189. bool use_certs;
  190. bool use_certs_only;
  191. // overrides use_certs
  192. bool vbox_window;
  193. std::vector<std::string> ignore_tty;
  194. std::string device_name;
  195. CC_CONFIG();
  196. void defaults();
  197. int parse(FILE*);
  198. int parse(XML_PARSER&, LOG_FLAGS&);
  199. int parse_client(FILE*);
  200. int parse_options(XML_PARSER&);
  201. int parse_options_client(XML_PARSER&);
  202. int write(MIOFILE&, LOG_FLAGS&);
  203. void show();
  204. };
  205. // Stuff related to app_config.xml
  206. typedef std::vector<std::string> MSG_VEC;
  207. struct APP_CONFIG {
  208. char name[256];
  209. int max_concurrent;
  210. double gpu_gpu_usage;
  211. double gpu_cpu_usage;
  212. bool fraction_done_exact;
  213. bool report_results_immediately;
  214. APP_CONFIG(){}
  215. int parse(XML_PARSER&, MSG_VEC&, LOG_FLAGS&);
  216. int parse_gpu_versions(XML_PARSER&, MSG_VEC&, LOG_FLAGS&);
  217. };
  218. struct APP_VERSION_CONFIG {
  219. char app_name[256];
  220. char plan_class[256];
  221. char cmdline[256];
  222. double avg_ncpus;
  223. double ngpus;
  224. APP_VERSION_CONFIG(){}
  225. int parse(XML_PARSER&, MSG_VEC&, LOG_FLAGS&);
  226. };
  227. struct APP_CONFIGS {
  228. std::vector<APP_CONFIG> app_configs;
  229. std::vector<APP_VERSION_CONFIG> app_version_configs;
  230. int project_max_concurrent;
  231. bool project_has_mc;
  232. // have app- or project-level max concurrent restriction
  233. int project_min_mc;
  234. // the min of these restrictions
  235. bool report_results_immediately;
  236. int parse(XML_PARSER&, MSG_VEC&, LOG_FLAGS&);
  237. int parse_file(FILE*, MSG_VEC&, LOG_FLAGS&);
  238. int config_app_versions(PROJECT*, bool show_warnings);
  239. void write(MIOFILE&);
  240. void clear() {
  241. app_configs.clear();
  242. app_version_configs.clear();
  243. project_max_concurrent = 0;
  244. project_has_mc = false;
  245. project_min_mc = 0;
  246. report_results_immediately = false;
  247. }
  248. };
  249. #endif