[Numpy-discussion] ising model: f2py vs cython comparison

Travis E. Oliphant oliphant@enthought....
Sat Dec 22 19:49:36 CST 2007


Ondrej Certik wrote:
> Hi,
>
> I need to write 2D Ising model simulation into my school, so I wrote
> it in Python, then rewrote it in Fortran + f2py, and also Cython:
>
> http://hg.sharesource.org/isingmodel/
>
> And Cython solution is 2x faster than f2py. I understand, that I am
> comparing many things - wrappers, my fortran coding skills
> vs Cython C code generation and gcc vs gfortran. But still any ideas
> how to speed up fortran+f2py solution is very welcomed.
>   

My experience with similar kinds of comparisons is that gnu fortran 
compilers are not very good, especially on 2-d problems. Try using a 
different fortran compiler to see if speeds improve.

-Travis O.



More information about the Numpy-discussion mailing list