MCPcopy Create free account
hub / github.com/Tiiny-AI/PowerInfer / main

Function main

examples/benchmark/benchmark-matmult.cpp:71–277  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

69}
70
71int main(int argc, char ** argv) {
72 struct benchmark_params_struct benchmark_params;
73
74 bool invalid_param = false;
75 std::string arg;
76 for (int i = 1; i < argc; i++) {
77 arg = argv[i];
78
79 if (arg == "-t" || arg == "--threads") {
80 if (++i >= argc) {
81 invalid_param = true;
82 break;
83 }
84 benchmark_params.n_threads = std::stoi(argv[i]);
85 } else if (arg == "-i" || arg == "--iter") {
86 if (++i >= argc) {
87 invalid_param = true;
88 break;
89 }
90 benchmark_params.n_iterations = std::stoi(argv[i]);
91 } else if (arg == "-h" || arg == "--help") {
92 print_usage(argc, argv, benchmark_params);
93 exit(0);
94 }
95 }
96 if (invalid_param) {
97 fprintf(stderr, "error: invalid parameter for argument: %s\n", arg.c_str());
98 print_usage(argc, argv, benchmark_params);
99 exit(1);
100 }
101
102 print_build_info();
103 printf("Starting Test\n");
104
105 // create the ggml context
106 struct ggml_context * ctx;
107 //const int sizex = 4096;
108 //const int sizey = 11008;
109
110#undef VERBOSE_DEBUGGING
111#ifndef VERBOSE_DEBUGGING
112 const int sizey = 4096;
113 const int sizex = 11008;
114 const int sizez = 128;
115#else
116 /* Working - let's increase size */
117 const int sizey = 1;
118 const int sizex = (8*32);
119 const int sizez = 1;
120
121 /*const int sizey = 1;
122 const int sizex = 3*(8*32);
123 const int sizez = 1;*/
124#endif
125
126 //printf("Memsize required = %i\n", sizex*sizex);
127
128 // TODO: perform the bench for all types or for a user specified type

Callers

nothing calls this directly

Calls 15

fprintfFunction · 0.85
printfFunction · 0.85
tensor_sum_elementsFunction · 0.85
absFunction · 0.85
print_usageFunction · 0.70
ggml_type_sizefFunction · 0.50
ggml_initFunction · 0.50
ggml_new_tensor_2dFunction · 0.50
ggml_set_f32Function · 0.50
ggml_mul_matFunction · 0.50
ggml_new_graphFunction · 0.50

Tested by

no test coverage detected