1 #ifndef COMMAND_LINE_INPUTS_HPP
2 #define COMMAND_LINE_INPUTS_HPP
16 std::string arg = argv[i+1];
19 int x = std::stoi(arg, &pos);
20 if (pos >= arg.size()) {
54 bool check(std::string input, std::string name, std::string explanation){
65 std::string msg =
"Available options are:\n";
66 for(
int j = 0; j <
options.size(); j++)
67 msg +=
"\t" +
options[j].name +
"\t" +
options[j].explanation +
"\n";
68 printf(
"%s", msg.c_str());
72 printf(
"ERROR: %s\n", msg.c_str());
92 for (
int i = 1; i < argc; ++i) {
93 std::string input = std::string(argv[i]);
96 if(
check(input,
"--test",
"Checks particles against reference data")){
99 if(
check(input,
"--update-test",
"Updates reference data used in particle test")){
102 if(
check(input,
"--moments-test",
"Checks moments against reference data")){
105 if(
check(input,
"--update-moments-test",
"Updates reference data used in moments test")){
108 if(
check(input,
"--debug",
"Activates extra barriered checkpoints and validity checks (not intended for production)")){
111 if(
check(input,
"--dryrun",
"Partially runs XGC setup to check for some common input errors")){
115 if(
check(input,
"-n_ranks",
"Optional input if using --dryrun: Specify the number of MPI ranks you plan to use")){
117 error(
"-n_ranks can only be used with --dryrun");
120 if(ierr!=0)
error(
"Expected integer after -n_ranks");
123 if(
check(input,
"-max_walltime",
"Specifies a maximum walltime in minutes after which XGC will write a checkpoint and end the simulation")){
124 max_walltime = read_arg_after<int>(argc, argv, i, &ierr);
125 if(ierr!=0)
error(
"Expected integer after -max_walltime");
128 if(
check(input,
"--perf-barriers",
"Adds MPI barriers to top-level timers to help identify load imbalance")){
132 error(
"Unknown command line argument " + input);
Option
Definition: streamed_parallel_for.hpp:13
logical false
Definition: module.F90:102