[ncl-talk] fatal:NclMalloc Failed:[errno=12] Segmentation fault

Kevin Hallock hallock at ucar.edu
Mon Dec 3 14:59:11 MST 2018


Hello,

I noticed something else in your dox.ncl script that could potentially cause problems:

   a = addfile("dox_med_1.4-101.nc","r")
   ...
   diro = "./"                     ; Output directory
   filo = "dox_med_1.4-101.nc"
   system("/bin/rm -f " + diro + filo)    ; remove if exists
   foutput  = addfile (diro + filo, "c")  ; open output file
   ...
   foutput->dox = (/dox_masked/)

The possible issue I see with this is that the script reads from the file “dox_med_1.4-101.nc”, deletes the file, recreates the file, and then writes several variables back onto the file. If any errors occur before all of the desired variables are written to foutput, then you could end up with an incomplete input data file when you run this script in the future. If it’s absolutely necessary to use the same filename, you may want to instead use a temporary filename for “filo” and then rename the temporary file at the end of your script:

   filo = "tmp_dox_med_1.4-101.nc"
   foutput  = addfile (diro + filo, "c")  ; open output file
   ...
   foutput->dox = (/dox_masked/)
   system("/bin/mv " + diro + filo + " " + diro + "dox_med_1.4-101.nc")


I don’t think this is the cause of the memory allocation error, but I thought it might be worth mentioning anyway.

I hope this helps,
Kevin


> On Dec 3, 2018, at 2:28 PM, Rick Brownrigg <brownrig at ucar.edu> wrote:
> 
> Hi,
> 
> Errno=12 is "Cannot allocate memory".
> 
> That dox variable looks to be about 2.6GB, and I can't quite tell, but it looks like you may be creating another 2 variables of comparable size(?)  How much memory does you machine have?  Can you tell how far the script gets executed (i.e., perhaps put some print statements at strategic places in the script to see how far it gets).
> 
> Rick
> 
> On Mon, Dec 3, 2018 at 2:18 PM Amal Inge <amalingenieur89 at gmail.com <mailto:amalingenieur89 at gmail.com>> wrote:
> Dear NCL experts,
> i tried to run the script attached but i had this error: fatal:NclMalloc Failed:[errno=12] Segmentation fault
> what should be the solution please knowing that i have enough space in the memory ?
> many thanks
> 
> 
> netcdf dox_med_1.4-101 {
> dimensions:
>     longitude = 670 ;
>     latitude = 253 ;
>     depth = 18 ;
>     time = UNLIMITED ; // (215 currently)
> variables:
>     float longitude(longitude) ;
>         longitude:standard_name = "longitude" ;
>         longitude:long_name = "longitude" ;
>         longitude:units = "degrees_east" ;
>         longitude:axis = "X" ;
>     float latitude(latitude) ;
>         latitude:standard_name = "latitude" ;
>         latitude:long_name = "latitude" ;
>         latitude:units = "degrees_north" ;
>         latitude:axis = "Y" ;
>     float depth(depth) ;
>         depth:standard_name = "depth" ;
>         depth:long_name = "depth" ;
>         depth:units = "m" ;
>         depth:positive = "down" ;
>         depth:axis = "Z" ;
>         depth:_CoordinateAxisType = "Height" ;
>         depth:_CoordinateZisPositive = "down" ;
>     double time(time) ;
>         time:standard_name = "time" ;
>         time:long_name = "time" ;
>         time:units = "seconds since 1970-01-01 00:00:00" ;
>         time:calendar = "standard" ;
>         time:axis = "T" ;
>     float dox(time, depth, latitude, longitude) ;
>         dox:standard_name = "mole_concentration_of_dissolved_molecular_oxygen_in_sea_water" ;
>         dox:long_name = "Mole concentration of Dissolved Molecular Oxygen in sea water" ;
>         dox:units = "millimol m-3" ;
>         dox:_FillValue = 1.e+20f ;
>         dox:missing_value = 1.e+20f ;
>         dox:_ChunkSizes = 1, 22, 84, 161 ;
> 
> // global attributes:
>         :CDI = "Climate Data Interface version 1.8.1 (http://mpimet.mpg.de/cdi <http://mpimet.mpg.de/cdi>)" ;
>         :Conventions = "CF-1.0" ;
>         :source = "3DVAR-OGSTM-BFM" ;
>         :institution = "OGS (Istituto Nazionale di Oceanografia e di Geofisica Sperimentale) , Sgonico (Trieste) - Italy" ;
>         :references = "Please check in CMEMS catalogue the INFO section for product MEDSEA_ANALYSIS_FORECAST_BIO_006_008 - http://marine.copernicus.eu/ <http://marine.copernicus.eu/>" ;
>         :comment = "Please check in CMEMS catalogue the INFO section for product MEDSEA_ANALYSIS_FORECAST_BIO_006_008 - http://marine.copernicus.eu/ <http://marine.copernicus.eu/>" ;
>         :contact = "servicedesk.cmems at mercator-ocean.eu <mailto:servicedesk.cmems at mercator-ocean.eu>" ;
>         :bulletin_date = "2017-12-01" ;
>         :bulletin_type = "analysis" ;
>         :field_type = "monthly_mean_beginning_at_time_field" ;
>         :title = "Net Primary Production and Dissolved Oxygen (3D) - Monthly Mean" ;
>         :History = "Translated to CF-1.0 Conventions by Netcdf-Java CDM (CFGridWriter2)\n",
>             "Original Dataset = sv03-med-ogs-bio-rean-m; Translation Date = 2018-12-03T14:34:09.553Z" ;
>         :geospatial_lat_min = 30.1875 ;
>         :geospatial_lat_max = 45.9375 ;
>         :geospatial_lon_min = -5.5625 ;
>         :geospatial_lon_max = 36.25 ;
>         :CDO = "Climate Data Operators version 1.8.1 (http://mpimet.mpg.de/cdo <http://mpimet.mpg.de/cdo>)" ;
> 
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu <mailto:ncl-talk at ucar.edu>
> 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
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20181203/e65b2634/attachment.html>


More information about the ncl-talk mailing list