[Numpy-discussion] Execution time difference between 2.7 and 3.2 using numpy

Daπid davidmenhur@gmail....
Wed Mar 20 09:14:06 CDT 2013


Without much detailed knowledge of the topic, I would expect both
versions to give very similar timing, as it is essentially a call to
ATLAS function, not much is done in Python.

Given this, maybe the difference is in ATLAS itself. How have you
installed it? When you compile ATLAS, it will do some machine-specific
optimisation, but if you have installed a binary chances are that your
version is optimised for a machine quite different from yours. So, two
different installations could have been compiled in different machines
and so one is more suited for your machine. If you want to be sure, I
would try to compile ATLAS (this may be difficult) or check the same
on a very different machine (like an AMD processor, different
architecture...).



Just for reference, on Linux Python 2.7 64 bits can deal with these
matrices easily.

%timeit mat=np.random.random((6143,6143)); matinv= np.linalg.inv(mat);
res = np.dot(mat, matinv); diff= res-np.eye(6143); print
np.sum(np.abs(diff))
2.41799631031e-05
1.13955868701e-05
3.64338191541e-05
1.13484781021e-05
1 loops, best of 3: 156 s per loop

Intel i5, 4 GB of RAM and SSD. ATLAS installed from Fedora repository
(I don't run heavy stuff on this computer).

On 20 March 2013 14:46, Colin J. Williams <cjw@ncf.ca> wrote:
> I have a small program which builds random matrices for increasing matrix
> orders, inverts the matrix and checks the precision of the product.  At some
> point, one would expect operations to fail, when the memory capacity is
> exceeded.  In both Python 2.7 and 3.2 matrices of order 3,071 area handled,
> but not 6,143.
>
> Using wall-clock times, with win32, Python 3.2 is slower than Python 2.7.
> The profiler indicates a problem in the solver.
>
> Done on a Pentium, with 2.7 GHz processor, 2 GB of RAM and 221 GB of free
> disk space.  Both Python 3.2.3 and Python 2.7.3 use numpy 1.6.2.
>
> The results are show below.
>
> Colin W.
>
> aaaa_ssss
> 2.7.3 (default, Apr 10 2012, 23:31:26) [MSC v.1500 32 bit (Intel)]
> order=    2   measure ofimprecision= 0.097   Time elapsed (seconds)=
> 0.004143
> order=    5   measure ofimprecision= 2.207   Time elapsed (seconds)=
> 0.001514
> order=   11   measure ofimprecision= 2.372   Time elapsed (seconds)=
> 0.001455
> order=   23   measure ofimprecision= 3.318   Time elapsed (seconds)=
> 0.001608
> order=   47   measure ofimprecision= 4.257   Time elapsed (seconds)=
> 0.002339
> order=   95   measure ofimprecision= 4.986   Time elapsed (seconds)=
> 0.005747
> order=  191   measure ofimprecision= 5.788   Time elapsed (seconds)=
> 0.029974
> order=  383   measure ofimprecision= 6.765   Time elapsed (seconds)=
> 0.145339
> order=  767   measure ofimprecision= 7.909   Time elapsed (seconds)=
> 0.841142
> order= 1535   measure ofimprecision= 8.532   Time elapsed (seconds)=
> 5.793630
> order= 3071   measure ofimprecision= 9.774   Time elapsed (seconds)=
> 39.559540
> order=  6143 Process terminated by a MemoryError
>
> Above: 2.7.3  Below: Python 3.2.3
>
> bbb_bbb
> 3.2.3 (default, Apr 11 2012, 07:15:24) [MSC v.1500 32 bit (Intel)]
> order=    2   measure ofimprecision= 0.000   Time elapsed (seconds)=
> 0.113930
> order=    5   measure ofimprecision= 1.807   Time elapsed (seconds)=
> 0.001373
> order=   11   measure ofimprecision= 2.395   Time elapsed (seconds)=
> 0.001468
> order=   23   measure ofimprecision= 3.073   Time elapsed (seconds)=
> 0.001609
> order=   47   measure ofimprecision= 5.642   Time elapsed (seconds)=
> 0.002687
> order=   95   measure ofimprecision= 5.745   Time elapsed (seconds)=
> 0.013510
> order=  191   measure ofimprecision= 5.866   Time elapsed (seconds)=
> 0.061560
> order=  383   measure ofimprecision= 7.129   Time elapsed (seconds)=
> 0.418490
> order=  767   measure ofimprecision= 8.240   Time elapsed (seconds)=
> 3.815713
> order= 1535   measure ofimprecision= 8.735   Time elapsed (seconds)=
> 27.877270
> order= 3071   measure ofimprecision= 9.996   Time elapsed
> (seconds)=212.545610
> order=  6143 Process terminated by a MemoryError
>
>
>
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion@scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>


More information about the NumPy-Discussion mailing list