Skip to content

Commit

Permalink
Added option -f in benchmarks
Browse files Browse the repository at this point in the history
  • Loading branch information
SGo-Go committed Oct 17, 2013
1 parent 9524cf8 commit 6d91734
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 27 deletions.
30 changes: 15 additions & 15 deletions bench/cpu/cpu_bench.c
Original file line number Diff line number Diff line change
Expand Up @@ -110,27 +110,27 @@ int process(int threads, int tests, int n_process, int L_first)
/************************************************************
* Title string in tabular output
************************************************************/
printf(FORMAT_TITLE_SIZE" " );
MESSAGE(FORMAT_TITLE_SIZE" " );
#ifdef BENCH_DENSE_CODE
# ifdef BENCH_GETRI
printf(FORMAT_TITLE_PARAM(GETRF)" ");
printf(FORMAT_TITLE_PARAM(GETRI)" ");
MESSAGE(FORMAT_TITLE_PARAM(GETRF)" ");
MESSAGE(FORMAT_TITLE_PARAM(GETRI)" ");
# endif
# if defined(BENCH_TRSM) || defined(BENCH_TRTRI)
printf(FORMAT_TITLE_PARAM(GEQRF)" ");
printf(FORMAT_TITLE_PARAM(LACPY)" ");
MESSAGE(FORMAT_TITLE_PARAM(GEQRF)" ");
MESSAGE(FORMAT_TITLE_PARAM(LACPY)" ");
# ifndef BENCH_TRSM
printf(FORMAT_TITLE_PARAM(TRTRI)" ");
MESSAGE(FORMAT_TITLE_PARAM(TRTRI)" ");
# else
printf(FORMAT_TITLE_PARAM(TRSM)" ");
MESSAGE(FORMAT_TITLE_PARAM(TRSM)" ");
# endif
printf(FORMAT_TITLE_PARAM(ORMQR)" ");
MESSAGE(FORMAT_TITLE_PARAM(ORMQR)" ");
# endif
#endif
printf(FORMAT_TITLE_PARAM(BSOF)" ");
printf(FORMAT_TITLE_PARAM(BSTRI)" ");
printf(FORMAT_TITLE_PARAM(BSOI)" ");
printf("\n");
MESSAGE(FORMAT_TITLE_PARAM(BSOF)" ");
MESSAGE(FORMAT_TITLE_PARAM(BSTRI)" ");
MESSAGE(FORMAT_TITLE_PARAM(BSOI)" ");
MESSAGE("\n");

/************************************************************
* Iterations over deffierent sizes of p-cyclic matrices
Expand All @@ -140,7 +140,7 @@ int process(int threads, int tests, int n_process, int L_first)
lda = N;

MATR_INIT(n, L, A, lda);
printf( FORMAT_SIZE " ", n, L);
MESSAGE( FORMAT_SIZE " ", n, L);

#ifdef BENCH_DENSE_CODE
/************************************************************/
Expand Down Expand Up @@ -213,8 +213,8 @@ int process(int threads, int tests, int n_process, int L_first)
}
#endif

printf( "\n" );
fflush(stdout);
MESSAGE( "\n" );
MSGFLUSH();
}

/************************************************************
Expand Down
20 changes: 10 additions & 10 deletions bench/hybrid/hybrid_bench.c
Original file line number Diff line number Diff line change
Expand Up @@ -101,15 +101,15 @@ int process(int threads, int tests, int n_process, int L_first)
/************************************************************
* Title string in tabular output
************************************************************/
printf(FORMAT_TITLE_SIZE" " );
printf(FORMAT_TITLE_PARAM(BSOFTRI_HYB)" ");
printf(FORMAT_TITLE_PARAM(BSOI_HYB)" ");
MESSAGE(FORMAT_TITLE_SIZE" " );
MESSAGE(FORMAT_TITLE_PARAM(BSOFTRI_HYB)" ");
MESSAGE(FORMAT_TITLE_PARAM(BSOI_HYB)" ");
#ifdef BENCH_CPU_BSOFI
printf(FORMAT_TITLE_PARAM(BSOF)" ");
printf(FORMAT_TITLE_PARAM(BSTRI)" ");
printf(FORMAT_TITLE_PARAM(BSOI)" ");
MESSAGE(FORMAT_TITLE_PARAM(BSOF)" ");
MESSAGE(FORMAT_TITLE_PARAM(BSTRI)" ");
MESSAGE(FORMAT_TITLE_PARAM(BSOI)" ");
#endif
printf("\n");
MESSAGE("\n");

/************************************************************
* Iterations over deffierent sizes of p-cyclic matrices
Expand All @@ -120,7 +120,7 @@ int process(int threads, int tests, int n_process, int L_first)

/********************** Init ********************************/
MATR_INIT(n, L, A, lda);
printf( FORMAT_SIZE " ", n, L);
MESSAGE( FORMAT_SIZE " ", n, L);

/********************* CPU bench ****************************/
#ifdef BENCH_CPU_BSOFI
Expand Down Expand Up @@ -160,8 +160,8 @@ int process(int threads, int tests, int n_process, int L_first)
hybridXbsoi (handle, n, L, A, lda, tau,
work, lwork, dwork, ldwork,/* L_frac, */ &info));

printf( "\n" );
fflush(stdout);
MESSAGE( "\n" );
MSGFLUSH();
}

/************************************************************
Expand Down
20 changes: 18 additions & 2 deletions bench/include/options.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@

#include <stdio.h>

FILE * pFile;
#define MESSAGE(...) \
fprintf(pFile, __VA_ARGS__)

#define MSGFLUSH(...) \
fflush(pFile)

#define MAX_TEST 20
int sizen[MAX_TEST];
const int ntest = 12;
Expand All @@ -18,9 +25,12 @@ int process(int threads, int tests, int n, int L);

int main(int argc, char** argv)
{
int bUseFile = 0, ret_val = 0;
int n = 0, L = 10, i;
int nthreads = 0, tests = 0;

pFile = stdout;

int k = 8;
for(i = 0; i < MAX_TEST; i++, k+=2)
sizen[i] = k*k;
Expand All @@ -35,7 +45,11 @@ int main(int argc, char** argv)
tests = atoi(argv[++i]);
else if(strcmp("-p", argv[i])==0)
nthreads = atoi(argv[++i]);
}
else if(strcmp("-f", argv[i])==0) {
pFile = fopen (argv[++i],"w");
bUseFile = 1;
}
}

if (n>0 && !tests ) {sizen[0] = n; tests = 1; }
else if (n>0 && tests>0) {
Expand All @@ -62,5 +76,7 @@ int main(int argc, char** argv)
if(nthreads == 0) nthreads = 4;
if(tests == 0) tests = 2;

return process(nthreads, tests, n, L);
ret_val = process(nthreads, tests, n, L);
if(bUseFile) fclose(pFile);
return ret_val;
}

0 comments on commit 6d91734

Please sign in to comment.