Hi all, I would like to measure the CPU-time which is required to solve the eigenvalue problem w, vr = linalg.eig(A,B) How can I do that in scipy ? A small example would be appreciated. Where can I find some background information concerning timing ? Is thera any other meaningful measure in this context ? Nils
I would like to measure the CPU-time which is required to solve the eigenvalue problem
w, vr = linalg.eig(A,B)
How can I do that in scipy ? A small example would be appreciated.
I'd say import time t0 = time.time() big_calculation() t1 = time.time() time_used = t1 - t0 And you can also use profile. Gives you detailed information about this kind of stuff. And if you use IPython: try @prun, which is very convenient to this stuff. If you don't use IPython: check it out, it's great! :) bye, Kasper
Nils Wagner wrote:
Hi all,
I would like to measure the CPU-time which is required to solve the eigenvalue problem
w, vr = linalg.eig(A,B)
How can I do that in scipy ? A small example would be appreciated.
Where can I find some background information concerning timing ?
For Unix systems: please don't use either time.clock() or time.time() as suggested in other replies (sorry guys :) time.clock() suffers from wraparound problems, and time.time() is wall time, not cpu time. If you want to use ipython, it comes with a suite of builtin timing routines. They are NOT self-calibrating, so their own overhead WILL matter for micro-timings. Rather, they are designed for reliably timing long running codes, more typical of scientific problems. They rely on resource.getrusage, so they avoid the wraparound problems of time.clock(). If you don't use ipython and don't want to, drop me a line and I'll send you the timing codes separately. Cheers, f. ps. under windows, I have no idea what the best strategy is. Probably changing OS ;)
------------------- Nils Wagner wrote:
Hi all,
I would like to measure the CPU-time which is required to solve the eigenvalue problem
w, vr = linalg.eig(A,B)
How can I do that in scipy ? A small example would be appreciated.
Where can I find some background information concerning timing ?
For Unix systems: please don't use either time.clock() or time.time() as suggested in other replies (sorry guys :) time.clock() suffers from wraparound problems, and time.time() is wall time, not cpu time. what is the difference between wall time and cpu time ? If you want to use ipython, it comes with a suite of builtin timing routines. They are NOT self-calibrating, so their own overhead WILL matter for micro-timings. Rather, they are designed for reliably timing long running codes, more typical of scientific problems. They rely on resource.getrusage, so they avoid the wraparound problems of time.clock(). If you don't use ipython and don't want to, drop me a line and I'll send you the timing codes separately. It would be very kind of you, if you could send me the codes. Thanks in advance Nils Cheers, f. ps. under windows, I have no idea what the best strategy is. Probably changing OS ;) _______________________________________________ SciPy-user mailing list SciPy-user@scipy.net http://www.scipy.net/mailman/listinfo/scipy-user
Nils Wagner wrote:
It would be very kind of you, if you could send me the codes.
Thanks in advance
The timings section is included here. Best, f. ps. you need to fix your mail client's quoting. It took me a while to find what was your new message because your client isn't properly quoting any text. In a longer message, it will be basically impossible to see what you are writing vs. the quoted materials.
------------------- Nils Wagner wrote:
It would be very kind of you, if you could send me the codes.
Thanks in advance
The timings section is included here. Best, f. ps. you need to fix your mail client's quoting. It took me a while to find what was your new message because your client isn't properly quoting any text. In a longer message, it will be basically impossible to see what you are writing vs. the quoted materials. Thank you for your prompt reply. How do I use timing.py ? Where, i.e. In which directory, do I put this file ? Nils
Nils Wagner wrote:
ps. you need to fix your mail client's quoting. It took me a while to find what was your new message because your client isn't properly quoting any text. In a longer message, it will be basically impossible to see what you are writing vs. the quoted materials.
Thank you for your prompt reply. How do I use timing.py ? Where, i.e. In which directory, do I put this file ?
Wherever you want. I just stripped the timings section from IPython.genutils to hand it to you, and gave it a reasonable sounding name. As for usage, please see the code. Every function has a very detailed docstring. If you encounter a specific problem, let me know and I'll try to help. And please fix your mail client. Replying to your messages is annoyingly difficult because without carefully reading and remembering what the previous message was, there is no way to tell what is quoted and what is new text written by you. Best, f.
Hi all, How do I install IPython via cvs ? python setup.py build python setup.py install Is that o.k. ? Nils
On Wed, 28 May 2003, Nils Wagner wrote:
Hi all,
I would like to measure the CPU-time which is required to solve the eigenvalue problem
w, vr = linalg.eig(A,B)
How can I do that in scipy ? A small example would be appreciated.
See for example test_eigvals.bench_random method in linalg/tests/test_decomp.py
Where can I find some background information concerning timing ?
Is thera any other meaningful measure in this context ?
On Linux the best measure is jiffies function from scipy_test.testing, IMHO:
from scipy_test.testing import jiffies print jiffies.__doc__ Return number of jiffies (1/100ths of a second) that this process has been scheduled in user mode. See man 5 proc.
(that on other platforms uses time.time because of lack of knowledge from my part how to get jiffies on those platforms). There is also related function memusage:
from scipy_test.testing import memusage print memusage.__doc__ Return virtual memory size in bytes of the running python.
that can be handy for discovering memory leaks under Linux. Pearu
participants (6)
-
Fernando Perez -
Francesc Alted -
Kasper Souren -
Nils Wagner -
Nils Wagner -
Pearu Peterson