Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-07 08:11:46

0001 // This file is part of the Acts project.
0002 //
0003 // Copyright (C) 2020 CERN for the benefit of the Acts project
0004 //
0005 // This Source Code Form is subject to the terms of the Mozilla Public
0006 // License, v. 2.0. If a copy of the MPL was not distributed with this
0007 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
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 }