Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CommandLineArguments.cpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file CommandLineArguments.cpp
1 // This file is part of the Acts project.
2 //
3 // Copyright (C) 2020 CERN for the benefit of the Acts project
4 //
5 // This Source Code Form is subject to the terms of the Mozilla Public
6 // License, v. 2.0. If a copy of the MPL was not distributed with this
7 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 
9 // Local include(s).
10 #include "CommandLineArguments.hpp"
11 
12 // Boost include(s).
13 #include <boost/program_options.hpp>
14 
15 // System include(s).
16 #include <cstdlib>
17 #include <iostream>
18 #include <string>
19 
21 namespace po = boost::program_options;
22 
23 void CommandLineArguments::interpret(int argc, char* argv[]) {
24  // Declare the supported options.
25  po::options_description desc("Acts::Cuda::SeedFinder Test");
26  desc.add_options()("help,h", "Produce a help message")(
27  "spFile,f", po::value<std::string>()->default_value("sp.txt"),
28  "SpacePoint text file name")(
29  "quiet,q", po::bool_switch(),
30  "Do not print the properties of the reconstructed seeds")(
31  "onlyGPU,g", po::bool_switch(),
32  "Run the seed finding using only the GPU implementation")(
33  "groupsToIterate,n", po::value<unsigned int>()->default_value(500),
34  "The number of groups to process as a maximum")(
35  "filterDuplicates,d", po::bool_switch(),
36  "Look for spacepoint duplicates in the input file, and remove them "
37  "(slow!)")("cudaDevice", po::value<int>()->default_value(0),
38  "The CUDA device to use in the test")(
39  "cudaDeviceMemory", po::value<unsigned int>()->default_value(0),
40  "The amount of CUDA device memory to use, in megabytes. By default it is"
41  " 80% of the available amount.");
42 
43  // Parse the command line arguments.
44  po::variables_map vm;
45  po::store(po::parse_command_line(argc, argv, desc), vm);
46  po::notify(vm);
47 
48  // Handle the --help flag.
49  if (vm.count("help")) {
50  std::cout << desc << std::endl;
51  exit(0);
52  }
53 
54  // Store the arguments in the member variables.
55  spFile = vm["spFile"].as<std::string>();
56  quiet = vm["quiet"].as<bool>();
57  onlyGPU = vm["onlyGPU"].as<bool>();
58  groupsToIterate = vm["groupsToIterate"].as<unsigned int>();
59  filterDuplicates = vm["filterDuplicates"].as<bool>();
60  cudaDevice = vm["cudaDevice"].as<int>();
61  cudaDeviceMemory = vm["cudaDeviceMemory"].as<unsigned int>();
62  return;
63 }