[SciPy-dev] Progress with linalg2

Pearu Peterson pearu at cens.ioc.ee
Sun Mar 3 17:32:11 CST 2002


Hi,

On Sun, 3 Mar 2002, eric wrote:

> I like "bench_".  short, sweet, and obvious (well hopefully).  Also, I guess we
> should start adding a "bench_suite" function to the test modules also.  At some
> point, we need to sub-class the unit test class to provide a few timing routines
> so that:
> 
>     def bench_solve(self):
>         <some setup code>
>         self.start_timer()
>         <run benchmark>
>         self.stop_timer()
> 
> The test case should keep up with the timing information internally.  A more
> sophisticated interface might be necessary, but this is a start.

In linalg2/tests/test_basic.py I have implemented BenchCase class for
simplifying benchmarking, and as you will see in test_solve, its usage is
really simple now. I would suggest that scipy_test will provide

class ScipyTestCase(unittest.TestCase, BenchCase):
    ...

that the test files should use as a base class. Feel free to choose better
names.

Another idea is about policy of running tests with different levels: 
  if a lower level test fails for some reasons, then higher level tests
  will be all skipped.
This is to avoid lots of error messages if something simple is wrong.
What do you think?

In case of interest, here are more test results that compare scipy vs
Numeric. Now, scipy is much faster than Numeric (you'll need
f2py>=2.13.175-1222): 

      Solving system of linear equations
      ==================================
      |    contiguous     |   non-contiguous 
----------------------------------------------
 size |  scipy  | Numeric |  scipy  | Numeric
   20 |   1.17  |   3.87  |   1.18  |   4.07     (secs for 2000 calls)
  100 |   1.60  |   3.11  |   1.61  |   3.99     (secs for 300 calls)
  500 |   1.64  |   2.12  |   1.64  |   2.38     (secs for 4 calls)
 1000 |   5.64  |   6.65  |   5.62  |   7.19     (secs for 2 calls)
.
           Finding matrix inverse
      ==================================
      |    contiguous     |   non-contiguous 
----------------------------------------------
 size |  scipy  | Numeric |  scipy  | Numeric
   20 |   1.50  |   5.94  |   1.49  |   6.15     (secs for 2000 calls)
  100 |   4.37  |   9.23  |   4.42  |  10.14     (secs for 300 calls)
  500 |   4.78  |   7.36  |   4.77  |   7.60     (secs for 4 calls)
 1000 |  17.55  |  24.59  |  17.53  |  24.49     (secs for 2 calls)
.
----------------------------------------------------------------------
Ran 13 tests in 207.334s


Pearu




More information about the Scipy-dev mailing list