File indexing completed on 2025-08-07 08:11:46
0001
0002
0003
0004
0005
0006
0007
0008
0009 #include "CommandLineArguments.h"
0010
0011 #include "Acts/Plugins/Sycl/Utilities/ListPlatforms.hpp"
0012
0013 #include <fstream>
0014 #include <iostream>
0015
0016 #include <boost/program_options.hpp>
0017 #include <boost/type_erasure/any_cast.hpp>
0018
0019 namespace po = boost::program_options;
0020
0021 void CommandLineArguments::parse(int argc, char** argv) {
0022 po::options_description optionsDescription("Allowed options");
0023 optionsDescription.add_options()("help,h", "Print usage message.")(
0024 "FILE,f", po::value<std::string>()->default_value(""),
0025 "Provide path for input file.")(
0026 "NUM,n", po::value<unsigned int>()->default_value(500),
0027 "Number of groups to iterate in seed finding.")(
0028 "DEVICE,d", po::value<std::string>()->default_value(""),
0029 "Provide a substring of the preferred device.")(
0030 "LIST,l", "List available SYCL platforms and devices.")(
0031 "GPU,G", po::bool_switch(), "Execute code only on gpu. Default is 0.")(
0032 "ALL,a", po::bool_switch(), "Analyze all groups. Default is 0.")(
0033 "MATCH,m", po::bool_switch(), "Count seed matches. Default is 0.")(
0034 "CSV,c", po::bool_switch(), "Output results in csv format");
0035
0036 po::variables_map vm;
0037 po::store(po::parse_command_line(argc, argv, optionsDescription), vm);
0038 po::notify(vm);
0039
0040 if (vm.count("help") != 0) {
0041 std::cout << optionsDescription << "\n";
0042 exit(0);
0043 }
0044
0045 if (vm.count("LIST") != 0) {
0046 Acts::Sycl::listPlatforms();
0047 exit(0);
0048 }
0049
0050 onlyGpu = vm["GPU"].as<bool>();
0051 matches = vm["MATCH"].as<bool>();
0052 groups = vm["NUM"].as<unsigned int>();
0053 deviceName = vm["DEVICE"].as<std::string>();
0054 allgroup = vm["ALL"].as<bool>();
0055 csvFormat = vm["CSV"].as<bool>();
0056 inpFileName = vm["FILE"].as<std::string>();
0057 std::ifstream s(inpFileName);
0058 inpFileExists = s.good();
0059 }