Skip to content

Commit b2319fd

Browse files
authored
Merge pull request #3301 from martin-frbg/syr2bench
Handle OPENBLAS_LOOPS in SYR2 benchmark
2 parents 993e56b + 14e33e0 commit b2319fd

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

benchmark/syr2.c

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,17 @@ int main(int argc, char *argv[]){
4646

4747
if ((p = getenv("OPENBLAS_UPLO"))) uplo=*p;
4848

49-
blasint m, i, j;
49+
blasint m, i, j, l;
5050
blasint inc_x= 1;
5151
blasint inc_y= 1;
5252
int from = 1;
5353
int to = 200;
5454
int step = 1;
55+
int loops = 1;
5556

56-
double time1;
57+
if ((p = getenv("OPENBLAS_LOOPS"))) loops=*p;
58+
59+
double time1,timeg;
5760

5861
argc--;argv++;
5962

@@ -85,8 +88,9 @@ int main(int argc, char *argv[]){
8588

8689
for(m = from; m <= to; m += step)
8790
{
88-
91+
timeg = 0.;
8992
fprintf(stderr, " %6d : ", (int)m);
93+
for (l = 0; l < loops; l++) {
9094
for(i = 0; i < m * COMPSIZE * abs(inc_x); i++){
9195
x[i] = ((FLOAT) rand() / (FLOAT) RAND_MAX) - 0.5;
9296
}
@@ -107,8 +111,10 @@ int main(int argc, char *argv[]){
107111

108112
end();
109113

110-
time1 = getsec();
114+
timeg += getsec();
115+
} // loops
111116

117+
time1 = timeg/(double)loops;
112118
fprintf(stderr,
113119
" %10.2f MFlops\n",
114120
COMPSIZE * COMPSIZE * 2. * (double)m * (double)m / time1 * 1.e-6);

0 commit comments

Comments
 (0)