Python Scientific and Numerical Computing (fast with pypy?)
Five minute lightning talk given at the pymntos (www.pymntos.org) monthly meeting. This talk reviews: if pypy is useful for numerical and scientific computing.
synthesizable descriptions and verification environments • Signal / data analysis (lab data, field data) • Before Python • HDL (Verilog/SV and VHDL), Matlab, and C/C++ • Ad hoc growth into a Python user
numpy* 1.000 1.000 0.126 0.136 7.7x 0.003 0.003 259.2x FFT Comparison ... wait there is more Not really a fair comparison ... let’s look a little closer ... the FFT available with the numpy package much faster def _fftr(x): n = len(x) if (n == 1): return x # even and odd parts X,Y = (x[::2], x[1::2],) Xr,Yr = (_fftr(X), _fftr(Y),) w = [(cos(2*pi*k/float(n)) + 1.j*sin(2*pi*k/float(n))) for k in range(n)] m = n/2; b = [Xr[(k%m)]+w[k]*Yr[(k%m)] for k in range(n)] return b Simple recursive FFT (python only) * The numpy FFT, optimized FFTW code @ http://www.dsprelated.com/showcode/16.php or www.bitbucket.org/cfelton/examples/src/tip/rfft
used in a simulation but more than just the FFT in the simulation. What is the overall performance? This simulation uses the FFT but the FFT speed up alone was not enough to affect the overall performance! Nfft, Nloops 4096, 1024 4096, 256 avg increase cpython pypy numpy 1.000 1.000 0.010 0.073 13.8x 1.005 0.987 1.0x 0 0.275 0.550 0.825 1.100 4096,1024 4096,256 4069,32 4096,8 128,128 Simulation 1 cpython pypy numpy
Python (golden models) • new C and fortran interfaces to existing packages (cffi and ???) • key portions written in rpython (this is what the pypy team is currently doing with numpypy)
analysis, classical signals and systems, etc • Yes - simulation: HDL simulation and Simulink like simulations • projects of interest (where applicable) • gnuradio for fpga (krypton) • large correlators for radio astronomy