[f2py] problem with maximum allowed size
jsitaraman at gmail.com
jsitaraman at gmail.com
Sat Dec 1 04:53:18 EET 2007
hi will and martinho,
Just to add, depending on installations
the stand alone fortran compilation might be creating a statically linked
executable which will not
suffer from the stack allocation problem as a dynamically linked python
shared object.
and yes move to f90... get those f77 legacy codes rewritten
Jay
On Nov 30, 2007 11:43 AM, Menger, William M. <bill.menger at conocophillips.co=
m>
wrote:
> On the related note of using f77 vs f90, I highly recommend you begin
> using f90 and (over time if you have a large code base) start moving away
> from any common blocks (if you have any), and start using the f90
> allocatables and pointers/targets. We moved a large code base from f77 w=
ith
> cray pointers into f90 in 1999-2000 and it is a much better place to do m=
ore
> "object oriented (lite)" programming. You will find better memory
> management and better array syntax.
>
> The reason ulimit works is likely that your python environment is now able
> to use a much larger stack space. The reason you may not be seeing this
> with your f77 executables is that your linker defaults for f77 are asking
> for a larger stack by default than python is.
>
> hope that helps a bit...
> (g95 is free but won't handle all of the possible code constructs. We've
> had good luck with Absoft, Portland group, and Intel compilers for fortra=
n.)
>
>
> Bill Menger
> William M. Menger
> Software and High Performance Computing
> ConocoPhillips
> 600 North Dairy Ashford
> Houston, TX 77079
> (281)-293-3571
>
> -----Original Message-----
> From: f2py-users-bounces at cens.ioc.ee [mailto:
> f2py-users-bounces at cens.ioc.ee] On Behalf Of Martinho MA
> Sent: Friday, November 30, 2007 9:51 AM
> To: f2py-users at cens.ioc.ee; William Henney
> Subject: Re: [f2py] problem with maximum allowed size
>
> Ok,
> But this subroutine was just an exmple, real one is more like:
>
> subroutine slicez(s,L,M,N)
> integer L,M,N
> real A(L,M,N), s(L,M)
> Cf2py intent(out) s
>
> c some operations with A producing s
> ...
>
> print*, N
> end
>
>
> So, when I put this inside a fortran program it runs without problem !
> Besides, a 3D array with shape 200,200,50 is nothing ! So, if it runs
> inside my program, is it must be something to do with f2py.
> About allocated arrays... I am using fortran 77, so I cannot use them.
> The funniest thing is that using ulimit ... works :)
>
> So please someone explain me why fortran main works and inside python not.
> My unique solutions are ulimit or f90 ?
>
> Well, thanks
> mma
>
>
> William Henney escribi=F3:
> > 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=3D50 but for N=3D60 a segmentation fault occurs !!!
> >>>
> >>>
> >
> >
>
>
> _______________________________________________
> f2py-users mailing list
> f2py-users at cens.ioc.ee
> http://cens.ioc.ee/mailman/listinfo/f2py-users
>
> _______________________________________________
> f2py-users mailing list
> f2py-users at cens.ioc.ee
> http://cens.ioc.ee/mailman/listinfo/f2py-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://cens.ioc.ee/pipermail/f2py-users/attachments/20071130/09e98148/=
attachment-0001.htm
More information about the f2py-users
mailing list