GeNN  2.2.3
GPU enhanced Neuronal Networks (GeNN)
parse_options.h
Go to the documentation of this file.
1  // parse options
2  unsigned int dbgMode= 0;
3  string ftype= "FLOAT";
4  unsigned int fixsynapse= 0;
5  unsigned int cpu_only= 0;
6  string option;
7  for (int i= argStart; i < argc; i++) {
8  if (extract_option(argv[i],option) != 0) {
9  cerr << "Unknown option '" << argv[i] << "'." << endl;
10  exit(1);
11  }
12  else {
13  if (option == "DEBUG") {
14  if (extract_bool_value(argv[i],dbgMode) != 0) {
15  cerr << "illegal value for 'DEBUG' option." << endl;
16  exit(1);
17  }
18  }
19  else if (option == "FTYPE") {
20  extract_string_value(argv[i],ftype);
21  if ((ftype != "FLOAT") && (ftype != "DOUBLE")) {
22  cerr << "illegal value " << ftype << " of 'FTYPE' option." <<endl;
23  exit(1);
24  }
25  }
26  else if (option == "REUSE") {
27  if (extract_bool_value(argv[i], fixsynapse) != 0) {
28  cerr << "illegal value for 'REUSE' option." << endl;
29  exit(1);
30  }
31  }
32  else if (option == "CPU_ONLY") {
33  if (extract_bool_value(argv[i], cpu_only) != 0) {
34  cerr << "illegal value for 'CPU_ONLY' option." << endl;
35  exit(1);
36  }
37  }
38  }
39  }
40  if (cpu_only && (which == 1)) {
41  cerr << "You cannot use a GPU in CPU_only mode." << endl;
42  exit(1);
43  }
string ftype
Definition: parse_options.h:3
int extract_string_value(char *op, string &val)
Definition: command_line_processing.h:74
int extract_option(char *op, string &option)
Definition: command_line_processing.h:45
unsigned int dbgMode
Definition: parse_options.h:2
unsigned int cpu_only
Definition: parse_options.h:5
unsigned int fixsynapse
Definition: parse_options.h:4
int extract_bool_value(char *op, unsigned int &val)
Definition: command_line_processing.h:57
string option
Definition: parse_options.h:6