[gradsusr] optimization of memory in grads, use undefine

Jennifer Adams jma at cola.iges.org
Tue Dec 18 17:58:21 EST 2012


These are all good suggestions. I would add that many users use 'define' when 'display' would do just as nicely. You can exploit the recursive nature of the expression handler to embed expressions within expressions. It depends on what you're calculating, of course -- sometimes using defined variables is unavoidable. --Jennifer


On Dec 18, 2012, at 5:30 PM, Muhammad Yunus Ahmad Mazuki wrote:

> You could use undefine to free memory allocated to variable that you dont need anymore. Say you had A=5. Then you compute B=6*A. Then C=A*B. Each of this simple step would have certain memory allocated to A, B and C. This is simple variables, that means the memory allocated is small. But if A to C were to contain any of your file parameter such as temperature, the allocated memory will be larger. So by the time you have computed C, and you no longer needed A and B in further computation, you can use 'undefine A' and 'undefine B'. The emory allocated to A and B will be freed for you to use on other computation. How is your script actually is? Have you try to optimise your script? You can check http://www.iges.org/grads/gadoc/variable.html . Another part is to limit the size of your defined variable (A to C). For example:
> set lat 0 90
> set lon 0 360
> set lev 300 850
> set t 1 100
> define A=temp
> This would assign A to have temperature data from 0 to 90 Latitude, 0-360 latitude, 300-850 (I usually use geopotential height) and from t of 1-10. But do you need all of it to be in the variable A? Perhaps you had only need lat of 0-20 and longitude of 20-40. And further computation of A definitely only need lat of 0-20 and longitude of 20-40, in this case you had given unneeded memory allocation to A. Which if you repeat with other defined variables and calculations, the used memory will just build up, and you will run out allocated memory soon. You can try these two method first.
> 
> Yunus
> 
> On Mon, Dec 17, 2012 at 8:13 PM, Isaac Pozo <ipozo at mncn.csic.es> wrote:
> Hi, this is my first post to the grads list. I'm a biologist that has
> been working with grads for the last months, but now I'm facing memory
> problems.
> 
> 
> I'm trying to run a  script with 43825 times and seven variables.
> 
> I'm doing a series of arithmetical functions in between the variables,
> and generating more variables.
> 
> And I'm constantly getting memory dumps. "Unable to allocate data
> memory" "Size of request was 946620000 grid elements"
> 
> So apart of finding a good RAM computer, (I'm working in a 8 GB ram WK
> and have problems) I was wondering if somebody can guide me through
> documentation and tricks on how to optimize the scrip to save RAM.
> 
> I also have access to supercomputation and CUDA machines, does anyone
> have worked with this type of systems in GRADS
> 
> Thanks in advance  for your help
> 
> 
> 
> 
> _______________________________________________
> gradsusr mailing list
> gradsusr at gradsusr.org
> http://gradsusr.org/mailman/listinfo/gradsusr
> 
> _______________________________________________
> gradsusr mailing list
> gradsusr at gradsusr.org
> http://gradsusr.org/mailman/listinfo/gradsusr

--
Jennifer M. Adams
IGES/COLA
4041 Powder Mill Road, Suite 302
Calverton, MD 20705
jma at cola.iges.org



-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20121218/b0d03792/attachment-0003.html 


More information about the gradsusr mailing list