Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:13:07

0001 // This file is part of the ACTS project.
0002 //
0003 // Copyright (C) 2016 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 https://mozilla.org/MPL/2.0/.
0008 
0009 // Local include(s).
0010 #include "CommandLineArguments.hpp"
0011 
0012 // Boost include(s).
0013 #include <boost/program_options.hpp>
0014 
0015 // System include(s).
0016 #include <cstdlib>
0017 #include <iostream>
0018 #include <string>
0019 
0020 /// Convenience declaration for using the boost::program_options namespace
0021 namespace po = boost::program_options;
0022 
0023 void CommandLineArguments::interpret(int argc, char* argv[]) {
0024   // Declare the supported options.
0025   po::options_description desc("Acts::Cuda::SeedFinder Test");
0026   desc.add_options()("help,h", "Produce a help message")(
0027       "spFile,f", po::value<std::string>()->default_value("sp.txt"),
0028       "SpacePoint text file name")(
0029       "quiet,q", po::bool_switch(),
0030       "Do not print the properties of the reconstructed seeds")(
0031       "onlyGPU,g", po::bool_switch(),
0032       "Run the seed finding using only the GPU implementation")(
0033       "groupsToIterate,n", po::value<unsigned int>()->default_value(500),
0034       "The number of groups to process as a maximum")(
0035       "filterDuplicates,d", po::bool_switch(),
0036       "Look for spacepoint duplicates in the input file, and remove them "
0037       "(slow!)")("cudaDevice", po::value<int>()->default_value(0),
0038                  "The CUDA device to use in the test")(
0039       "cudaDeviceMemory", po::value<unsigned int>()->default_value(0),
0040       "The amount of CUDA device memory to use, in megabytes. By default it is"
0041       " 80% of the available amount.");
0042 
0043   // Parse the command line arguments.
0044   po::variables_map vm;
0045   po::store(po::parse_command_line(argc, argv, desc), vm);
0046   po::notify(vm);
0047 
0048   // Handle the --help flag.
0049   if (vm.count("help")) {
0050     std::cout << desc << std::endl;
0051     exit(0);
0052   }
0053 
0054   // Store the arguments in the member variables.
0055   spFile = vm["spFile"].as<std::string>();
0056   quiet = vm["quiet"].as<bool>();
0057   onlyGPU = vm["onlyGPU"].as<bool>();
0058   groupsToIterate = vm["groupsToIterate"].as<unsigned int>();
0059   filterDuplicates = vm["filterDuplicates"].as<bool>();
0060   cudaDevice = vm["cudaDevice"].as<int>();
0061   cudaDeviceMemory = vm["cudaDeviceMemory"].as<unsigned int>();
0062   return;
0063 }