From fa6c70a44fc56cc50370e57c460dd61e8f127b51 Mon Sep 17 00:00:00 2001 From: Birte Kristina Friesel Date: Fri, 23 May 2025 16:28:17 +0200 Subject: SpMV: Add AspectC++ support --- SpMV/include/params.h | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 SpMV/include/params.h (limited to 'SpMV/include/params.h') diff --git a/SpMV/include/params.h b/SpMV/include/params.h new file mode 100644 index 0000000..bf60e79 --- /dev/null +++ b/SpMV/include/params.h @@ -0,0 +1,51 @@ + +#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 input matrix file name (default=data/bcsstk30.mtx)" + "\n" + "\nGeneral options:" + "\n -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/bcsstk30.mtx"; + 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 -- cgit v1.2.3