Re: NclMalloc Failed:[errno=12]...switch to float?

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Tue, 22 Sep 2009 12:27:16 -0600

Dave is correct.

Mitigation:

    WSPD = sqrt(UAS^2 + VAS^2) ; calculate wind speed magnitude
    copy_VarMeta(UAS, WSPD)
    delete(UAS) ; free memory
    delete(VAS)
 

FYI:
NCL does *all* computations in double precision.
The underlying interface to the computational code promotes the float
input array
to type double.

Dave Allured wrote:
> DJ,
>
> This looks like just a normal memory limit problem. This probably
> has nothing to do with the data type. The WPSD array is huge, 1/2
> Gb. And that is on top of other large arrays that you had already
> allocated. You probably exceeded memory available to NCL on the
> first statement that tried to create WPSD.
>
> Best practice for this kind of problem is to divide the computation
> into increments or slices along one dimension, whatever would be the
> simplest extension of your existing code. This is an example of
> where adding one do loop is appropriate.
>
> You could also try the unix unlimit command to increase available
> memory, but that may not work when you are approaching physical
> memory limits. HTH.
>
> Dave Allured
> CU/CIRES Climate Diagnostics Center (CDC)
> http://cires.colorado.edu/science/centers/cdc/
> NOAA/ESRL/PSD, Climate Analysis Branch (CAB)
> http://www.cdc.noaa.gov/psd1/
>
> DJ Rasmussen wrote:
>
>> I have a NCL file that calls in some files (up to 14) then
>> computes some averages of them. However, with NCL version
>> 5.1.1 I get the following error:
>>
>> fatal:NclMalloc Failed:[errno=12]
>> fatal:dim_avg_n: Could not coerce input data to double,
>> can't continue
>> fatal:Execute: Error occurred at or near line 40 in file
>> NARCCAPAVG.ncl
>>
>> Which I know has something to do with memory allocation. I
>> am guessing I need to have my variables somehow be set to
>> float when I use the function dim_avg_n_Wrap. Here is a
>> print out of my variable, WSPD:
>>
>> Variable: WSPD
>> Type: float
>> Total Size: 488317440 bytes
>> 122079360 values
>> Number of Dimensions: 3
>> Dimensions and sizes: [time | 8760] x [yc | 104] x [xc |
>> 134]
>> Coordinates:
>> time: [0.125..1096]
>> yc: [600000..5750000]
>> xc: [600000..7250000]
>> Number Of Attributes: 9
>> _FillValue : 1e+20
>> original_units : m s-1
>> original_name : UA
>> missing_value : 1e+20
>> coordinates : lon lat level
>> units : m s-1
>> long_name : wind speed
>> standard_name : eastward_wind
>> grid_mapping : Transverse_Mercator
>>
>>
>> Looking at the NCL archive, I didn't see anything related
>> to this particular problem with this function,
>> dim_avg_n_Wrap. Maybe because it is rather new?
>>
>> Any advice would be helpful.
>>
>>
>> My code:
>>
>> ;*************************************************
>> ;NARCCAPAVG.ncl
>> ;
>> ;************************************************
>> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
>> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
>> load
>> "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
>>
>> ;************************************************
>> begin
>>
>> ;************************************************
>> ; read in multiple netCDF files
>> ;************************************************
>> diri = "/home/rasmussen/NARCCAP/netCDF/RCM3/" ; directory
>> where files reside
>> fils = systemfunc("ls "+diri+"*as_RCM3_*.nc")
>> nfil = dimsizes(fils)
>> print(fils)
>>
>> ;*************************Get Variables**********
>> f = addfiles (fils, "r")
>>
>> UAS = f[:]->uas ; (time,yc,xc)
>> VAS = f[:]->vas ; (time,yc,xc)
>>
>> printVarSummary(UAS)
>> printVarSummary(VAS)
>>
>> WSPD = sqrt(UAS^2 + VAS^2) ; calculate wind speed
>> magnitude
>>
>> WSPD=(WSPD*2.2) ; convert to miles per hour
>>
>> copy_VarMeta(UAS, WSPD) ; copy dimensions to new
>> averaged wind speed array
>> WSPD_at_long_name = "wind speed"
>> printVarSummary(WSPD)
>>
>> ;*************************Calculate Average******
>>
>> WSPD_AVG = dim_avg_n_Wrap(WSPD,0) ; (lat,lon)
>> WSPD_AVG_at_long_name = "mean wind speed"
>>
>> printVarSummary(WSPD_AVG)
>>
>> ;************************************************
>> ; output ascii
>> ;************************************************
>>
>> fName = "RCM3AVG.txt"
>> system("/bin/rm -f "+fName) ; remove if file is present
>> asciiwrite (fName , WSPD)
>>
>> end
>> _______________________________________________
>> 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
>

-- 
======================================================
Dennis J. Shea                  tel: 303-497-1361    |
P.O. Box 3000                   fax: 303-497-1333    |
Climate Analysis Section                             |
Climate & Global Dynamics Div.                       |
National Center for Atmospheric Research             |
Boulder, CO  80307                                   |
USA                        email: shea 'at' ucar.edu |
======================================================
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Tue Sep 22 2009 - 12:27:16 MDT

This archive was generated by hypermail 2.2.0 : Thu Sep 24 2009 - 13:55:09 MDT