Re: Segmentation fault (core dumped)

From: Gus Correa <gus_at_nyahnyahspammersnyahnyah>
Date: Thu Jun 23 2011 - 09:01:22 MDT

Hi Vishali

I guess the NCL folks are busy in a workshop now.

Given the 2GB memory restriction,
I think you must read your data by parts.
Your 'w' shouldn't hold all of f->WSpeed.
You could read each file by parts,
and write an inner loop to accumulate the
partial results until the file is completely read.

Gus Correa

Vishali P. wrote:
> Please, can anyone help me with solution of this problem??
> I can provide more information if needed
>
>
> Thank you in advance
>
> Vishali
>
>
>
> On Mon, Jun 20, 2011 at 8:54 PM, Vishali P. <vishali.prat@gmail.com
> <mailto:vishali.prat@gmail.com>> wrote:
>
> Hi Gus Correa.
>
> It's 32-bit, with 2GB of memory
>
>
>
>
>
> On Mon, Jun 20, 2011 at 8:01 PM, Gus Correa <gus@ldeo.columbia.edu
> <mailto:gus@ldeo.columbia.edu>> wrote:
>
> Hi Vishali
>
> If your files have one year of 4x daily data,
> you have 4*365*17*73*144 = 260,907,840 numbers on each variable
> stored there.
> If they're floating point (4 bytes) this is ~ 1GB,
> if they're double (8 bytes) this is ~ 2GB.
> You may be on the bleeding edge with variable
> w = f->WSpeed.
> You also need memory for the other variables (wMon, etc), for
> the OS,
> the NCL executable, and so on.
>
> I wonder if the problem is this.
> How much memory does your computer have?
> Is it a 32- or 64-bit machine?
> NCL 5.2 only supports variables up to 2GB large.
> NCL 6.0 supports up to the physical RAM available,
> *if* your computer is 64-bit.
>
> My two cents,
> Gus Correa
>
> Vishali P. wrote:
> > Hi
> >
> >
> > [ 1 ] Output of first separated script
> >
> > Variable: nfilu
> > Type: integer
> > Total Size: 4 bytes
> > 1 values
> > Number of Dimensions: 1
> > Dimensions and sizes: [1]
> > Coordinates:
> > (0) 7
> >
> >
> > Variable: filu
> > Type: string
> > Total Size: 28 bytes
> > 7 values
> > Number of Dimensions: 1
> > Dimensions and sizes: [7]
> > Coordinates:
> > (0) wind.1998.nc <http://wind.1998.nc> <http://wind.1998.nc>
> > (1) wind.1999.nc <http://wind.1999.nc> <http://wind.1999.nc>
> > (2) wind.2000.nc <http://wind.2000.nc> <http://wind.2000.nc>
> > (3) wind.2001.nc <http://wind.2001.nc> <http://wind.2001.nc>
> > (4) wind.2002.nc <http://wind.2002.nc> <http://wind.2002.nc>
> > (5) wind.2003.nc <http://wind.2003.nc> <http://wind.2003.nc>
> > (6) wind.2004.nc <http://wind.2004.nc> <http://wind.2004.nc>
> >
> >
> >
> > [ 2 ] Output of second separated Script
> >
> > (0) success
> >
> >
> >
> > [ 3 ] Output ncl_filedump of 1st file ( wind speed of 1998),
> i got :
> >
> > Variable: f (file variable)
> >
> > filename: wind.1998
> > path: wind.1998.nc <http://wind.1998.nc> <http://wind.1998.nc>
> > file global attributes:
> > CDI : Climate Data Interface version 1.4.1
> > Conventions : CF-1.0
> > history : Mon Oct 18 11:24:43 2010: cdo mergetime
> wind1998a.nc <http://wind1998a.nc>
> > <http://wind1998a.nc> wind1998b.nc <http://wind1998b.nc>
> <http://wind1998b.nc> wind.1998.nc <http://wind.1998.nc>
> > <http://wind.1998.nc>
> > CDO : Climate Data Operators version 1.4.1
> > (http://www.mpimet.mpg.de/cdo)
> > dimensions:
> > lon = 144
> > lat = 73
> > level = 17
> > time = 1460 // unlimited
> > variables:
> > float lon ( lon )
> > long_name : Longitude
> > units : degrees_east
> > standard_name : longitude
> >
> > float lat ( lat )
> > long_name : Latitude
> > units : degrees_north
> > standard_name : latitude
> >
> > float level ( level )
> > long_name : Level
> > units : millibar
> > axis : z
> >
> > double time ( time )
> > units : hours since 1800-01-01 00:00:00
> > calendar : standard
> >
> > float WSpeed ( time, level, lat, lon )
> > long_name : Wind Speed
> > standard_name : eastward_wind
> > units : m/s
> > _FillValue : -32767
> > valid_range : ( -140, 174.989990234375 )
> > parent_stat : Other
> > statistic : Individual Obs
> > level_desc : Pressure Levels
> > dataset : NCEP/DOE AMIP-II Reanalysis (Reanalysis-2)
> > var_desc : u-wind
> > GRIB_name : UGRD
> > GRIB_id : 33
> > least_significant_digit : 1
> > precision : 2
> > actual_range : ( -87.30000305175781, 129.5 )
> > unpacked_valid_range : ( -140, 175 )
> >
> >
> >
> >
> > Thank you
> >
> > Vishali
> >
> >
> >
> >
> >
> > On Mon, Jun 20, 2011 at 4:06 PM, Dennis Shea <shea@ucar.edu
> <mailto:shea@ucar.edu>
> > <mailto:shea@ucar.edu <mailto:shea@ucar.edu>>> wrote:
> >
> > You must help with more information:
> >
> > ==============================__====
> > Try some different approaches. Isolate the following,
> > as a separate script. run it
> >
> >
> >
> > diru = "/home/Vishali/Documents/__dadosVentos/Speed/"
> > filu = systemfunc("cd "+diru+" ; ls wind*nc")
> > nfilu = dimsizes(filu)
> >
> > print(nfilu)
> > print(filu)
> >
> > ==============================__==
> > Another separate script:
> >
> >
> > yrStrt = 1998
> > yrLast = 2004
> > nyrs = yrLast-yrStrt+1
> > klev = 17
> > nlat = 73
> > mlon = 144
> > ntim = 12*nyrs ; number of months
> >
> >
> > wMon = new ( (/ntim,klev,nlat,mlon/), "float", 1e20)
> > tMon = new ( ntim, "double", "No_FillValue")
> >
> > print("success")
> > ==============================
> >
> > Also, pick out (say) the 1st file and use ncl_filedump
> >
> > %> ncl_filedump wind...nc
> >
> >
> > On 6/20/11 9:45 AM, Vishali P. wrote:
> >
> > Hi.
> >
> > When I tried to run normally, it only appeared : '
> Segmentation
> > fault
> > (core dumped)'
> >
> > When I've tried to run with Mary's command ncl -x
> > CalculateSeasonalMeans.ncl :
> >
> > Loading file
> >
> "$NCARG_ROOT/lib/ncarg/__nclscripts/csm/contributed.__ncl"
> > +
> > +
> > + yrStrt = 1998
> > + yrLast = 2004
> > + nyrs = yrLast-yrStrt+1
> > + klev = 17
> > + nlat = 73
> > + mlon = 144
> > + ntim = 12*nyrs ; number of months
> > +
> > + wMon = new ( (/ntim,klev,nlat,mlon/), "float",
> 1e20)
> > + tMon = new ( ntim, "double", "No_FillValue")
> > +
> > +
> > + diru =
> "/home/Vishali/Documents/__dadosVentos/SpeedTest/"
> > + filu = systemfunc("cd "+diru+" ; ls wind*nc")
> > + nfilu = dimsizes(filu)
> > +
> > + ; calculate monthly means from
> 6hrly
> > + nmoStrt = 0
> > + nmoLast = 11
> > + do nf=0,nfilu-1
> > +
> > + f = addfile(diru+filu(nf), "r")
> > + w = f->WSpeed
> > + wMon(nmoStrt:nmoLast,:,:,:) =
> calculate_monthly_values(w,
> > "avg",0, False)
> > + nmoStrt = nmoStrt+12
> > + nmoLast = nmoLast+12
> > + delete(w) ; may change size next
> iteration (leap yr)
> > + end do
> > Segmentation fault (core dumped)
> >
> >
> >
> >
> > On Mon, Jun 20, 2011 at 3:16 PM, Mary Haley
> <haley@ucar.edu <mailto:haley@ucar.edu>
> > <mailto:haley@ucar.edu <mailto:haley@ucar.edu>>
> > <mailto:haley@ucar.edu <mailto:haley@ucar.edu>
> <mailto:haley@ucar.edu <mailto:haley@ucar.edu>>>> wrote:
> >
> >
> > On Jun 20, 2011, at 2:40 AM, Vishali P. wrote:
> >
> > > Dear NCL users
> > >
> > > I'm using 4x Daily NCEP/DOE AMIP-II Reanalysis
> wind data
> > 1998 to
> > 2004. I've calculated wind speed for each
> year...and created
> > outputs.
> > > I was suggested a script to calculate
> unweighted seasonal
> > means.
> > And then, average of each season from 1998 to
> 2004, ie,
> > average if
> > season 1 from 1998 to 2004,average of season 2
> from 1998 to 2004,
> > then 3rd and 4th.
> > >
> > > But when I try to run,appears error
> "Segmentation fault (core
> > dumped)".
> > > Can anyone help me ?
> > > Current version of my NCL is 5.2.1.
> > >
> > >
> > > Thank you in advance
> > >
> > > Vishali
> >
> > Hi Vishali,
> >
> > It could be a memory issue, but I don't have enough
> > information to
> > determine this.
> >
> > Do you know where the code is seg faulting? To get
> this
> > information,
> > run ncl with the -x option, which causes every
> line to be
> > executed
> > as it is run:
> >
> > ncl -x your_script.ncl
> >
> > It would help if you could include all the output from
> > running this
> > command, plus all the output from your various
> printVarSummary
> > statements.
> >
> > Thanks,
> >
> > --Mary
> >
> > >
> > >
> >
> >
> ==============================__==============================__=============================
> > > load
> >
> "$NCARG_ROOT/lib/ncarg/__nclscripts/csm/contributed.__ncl"
> > >
> > > yrStrt = 1998
> > > yrLast = 2004
> > > nyrs = yrLast-yrStrt+1
> > > klev = 17
> > > nlat = 73
> > > mlon = 144
> > > ntim = 12*nyrs ; number of months
> > >
> > > wMon = new ( (/ntim,klev,nlat,mlon/),
> "float", 1e20)
> > > tMon = new ( ntim, "double", "No_FillValue")
> > >
> > >
> > > diru =
> "/home/Vishali/Documents/__dadosVentos/Speed/"
> > > filu = systemfunc("cd "+diru+" ; ls wind*nc")
> > > nfilu = dimsizes(filu)
> > >
> > > ; calculate monthly means
> from 6hrly
> > > nmoStrt = 0
> > > nmoLast = 11
> > > do nf=0,nfilu-1
> > > f = addfile(diru+filu(nf), "r")
> > > w = f->WSpeed
> > > wMon(nmoStrt:nmoLast,:,:,:) =
> > calculate_monthly_values(w,
> > "avg",0, False)
> > > nmoStrt = nmoStrt+12
> > > nmoLast = nmoLast+12
> > > delete(w) ; may change size next
> iteration (leap yr)
> > > end do
> > > delete(wMon&time)
> > >
> > > printVarSummary(wMon) ; wMon(84,17,73,144)
> > >
> > > time = yyyymm_time(yrStrt, yrLast, "integer")
> > > wMon&time = time
> > >
> > > wMon!1 = "level" ; minor bug in
> > "calculate_monthly_values"
> > > wMon&level = f->level
> > >
> > > printVarSummary(wMon)
> > >
> > > ; unweighted seasonal
> means
> > >
> > > wAllSea = wgt_runave_n_Wrap(wMon, 3, 0, 0)
> > > printVarSummary(wAllSea)
> > >
> > > wSea = wAllSea(::3,:,:,:) ; (28,14,73,144)
> > > printVarSummary(wSea)
> > >
> > > _________________________________________________
> > > ncl-talk mailing list
> > > List instructions, subscriber options, unsubscribe:
> > > http://mailman.ucar.edu/__mailman/listinfo/ncl-talk
> > <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
> > <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
>
> _______________________________________________
> 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

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Thu Jun 23 09:01:54 2011

This archive was generated by hypermail 2.1.8 : Thu Jun 30 2011 - 12:54:44 MDT