Re: NCL Wrapit + memory question

From: jonathan meyer <tallj03_at_nyahnyahspammersnyahnyah>
Date: Mon Nov 18 2013 - 10:02:12 MST

Hi Mary,
I began using the fortran code because the loop was taking an exceptionally long time to crunch through, and fortran is MUCH faster.

In a case like this, it might help if you could provide your datasets as well so we can try running the script
          This code is reading in a year of CFSR 6-hrly data (1460 x 37 x 361 x 720) for each 'yy' loop iteration, so it might be a little prohibitive to provide my dataset since it is so big.
          
First, how are you determining that the memory is growing? From looking at the script, it does look like you are doing the right thing with the "delete" command. It also looks like you are doing a good job of defining the NetCDF file before you write to it.
          Using the 'top' command, I'm watching the memory grow with each 'z' interation. The script eventually is 'killed' when it reaches maximum memory.

How big are your loops? That is, how many iterations are you doing with these two loops:
          For the loops, the yy loop is running from 1979-2009 (31 iterations) and the z loop is running for each vertical level (37). This gives variables for each 'z' iteration that are sized (1460 x 361 x 720).

I tested the code this weekend by turning off the call to the fortran library and still saw the memory grow each 'z' iteration.
Looking at the code, the only variable I could see that wasn't being deleted was the 'ncf' variable so I tried cutting the code down to write out a .nc file for each z iteration so I could delete the ncf variable after each 'z' iteration. With this, I was still seeing the memory grow. I'm rather confused as I have numerous other codes that are following similar paths but do not have a memory issue.
Thanks for any advice.Jon

> Subject: Re: NCL Wrapit + memory question
> From: haley@ucar.edu
> Date: Mon, 18 Nov 2013 09:48:33 -0700
> CC: ncl-talk@ucar.edu
> To: tallj03@hotmail.com
>
> Hi Jon,
>
> In a case like this, it might help if you could provide your datasets as well so we can try running the script.
>
> However, before we go that route, we can try some other things.
>
> First, how are you determining that the memory is growing? From looking at the script, it does look like you are doing the right thing with the "delete" command. It also looks like you are doing a good job of defining the NetCDF file before you write to it.
>
> The issue may be more with your nested do loops and not the Fortran code.
>
> How big are your loops? That is, how many iterations are you doing with these two loops:
>
> do yy = s_yy, e_yy
>
> do z = 0, n_lev-1
>
> ?
>
> Also, what version of NCL are you using?
>
> ncl -V
>
>
> --Mary
>
> On Nov 15, 2013, at 2:15 PM, jonathan meyer <tallj03@hotmail.com> wrote:
>
> > Hi,
> >
> > I've been quite happy to learn how useful the wrapit functionality can be in NCL. While I've successfully gotten wrapit to work, I am seeing memory usage grow with each call to my subroutines.
> >
> > I've checked to make sure unused ncl variables are being deleted each time through my loop.
> >
> > Being rather green with the workings of fortran memory allocation, I'm wondering if there is something I'm missing in my fortran code that is allowing the arrays to remain in memory? I was under the impression that non-allocated memory in the subroutine would be removed at the 'end' command, but maybe this isn't the case for how I've coded mine.
> >
> > Attached is a code snippet of the NCL code for the loop the wrapit is being used, as well as the .f script containing my subroutines.
> >
> > As always, thanks in advance.
> >
> > Jon
> > <Ageowinds.ncl><JDMlib.f>_______________________________________________
> > ncl-talk mailing list
> > List instructions, subscriber options, unsubscribe:
> > http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
                                               

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Mon Nov 18 10:02:48 2013

This archive was generated by hypermail 2.1.8 : Fri Nov 22 2013 - 09:36:32 MST