31void validate(boost::any&
v,
const std::vector<std::string>& values, severity_level*,
int)
34 static const std::unordered_map<std::string, severity_level> levels{
35 {
"trace", severity_level::trace}, {
"debug", severity_level::debug}, {
"status", severity_level::status},
36 {
"info", severity_level::info}, {
"warning", severity_level::warning}, {
"error", severity_level::error},
37 {
"fatal", severity_level::fatal}};
39 po::validators::check_first_occurrence(
v);
41 const std::string& s = po::validators::get_single_string(values);
43 auto it = levels.find(s);
45 if (it == levels.end())
throw po::validation_error(po::validation_error::invalid_option_value);
54 po::options_description required(
"Required options");
56 required.add_options()
57 (
"param-dir,p", po::value(&
fParamsDir)->value_name(
"<folder>")->required(),
58 "read program options from this folder")
59 (
"input-locator,i", po::value(&
fInputLocator)->value_name(
"<locator>")->required(),
60 "URI specifying input timeslice source")
64 po::options_description
generic(
"Other options");
67 (
"output,o", po::value(&
fOutputFile)->default_value(
"")->value_name(
"<file>"),
68 "write results to file")
69 (
"device,d", po::value(&
fDevice)->default_value(
"cpu")->value_name(
"<device>"),
70 "select device (cpu, cuda0, cuda1, hip0, ...)")
71#ifndef CBM_ONLINE_USE_FAIRLOGGER
72 (
"log-level,l", po::value(&
fLogLevel)->default_value(info)->value_name(
"<level>"),
73 "set log level (debug, info, warning, error, fatal)")
75 (
"monitor,m", po::value(&
fMonitorUri)->value_name(
"<uri>")->implicit_value(
"file:cout"),
76 "URI specifying monitor output (e.g. file:/tmp/monitor.txt, influx1:login:8086:cbmreco_status). Prints to cout when no argument is given. Monitor is disabled when flag is not set.")
77 (
"histogram", po::value(&
fHistogramUri)->value_name(
"<uri>"),
"URI to specify histogram server")
78 (
"histoshwm", po::value(&
fHistogramHwm)->default_value(1)->value_name(
"<num>"),
79 "High-Water Mark for ZMQ socket to histogram server in messages:\n"
80 " 0 = no buffering, num = nb updates kept in buffer if not pulled by server \n"
81 " Tune to avoid too high memory usage but also adapt to server load!")
82 (
"aux-data", po::value(&
fCollectAuxData)->implicit_value(
true),
"Enables collecting of auxiliary data from algorithms")
84 "space separated list of QA Steps to enable (BeamBmon, UnpackSts, EventBuilding, Tracking, ...)")
85#ifdef BOOST_IOS_HAS_ZSTD
87 "enables ZSTD compression of the outgoing histograms stream (decompression needed in target server!)")
89 (
"log-file,L", po::value(&
fLogFile)->value_name(
"<file>"),
90 "write log messages to file")
91 (
"output-types,O", po::value(&
fOutputTypes)->multitoken()->value_name(
"<types>"),
92 "space separated list of reconstruction output types (Hit, Tracks, DigiTimeslice, DigiEvent, ...)")
93 (
"compress-archive", po::bool_switch(&
fCompressArchive)->default_value(
false),
"Enable compression for output archives")
95 "space separated list of reconstruction steps (unpack, digitrigger, localreco, ...)")
96 (
"systems,s", po::value(&
fDetectors)->multitoken()->default_value({Subsystem::STS, Subsystem::TOF, Subsystem::BMON, Subsystem::MUCH, Subsystem::RICH, Subsystem::TRD, Subsystem::TRD2D})->value_name(
"<detectors>"),
97 "space separated list of detectors to process (sts, mvd, ...)")
98 (
"child-id,c", po::value(&
fChildId)->default_value(
"00")->value_name(
"<id>"),
"online process id on node")
99 (
"run-id,r", po::value(&
fRunId)->default_value(2391)->value_name(
"<RunId>"),
"Run ID, for now flesctl run index, later run start time")
100 (
"run-start", po::value(&
fRunStartTime)->default_value(0)->value_name(
"<RunStart >"),
"Run start time in ns, can be fles start or online start")
101 (
"num-ts,n", po::value(&
fNumTimeslices)->default_value(-1)->value_name(
"<num>"),
102 "Stop after <num> timeslices (-1 = all)")
103 (
"skip-ts", po::value(&
fSkipTimeslices)->default_value(0)->value_name(
"<num>"),
104 "Skip first <num> timeslices")
105 (
"omp", po::value(&
fNumOMPThreads)->default_value(-1)->value_name(
"<num>"),
106 "Set number of OpenMP threads (-1 = use OMP_NUM_THREADS environment variable)")
108 "Print kernel times (Can opt. be given a value: Use none to disable or summary to only print aggregated times.)")
109 (
"timings-file", po::value(&
fTimingsFile)->value_name(
"<file>"),
110 "Write profiling times to yaml file (only when '-t' is set)")
111 (
"dump-archive", po::bool_switch(&
fDumpArchive)->default_value(
false),
112 "Dump archive content to stdout and exit. Provide archive with '-i'. (This is a hack to quick check archive content until we have proper tooling.)")
113 (
"release-mode,R",po::value<bool>(&
fReleaseMode)->implicit_value(
true),
114 "Copy and release each timeslice immediately after receiving it")
116 "produce help message")
120 po::options_description cmdline_options;
121 cmdline_options.add(required).add(generic);
123 po::variables_map vm;
124 po::command_line_parser parser{argc, argv};
125 parser.options(cmdline_options);
127 auto result = parser.run();
128 po::store(result, vm);
130 catch (
const std::exception& e) {
131 std::cerr <<
"Error: " << e.what() << std::endl;
132 std::cerr <<
"Use '-h' to display all valid options." << std::endl;
133 std::exit(EXIT_FAILURE);
136 if (vm.count(
"help") > 0) {
137 std::cout << cmdline_options << std::endl;
138 std::exit(EXIT_SUCCESS);
144 catch (
const po::required_option& e) {
145 std::cerr <<
"Error: " << e.what() << std::endl;
146 std::cerr <<
"Use '-h' to display all valid options." << std::endl;
147 std::exit(EXIT_FAILURE);