Add OPENBLAS_LOOPS support to potrf/potrs/potri benchmark

This commit is contained in:
Martin Kroeker 2021-06-26 23:46:00 +02:00 committed by GitHub
parent 3be660c000
commit 1f8bda71b9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 24 additions and 15 deletions

View File

@ -99,14 +99,15 @@ int main(int argc, char *argv[]){
char *p;
char btest = 'F';
blasint m, i, j, info, uplos=0;
double flops;
blasint m, i, j, l, info, uplos=0;
double flops = 0.;
int from = 1;
int to = 200;
int step = 1;
int loops = 1;
double time1;
double time1, timeg;
argc--;argv++;
@ -119,6 +120,8 @@ int main(int argc, char *argv[]){
if ((p = getenv("OPENBLAS_TEST"))) btest=*p;
if ((p = getenv("OPENBLAS_LOOPS"))) loops=*p;
fprintf(stderr, "From : %3d To : %3d Step = %3d Uplo = %c\n", from, to, step,*uplo[uplos]);
if (( a = (FLOAT *)malloc(sizeof(FLOAT) * to * to * COMPSIZE)) == NULL){
@ -129,19 +132,21 @@ int main(int argc, char *argv[]){
fprintf(stderr,"Out of Memory!!\n");exit(1);
}
for(m = from; m <= to; m += step){
for(m = from; m <= to; m += step){
timeg=0.;
for (l = 0; l < loops; l++) {
#ifndef COMPLEX
if (uplos & 1) {
for (j = 0; j < m; j++) {
for(i = 0; i < j; i++) a[(long)i + (long)j * (long)m] = 0.;
a[(long)j + (long)j * (long)m] = ((double) rand() / (double) RAND_MAX) + 8.;
a[(long)j + (long)j * (long)m] = ((double) rand() / (double) RAND_MAX) + 8.;
for(i = j + 1; i < m; i++) a[(long)i + (long)j * (long)m] = ((double) rand() / (double) RAND_MAX) - 0.5;
}
} else {
for (j = 0; j < m; j++) {
for(i = 0; i < j; i++) a[(long)i + (long)j * (long)m] = ((double) rand() / (double) RAND_MAX) - 0.5;
a[(long)j + (long)j * (long)m] = ((double) rand() / (double) RAND_MAX) + 8.;
a[(long)j + (long)j * (long)m] = ((double) rand() / (double) RAND_MAX) + 8.;
for(i = j + 1; i < m; i++) a[(long)i + (long)j * (long)m] = 0.;
}
}
@ -192,8 +197,8 @@ int main(int argc, char *argv[]){
exit(1);
}
time1 = getsec();
flops = COMPSIZE * COMPSIZE * (1.0/3.0 * (double)m * (double)m *(double)m +1.0/2.0* (double)m *(double)m + 1.0/6.0* (double)m) / time1 * 1.e-6;
if ( btest == 'F')
timeg += getsec();
if ( btest == 'S' )
{
@ -214,9 +219,7 @@ int main(int argc, char *argv[]){
fprintf(stderr, "Potrs info = %d\n", info);
exit(1);
}
time1 = getsec();
flops = COMPSIZE * COMPSIZE * (2.0 * (double)m * (double)m *(double)m ) / time1 * 1.e-6;
timeg += getsec();
}
if ( btest == 'I' )
@ -232,11 +235,17 @@ int main(int argc, char *argv[]){
fprintf(stderr, "Potri info = %d\n", info);
exit(1);
}
time1 = getsec();
flops = COMPSIZE * COMPSIZE * (2.0/3.0 * (double)m * (double)m *(double)m +1.0/2.0* (double)m *(double)m + 5.0/6.0* (double)m) / time1 * 1.e-6;
timeg += getsec();
}
} // loops
time1 = timeg/(double)loops;
if ( btest == 'F')
flops = COMPSIZE * COMPSIZE * (1.0/3.0 * (double)m * (double)m *(double)m +1.0/2.0* (double)m *(double)m + 1.0/6.0* (double)m) / time1 * 1.e-6;
if ( btest == 'S')
flops = COMPSIZE * COMPSIZE * (2.0 * (double)m * (double)m *(double)m ) / time1 * 1.e-6;
if ( btest == 'I')
flops = COMPSIZE * COMPSIZE * (2.0/3.0 * (double)m * (double)m *(double)m +1.0/2.0* (double)m *(double)m + 5.0/6.0* (double)m) / time1 * 1.e-6;
fprintf(stderr, "%8d : %10.2f MFlops : %10.3f Sec : Test=%c\n",m,flops ,time1,btest);