[f2py] problem with maximum allowed size
William Henney
w.henney at astrosmo.unam.mx
Fri Nov 30 16:50:58 EET 2007
Hi list
On 11/30/07, jsitaraman at gmail.com <jsitaraman at gmail.com> wrote:
> This is a classic stack overflow problem, its got nothing to do with f2py
> don't declare large arrays in stack, A(200,200,N)
>
>
Just to expand on jsitaraman's reply: one solution is to increase your
maximum stack size. How to do this is very system-dependent, but on
linux/unix systems with the bash shell you could try "ulimit -s
unlimited". However, this approach may degrade run-time performance.
The other option is to use allocatable arrays (which are always
generated on the heap) instead of automatic arrays (which are usually
generated on the stack). If you don't understand this, you might want
to look at a fortran reference (for example, Metcalf, Reid, & Cohen -
"fortran 95/2003 explained", Chapter 6, sections 6.4 & 6.5)
Cheers
Will
> On Nov 30, 2007 7:14 AM, Martinho MA < mma at ua.pt> wrote:
> > Hello, I just started using f2py and I found a big problem ... using the
> > very simple subroutine:
> >
> > subroutine roms_slicez(s,N)
> > integer N
> > real A(200,200,N), s(200,200)
> > Cf2py intent(out) s
> > print*, N
> > end
> >
> >
> > compiled as : f2py -c prog.f -m prog
> >
> > works file with N=50 but for N=60 a segmentation fault occurs !!!
> >
--
Dr William Henney, Centro de Radioastronomía y Astrofísica,
Universidad Nacional Autónoma de México, Campus Morelia
More information about the f2py-users
mailing list