diff options
author | Juan Gomez Luna <juan.gomez@safari.ethz.ch> | 2021-06-16 19:46:05 +0200 |
---|---|---|
committer | Juan Gomez Luna <juan.gomez@safari.ethz.ch> | 2021-06-16 19:46:05 +0200 |
commit | 3de4b495fb176eba9a0eb517a4ce05903cb67acb (patch) | |
tree | fc6776a94549d2d4039898f183dbbeb2ce013ba9 /BFS/support/params.h | |
parent | ef5c3688c486b80a56d3c1cded25f2b2387f2668 (diff) |
PrIM -- first commit
Diffstat (limited to 'BFS/support/params.h')
-rw-r--r-- | BFS/support/params.h | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/BFS/support/params.h b/BFS/support/params.h new file mode 100644 index 0000000..9bf9158 --- /dev/null +++ b/BFS/support/params.h @@ -0,0 +1,46 @@ + +#ifndef _PARAMS_H_ +#define _PARAMS_H_ + +#include "common.h" +#include "utils.h" + +static void usage() { + PRINT( "\nUsage: ./program [options]" + "\n" + "\nBenchmark-specific options:" + "\n -f <F> input matrix file name (default=data/roadNet-CA.txt)" + "\n" + "\nGeneral options:" + "\n -v <V> verbosity" + "\n -h help" + "\n\n"); +} + +typedef struct Params { + const char* fileName; + unsigned int verbosity; +} Params; + +static struct Params input_params(int argc, char **argv) { + struct Params p; + p.fileName = "data/roadNet-CA.txt"; + p.verbosity = 1; + int opt; + while((opt = getopt(argc, argv, "f:v:h")) >= 0) { + switch(opt) { + case 'f': p.fileName = optarg; break; + case 'v': p.verbosity = atoi(optarg); break; + case 'h': usage(); exit(0); + default: + PRINT_ERROR("Unrecognized option!"); + usage(); + exit(0); + } + } + + return p; +} + +#endif + |