From 2a15a2283a608da28a1a80f5ce10e4d917263b5c Mon Sep 17 00:00:00 2001 From: enge Date: Fri, 24 Jan 2014 16:22:04 +0000 Subject: bench: Shorten lines to fit normal terminals. Use operations/0.05 seconds as score measurement. git-svn-id: svn://scm.gforge.inria.fr/svn/mpc/trunk@1441 211d60ee-9f03-0410-a15a-8952a2c7a4e4 --- NEWS | 2 ++ tools/bench/benchtime.h | 2 +- tools/bench/mpcbench.c | 34 +++++++++++++++++----------------- 3 files changed, 20 insertions(+), 18 deletions(-) diff --git a/NEWS b/NEWS index 4ef1540..5ca74d8 100644 --- a/NEWS +++ b/NEWS @@ -2,6 +2,8 @@ Recent changes in the trunk: - Minimally required library version: mpfr 3.0.0 - Improved speed for corner cases of mpc_asin, mpc_sin, see http://lists.gforge.inria.fr/pipermail/mpc-discuss/2013-December/001266.html + - Rewrite of the testing framework + - New mpcbench tool, used with "make bench" Changes in version 1.0.2: - Fixed mpc_atan, mpc_atanh for (+-0, +-1), see diff --git a/tools/bench/benchtime.h b/tools/bench/benchtime.h index a857c06..77ba27f 100644 --- a/tools/bench/benchtime.h +++ b/tools/bench/benchtime.h @@ -43,7 +43,7 @@ __attribute__ ((__unused__)) int nop)\ #define ADDR_TIME_NOP(func) TIME_NOP##func -/* compute the time to run one only call of the function with two inputs */ +/* compute the time to run only one call of the function with two inputs */ #define DECLARE_TIME_NOP(func, funcall, nop) \ DECLARE_ACCURATE_TIME_NOP(func, funcall) \ double TIME_NOP##func(int n, mpc_t* z, mpc_t* x, mpc_t* y); \ diff --git a/tools/bench/mpcbench.c b/tools/bench/mpcbench.c index 5cfd89d..7cd6b60 100644 --- a/tools/bench/mpcbench.c +++ b/tools/bench/mpcbench.c @@ -92,15 +92,15 @@ const struct benchfunc {"asin", ADDR_TIME_NOP (mpc_asin), ADDR_ACCURATE_TIME_NOP (mpc_asin), egroup_special, 1} }; -/* the following arrays must have the same number of elemnts */ +/* the following arrays must have the same number of elements */ -/* list of precision to test for the first operand */ +/* list of precisions to test for the first operand */ const int arrayprecision_op1[] = { 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 50, 100, 200, 350, 700, 1500, 3000, 6000, 10000, 1500, 3000, 5000, }; -/* list of precision to test for the second operand */ +/* list of precisions to test for the second operand */ const int arrayprecision_op2[] = { 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 50, 100, 200, 350, 700, 1500, 3000, 6000, 10000, 3000, 6000, 10000 @@ -162,7 +162,7 @@ compute_score (mpz_t zscore, int op, gmp_randstate_t randstate) double t; - unsigned long ops_per_sec; + unsigned long ops_per_fivecentisec; int countprec = 0; @@ -184,28 +184,28 @@ compute_score (mpz_t zscore, int op, gmp_randstate_t randstate) /* compute the number of operations per seconds */ if (arrayfunc[i].noperands==2) { - printf ("operation %5s, precision : %5lux%5lu to %5lu bits ... ", arrayfunc[i].name, precision1, precision2, precision3); + printf ("op %4s, prec %5lux%5lu->%5lu:", arrayfunc[i].name, precision1, precision2, precision3); } else { - printf ("operation %5s, precision : %5lu to %5lu bits ... ", arrayfunc[i].name, precision1, precision3); + printf ("op %4s, prec %5lu ->%5lu:", arrayfunc[i].name, precision1, precision3); } fflush (stdout); t = arrayfunc[i].func_init (NB_RAND_CPLX, zptr, xptr, yptr); niter = 1 + (unsigned long) (1e6 / t); - printf (" %10lu iterations ...", niter); + printf ("%9lu iter:", niter); fflush (stdout); /* ti expressed in microseconds */ ti = arrayfunc[i].func_accurate (niter, NB_RAND_CPLX, zptr, xptr, yptr, arrayfunc[i].noperands); - ops_per_sec = (unsigned long) (1000000E0 * niter / (double) ti); + ops_per_fivecentisec = (unsigned long) (50000E0 * niter / (double) ti); - printf (" %10lu operations per second\n", ops_per_sec); + printf ("%7lu\n", ops_per_fivecentisec); - mpz_mul_ui (zscore, zscore, ops_per_sec); + mpz_mul_ui (zscore, zscore, ops_per_fivecentisec); /* free memory */ for (j = 0; j < NB_RAND_CPLX; j++) @@ -284,26 +284,26 @@ main (void) compute_groupscore (groupscore, NB_BENCH_OP, score); printf ("\n=================================================================\n\n"); - printf ("GMP : %s MPFR : %s MPC: %s\n", gmp_version, + printf ("GMP: %s, MPFR: %s, MPC: %s\n", gmp_version, mpfr_get_version (), mpc_get_version ()); #ifdef __GMP_CC - printf ("GMP compiler : %s\n", __GMP_CC); + printf ("GMP compiler: %s\n", __GMP_CC); #endif #ifdef __GMP_CFLAGS - printf ("GMP flags : %s\n", __GMP_CFLAGS); + printf ("GMP flags : %s\n", __GMP_CFLAGS); #endif - printf ("\n\n"); + printf ("\n"); for (i = 0; i < NB_BENCH_OP; i++) { - gmp_printf ("\tscore for %5s : %12Zd\n", arrayfunc[i].name, score[i]); + gmp_printf (" score for %4s %8Zd\n", arrayfunc[i].name, score[i]); if (i == NB_BENCH_OP-1 || arrayfunc[i +1].group != arrayfunc[i].group) { enum egroupfunc g = arrayfunc[i].group; - gmp_printf ("group score %s : %12Zd\n\n", groupname[g], groupscore[g]); + gmp_printf ("group score %s %6Zd\n\n", groupname[g], groupscore[g]); } } - gmp_printf ("global score : %12Zd\n\n", globalscore); + gmp_printf ("global score %13Zd\n\n", globalscore); for (i = 0; i < NB_BENCH_OP; i++) -- cgit v1.2.1