Skip to content

Commit d5207bf

Browse files
rankaiyxggerganov
authored andcommitted
benchmark-matmul: Print the average of the test results (ggml-org#1490)
1 parent 1af2844 commit d5207bf

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

Diff for: examples/benchmark/benchmark-matmult.cpp

+5
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,7 @@ int main(int argc, char ** argv) {
211211
printf("Iteration;NThreads; SizeX; SizeY; SizeZ; Required_FLOPS; Elapsed_u_Seconds; gigaFLOPS\n");
212212
printf("=====================================================================================\n");
213213

214+
double gflops_sum = 0;
214215
for (int i=0;i<benchmark_params.n_iterations ;i++) {
215216

216217
long long int start = ggml_time_us();
@@ -219,6 +220,7 @@ int main(int argc, char ** argv) {
219220
long long int stop = ggml_time_us();
220221
long long int usec = stop-start;
221222
double gflops = (double)(flops_per_matrix)/usec/1000.0;
223+
gflops_sum += gflops;
222224
printf("%9i;%8i;%6i;%6i;%6i;%15lli;%18lli;%10.2f\n",
223225
i,
224226
gf31.n_threads,
@@ -248,4 +250,7 @@ int main(int argc, char ** argv) {
248250
// Running a different graph computation to make sure we override the CPU cache lines
249251
ggml_graph_compute(ctx, &gf32);
250252
}
253+
printf("\n");
254+
printf("Average%78.2f\n",gflops_sum/((double)benchmark_params.n_iterations));
255+
printf("=====================================================================================\n");
251256
}

0 commit comments

Comments
 (0)