Re: malloc error in area_hi2lores

From: Erik Noble <enoble_at_nyahnyahspammersnyahnyah>
Date: Fri, 12 Jun 2009 23:45:11 -0400

This function works when I use it on smaller file inputs. Thank you for the
help.
I have a new problem with area hi2lore bu I'll put that in a different post.
-Erik

On Fri, Jun 12, 2009 at 12:26 PM, Erik Noble <enoble_at_giss.nasa.gov> wrote:

> Thank you Dennis, Mary. and Jamie. I am trying out the different options
> that you've suggested and I'll keep you posted.
>
> I have 4GB of memory though.
>
>
> On Fri, Jun 12, 2009 at 12:21 PM, Dennis Shea <shea_at_ucar.edu> wrote:
>
>> Erik Noble wrote:
>> >>> Could I please have help understanding this error and how to get
>> around it?
>> >>>(My variable is not over 2 GB.)
>> [SNIP]
>> >>Hi. I fixed those errors. Lat variable is monotonically increasing
>> >>(ncl 7> rain_new=p(:,::-1,:) ) and the lat and lon variables are not
>> >>transposed in the are_hi2low function.Thank you for catching those two.
>> >>But I am still getting this error.
>> >>
>> >>ncl(96407) malloc: *** mmap(size=1327104000) failed (error code=12)
>> >>*** error: can't allocate region
>> >>*** set a breakpoint in malloc_error_break to debug
>> >>Bus error
>>
>> --------------------------------------------------------
>> [1]
>> The malloc error is not an issue of variable size. Rather, it is a
>> machine memory issue. My speculation is that you
>> have (say) one GB of machine memory. Not all of this
>> is available for user software. Some of this is taken by
>> the system. The input variable is 664MB. The output
>> variable will be 332MB. Under the hood, the function
>> allocates temporary work arrays for efficiency reasons.
>> The "malloc" error occurs when NCL's underlying C-code
>> tries to request more memory than is available.
>>
>> [2]
>> One Solution: *untested*
>>
>> dims = filevardimsizes(a, "CMOPRH_RAIN_RATE")
>> ntim = dims(0)
>> po = new ( (/ntim,dims(1)/2,dims(2)/2, "float", -9999.)
>>
>> do nt=0,ntim-1 ; interpolate one grid at a time
>> pi = a->CMOPRH_RAIN_RATE(nt,:,:)
>> po(nt,:,:) = area_hi2lores_Wrap (pi&lon,pi&lat, pi , True, 1,
>> Lon, Lat, False)
>> end do
>>
>> Of course, this will be slower because the area_hi2lores does some over
>> head
>> calculations.
>>
>>
>> Erik Noble wrote:
>> > Hi. I fixed those errors. Lat variable is monotonically increasing
>> > (ncl 7> rain_new=p(:,::-1,:) ) and the lat and lon variables are not
>> > transposed in the are_hi2low function.Thank you for catching those two.
>> >
>> > But I am still getting this error.
>> >
>> >
>> > noble:CMORPH enoble$ ncl
>> > Copyright (C) 1995-2009 - All Rights Reserved
>> > University Corporation for Atmospheric Research
>> > NCAR Command Language Version 5.1.0
>> > The use of this software is governed by a License Agreement.
>> > See http://www.ncl.ucar.edu/ for more details.
>> > ncl 0> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
>> > ncl 1> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
>> > ncl 2> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
>> > ncl 3> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"
>> > ncl 4> load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"
>> > ncl 5> a = addfile("CMORPH_September_.25x.25.nc <http://25x.25.nc
>> >","r")
>> > ncl 6> p = a->CMOPRH_RAIN_RATE
>> > ncl 7> p =p(:,::-1,:)
>> > ncl 8> Lat = fspan(-59.875,59.875,240)
>> > ncl 9> Lon = fspan(-180,180,720)
>> > ncl 10> po = area_hi2lores_Wrap (p&lon,p&lat, p , True, 1, Lon, Lat,
>> > False)
>> > ncl(96407) malloc: *** mmap(size=1327104000) failed (error code=12)
>> > *** error: can't allocate region
>> > *** set a breakpoint in malloc_error_break to debug
>> > Bus error
>> > *****************************************
>> >
>> > BELOW,I used the example from the NCL website and it worked (below).
>> > But when I try to interpolate the to the grid I need, it gives me an
>> > error (above.)
>> >
>> > noble:CMORPH enoble$ ncl
>> > Copyright (C) 1995-2009 - All Rights Reserved
>> > University Corporation for Atmospheric Research
>> > NCAR Command Language Version 5.1.0
>> > The use of this software is governed by a License Agreement.
>> > See http://www.ncl.ucar.edu/ for more details.
>> > ncl 0> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
>> > ncl 1> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
>> > ncl 2> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
>> > ncl 3> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"
>> > ncl 4> load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"
>> > ncl 5> a = addfile("CMORPH_September_.25x.25.nc <http://25x.25.nc
>> >","r")
>> > ncl 6> p = a->CMOPRH_RAIN_RATE
>> > ncl 7> p =p(:,::-1,:) ; make lat monotonically increasing
>> > ncl 8> LON = fspan(-178.5,178.5, 120)
>> > ncl 9> LAT = fspan(-48,48, 49)
>> > ncl 10> po = area_hi2lores_Wrap (p&lon,p&lat, p , True, 1, LON,
>> > LAT, False) ; (ntim,49,120)
>> > ncl 11> printMinMax(po, True)
>> > (0)
>> > (0) CMORPH: min=0 max=11.5147
>> > ncl 12> printMinMax(p, True)
>> > (0)
>> > (0) CMORPH: min=0 max=40.3708
>> >
>> >
>> >
>> > _______________________________________________
>> > 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
>>
>
>

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Fri Jun 12 2009 - 21:45:11 MDT

This archive was generated by hypermail 2.2.0 : Mon Jun 15 2009 - 08:53:05 MDT