From owner-help-octave at bevo dot che dot wisc dot edu Fri Mar 22 10:04:58 1996 Subject: Benchmark for 486DX/Linux was: Slow Performance on Linux From: Francesco Potorti` To: Octave help Date: Fri, 22 Mar 96 17:05 MET This is a new version of the benchmark for octave. Improvements: - This version of the benchmark introduces a version number (so one knows if figures obtained are comparable). - It writes the results using a Sun Sparc 2 as reference (it is the slowest machine it has been run on until now). - It should be possible to tun it also on machines where cputime() does not work. A warning is printed at the beginning saying that the results can only be accurate if no other process is running at the time. - I renamed it benchmark.m. The original problem which this thread originated from is still unresolved: why on th earth a particular lsode problem proposed by Evan Thomas is much slower than the other operations on Linux? ----------------- benchmark.m --------------------- bm_version = 0.01; # This is a first attempt at a simple benchmark for octave. # Francesco Potorti` # Fri Mar 22 16:37:46 MET 1996 printf ("Octave benchmark version %g\n", bm_version); clear bm_st bm_et if (cputime() == 0) # Use these function if cputime() does not work on this particular # port of octave. In this case, time will be computed on a wall # clock, and will make sense only on a machine where no other # processes are consuming significant cpu time while the benchmark # is running. disp ... ("WARNING: if other processes are running the figures will be inaccurate"); function t = bm_st () t = clock(); endfunction function et = bm_et (t); et = etime(clock(),t); endfunction else function t = bm_st () t = cputime(); endfunction function et = bm_et (t) et = cputime() - t; endfunction endif # Used for the lsode test. clear xdot function xdot = xdot (x, t) r = 0.25; k = 1.4; a = 1.5; b = 0.16; c = 0.9; d = 0.8; xdot(1) = r*x(1)*(1 - x(1)/k) - a*x(1)*x(2)/(1 + b*x(1)); xdot(2) = c*a*x(1)*x(2)/(1 + b*x(1)) - d*x(2); endfunction # # Do benchmark # nf = 3; # Number of tests sparc2 = [0.74, 4.0, 8.9]; # Sun Sparc 2 is the reference clear bm_time function bm_time = test(f) # Actual test functions global s0, t; start = bm_st(); if (f == 1) inv(hadamard(7)); elseif(f==2) inv(hadamard(8)); elseif(f==3) lsode("xdot",[1;2],(t=linspace(0,50,200)')); endif bm_time = bm_et(start); endfunction targetaccuracy = 0.025; minrepetitions = 10; maxrepetitions = 10000; maxseconds = 60; printf ("Speed of octave %s on %s relative to a Sun Sparc 2\n", ... version(), computer()); for f = 1:nf res = []; test(f); # run a first test to increase the RSS, load things and so on tic(); for rep = 1:maxrepetitions res(rep) = sparc2(f) / test(f); if (rep < minrepetitions) continue endif # purged results: remove min and max elements pres = res((res != max(res)) & (res != min(res))); if (std(pres)/mean(pres) < targetaccuracy || toc() > maxseconds) break endif endfor # print 95% confidence interval printf("test #%d\t\t%4.2f +/- %.1f%% (%d runs)\n", ... f, mean(pres), 200*std(pres)/mean(pres), rep); endfor