help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Slow performance on Linux


From: Francesco Potorti`
Subject: Slow performance on Linux
Date: Wed, 20 Mar 96 12:04 MET

I put together a bm.m file, modified from that posted by Evan Thomas.

I added 95% confidence interval estimates on the benchmark results.  A
first test is done to get rid of first time slowness (paging in,
loading and compiling functions), then 10 tests are run, the fastest
and slowest are removed, and the 95% confidence interval (supposing
the distribution gaussian) is computed.  If it exceeds +/-5% of the
mean, more tests are run up to a maximum of 1000, then the results are
printed.  If the confidence interval printed exceeds +/-5%, it means
that the times are very variable, probably because of other processes
running together with octave.

I prefer inversion of a known matrix rather than a random one to get
more consistent benchmark results.

I also prefer cputime() to tic() and toc(), because the first one is
less dependent on the overall load of the machine.

I set up a framework for easily adding new tests.  Currently, three of
them are done: two hadamard matrix inversions and an lsode call.  It
would be nice to substitute the sEPSP function with something simpler,
and add some more tests.  Adding test is easily done by modifying the
test(f) function and changing the nf variable.

It would also be nice to grow this to a complete benchmark for octave,
even nicer if it was made compatible with matlab.

Here are the results I obtained on an alpha machine.  I am sending two
sets of results, which mainly differ in their accuracy: the machine
was heavily loaded when I ran the first test, and I suppose it was not
when I ran the second one.  I think swapping and task switching make
for the difference.

octave> bm
test #1          0.11882 +/- 15.2% (1000 runs)
test #2         0.585831 +/- 16.2% (1000 runs)
test #3          8.59008 +/- 11.2% (1000 runs)

octave> bm
test #1         0.0997472 +/- 3.2% (10 runs)
test #2          0.46482 +/- 1.2% (10 runs)
test #3          8.19328 +/- 0.5% (10 runs)


------------------------ bm.m ----------------------
#
# Set up global parms, load sripts, etc for sEPSP
#

# These control the driver
global freq dur height width;
freq = 2;
dur = 1;
height = 1;
width = 0.1;

# These control the internal cascade
global alpha beta;
alpha = [1, 1, 1];
beta  = [0.5, 0.5, 0.5];

# These are the normal sEPSP boundary/range conditions
global s0 t;
s0 = [0, 0, 0, 0];
t = (0:0.1:20)';    # <<<=== change the step size to vary run time
#
# Octave script for second messanger driver.
#
# The function produces a series of square pulse
# paramterized by the values shown below.

function ret = driver(t)

  if( !is_vector(t) )
    ret = driver_single(t);
    return;
  endif

  for i = 1:length(t)
    ret (i) = driver_single(t (i));
    i++;
  endfor

  return;

endfunction

#
# The equations "describing" the second messenger cascade
#
function sdot = sEPSP(s, t)

  global alpha beta;

  sdot(1) = alpha(1)*driver(t) - beta(1)*s(1);
  sdot(2) = alpha(2)*s(1) - beta(2)*s(2);
  sdot(3) = alpha(3)*s(2) - beta(3)*s(3);

endfunction


# The function produces a series of square pulse
# paramterized by the values shown below.
 
 
function ret = driver_single(t)
 
  global freq dur height width;
 
  ret = 0;
 
  if( t > dur+width )
    return;
  endif
 
  b = floor(t*freq)/freq;
  if( b <= t && t < b+width )
    ret = height;
  endif
 
  return;
 
endfunction


#
# Do benchmark
#
function time = test (f)
  global s0, t;
  oldtime = cputime;
  if (f == 1)     inv (hadamard (7));
  elseif (f == 2) inv (hadamard (8));
  elseif (f == 3) lsode ("sEPSP",s0,t);
  endif;
  time = cputime - oldtime;
endfunction;

nf = 3;
targetaccuracy = 0.025;
minrepetitions = 10;
maxrepetitions = 1000;

for f = 1:nf
  test (f);  # run a first test to increase the RSS, load things and so on
  res = [];
  for rep = 1:maxrepetitions
    res(rep) = test (f);
    if (rep < minrepetitions) continue endif;
    # purged results: remove min and max elements
    purged = (res != max(res)) & (res != min(res));
    pres = res(purged);
    if (std(pres)/mean(pres) < targetaccuracy) break endif;
  endfor;
  # print 95% confidence interval
  printf ("test #%d\t\t%8g +/- %.1f%% (%d runs)\n",
          f, mean(pres), 200*std(pres)/mean(pres), rep);
endfor;


--
Francesco Potorti`                  Voice:    +39-50-593203
Satellite Network Group             Operator: +39-50-593111
CNUCE-CNR, Via Santa Maria 36       Fax:      +39-50-904052(G3)/904051(G4)
56126 Pisa - Italy                  Email:    address@hidden


reply via email to

[Prev in Thread] Current Thread [Next in Thread]