MCPcopy Create free account
hub / github.com/PABannier/sam3.cpp / parse_args

Function parse_args

tests/test_metal_conv_transpose_2d.cpp:64–90  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

62}
63
64static bool parse_args(int argc, char ** argv, options & opts) {
65 for (int i = 1; i < argc; ++i) {
66 if (strcmp(argv[i], "--case") == 0) {
67 if (i + 1 >= argc) return false;
68 opts.case_name = argv[++i];
69 } else if (strcmp(argv[i], "--dump-mismatch") == 0) {
70 opts.dump_mismatch = true;
71 } else if (strcmp(argv[i], "--n-threads") == 0) {
72 if (i + 1 >= argc) return false;
73 opts.n_threads = atoi(argv[++i]);
74 } else if (strcmp(argv[i], "--max-wall-ms") == 0) {
75 if (i + 1 >= argc) return false;
76 opts.max_wall_ms = atoi(argv[++i]);
77 } else if (strcmp(argv[i], "--list") == 0) {
78 for (const case_desc & tc : CASES) {
79 fprintf(stderr, "%s\n", tc.name);
80 }
81 exit(0);
82 } else if (strcmp(argv[i], "--help") == 0 || strcmp(argv[i], "-h") == 0) {
83 return false;
84 } else {
85 fprintf(stderr, "Unknown argument: %s\n", argv[i]);
86 return false;
87 }
88 }
89 return true;
90}
91
92static float gen_value(uint64_t idx, uint32_t seed, float scale) {
93 uint32_t x = (uint32_t) idx ^ seed;

Callers 1

mainFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected