added conf option for number of loops
This commit is contained in:
parent
b0e7810a6b
commit
1d4ffddf69
|
@ -123,17 +123,18 @@ int MAIN__(int argc, char *argv[]){
|
||||||
FLOAT *a, *b, *c;
|
FLOAT *a, *b, *c;
|
||||||
FLOAT alpha[] = {1.0, 1.0};
|
FLOAT alpha[] = {1.0, 1.0};
|
||||||
FLOAT beta [] = {1.0, 1.0};
|
FLOAT beta [] = {1.0, 1.0};
|
||||||
|
|
||||||
char trans='N';
|
char trans='N';
|
||||||
|
|
||||||
blasint m, i, j;
|
blasint m, i, j;
|
||||||
|
int loops = 1;
|
||||||
|
int l;
|
||||||
|
char *p;
|
||||||
|
|
||||||
int from = 1;
|
int from = 1;
|
||||||
int to = 200;
|
int to = 200;
|
||||||
int step = 1;
|
int step = 1;
|
||||||
|
|
||||||
struct timeval start, stop;
|
struct timeval start, stop;
|
||||||
double time1;
|
double time1,timeg;
|
||||||
|
|
||||||
argc--;argv++;
|
argc--;argv++;
|
||||||
|
|
||||||
|
@ -155,6 +156,9 @@ int MAIN__(int argc, char *argv[]){
|
||||||
fprintf(stderr,"Out of Memory!!\n");exit(1);
|
fprintf(stderr,"Out of Memory!!\n");exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
p = getenv("OPENBLAS_LOOPS");
|
||||||
|
if ( p != NULL )
|
||||||
|
loops = atoi(p);
|
||||||
|
|
||||||
|
|
||||||
#ifdef linux
|
#ifdef linux
|
||||||
|
@ -166,8 +170,13 @@ int MAIN__(int argc, char *argv[]){
|
||||||
for(m = from; m <= to; m += step)
|
for(m = from; m <= to; m += step)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
timeg=0;
|
||||||
|
|
||||||
fprintf(stderr, " %6d : ", (int)m);
|
fprintf(stderr, " %6d : ", (int)m);
|
||||||
|
|
||||||
|
for (l=0; l<loops; l++)
|
||||||
|
{
|
||||||
|
|
||||||
for(j = 0; j < m; j++){
|
for(j = 0; j < m; j++){
|
||||||
for(i = 0; i < m * COMPSIZE; i++){
|
for(i = 0; i < m * COMPSIZE; i++){
|
||||||
a[i + j * m * COMPSIZE] = ((FLOAT) rand() / (FLOAT) RAND_MAX) - 0.5;
|
a[i + j * m * COMPSIZE] = ((FLOAT) rand() / (FLOAT) RAND_MAX) - 0.5;
|
||||||
|
@ -184,11 +193,14 @@ int MAIN__(int argc, char *argv[]){
|
||||||
|
|
||||||
time1 = (double)(stop.tv_sec - start.tv_sec) + (double)((stop.tv_usec - start.tv_usec)) * 1.e-6;
|
time1 = (double)(stop.tv_sec - start.tv_sec) + (double)((stop.tv_usec - start.tv_usec)) * 1.e-6;
|
||||||
|
|
||||||
gettimeofday( &start, (struct timezone *)0);
|
timeg += time1;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
timeg /= loops;
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
" %10.2f MFlops\n",
|
" %10.2f MFlops\n",
|
||||||
COMPSIZE * COMPSIZE * 2. * (double)m * (double)m * (double)m / time1 * 1.e-6);
|
COMPSIZE * COMPSIZE * 2. * (double)m * (double)m * (double)m / timeg * 1.e-6);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue