Program received signal SIGSEGv: segmentation fault . invalid memory reference

I encountered the following problem when running SMOKE mode to process EDGAR emission inventory

/bin/rm: No match.
/bin/rm: No match.
Running part 1...
                                                                     
     This program uses the EPA-AREAL/MCNC-EnvPgms/BAMS Models-3      
     I/O Applications Programming Interface, [I/O API] which is      
     built on top of the netCDF I/O library (Copyright 1993, 1996    
     University Corporation for Atmospheric Research/Unidata         
     Program) and the PVM parallel-programming library (from         
     Oak Ridge National Laboratory).                                 
     Copyright (C) 1992-2002 MCNC,                                   
     (C) 1992-2013 Carlie J. Coats, Jr.,                             
     (C) 2003-2012 Baron Advanced Meteorological Systems, LLC, and   
     (C) 2014-2016 UNC Institute for the Environment.                
     Released under the GNU LGPL  License, version 2.1.  See URL     
                                                                     
         https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html     
                                                                     
     for conditions of use.                                          
                                                                     
     ioapi-3.2: $Id: init3.F90 98 2018-04-05 14:35:07Z coats $
     netCDF version 4.4.1.1 of Jan  6 2025 11:33:20 $
      
     SMOKE ---------------
     Copyright (c)2004 Environmental Modeling for Policy Development
     All rights reserved

     Program SMKINVEN, Version SMOKEv4.7_Oct2019
     Online documentation 
         http://www.cep.unc.edu/empd/products/smoke                 
      
     Program SMKINVEN to take ASCII area or point source files
     in IDA, EMS-95, or SMOKE list format, or mobile files
     in IDA format, and produce the I/O API and ASCII SMOKE
     inventory files and list of unique SCCs in the inventory.
      
      
     You will need to enter the logical names for the input and
     output files (and to have set them prior to program start,
     using "setenv <logicalname> <pathname>").
      
     You may use END_OF-FILE (control-D) to quit the program
     during logical-name entry. Default responses are given in
     brackets [LIKE THIS] and can be accepted by hitting the
     <RETURN> key.

Program received signal SIGSEGV: Segmentation fault - invalid memory reference.

Backtrace for this error:
#0  0x7f49425c377d in ???
#1  0x7f49425c2993 in ???
#2  0x7f494228708f in ???
#3  0x7f494274d656 in ???
#4  0x55dbe9160759 in ???
#5  0x55dbe9156e5d in ???
#6  0x55dbe90e2b1e in ???
#7  0x7f4942268082 in ???
#8  0x55dbe90e2b7d in ???
#9  0xffffffffffffffff in ???
Segmentation fault (core dumped)
13.8u 2.4s 0:16.46 98.9% 0+0k 0+202544io 0pf+0w
                                                                     
     This program uses the EPA-AREAL/MCNC-EnvPgms/BAMS Models-3      
     I/O Applications Programming Interface, [I/O API] which is      
     built on top of the netCDF I/O library (Copyright 1993, 1996    
     University Corporation for Atmospheric Research/Unidata         
     Program) and the PVM parallel-programming library (from         
     Oak Ridge National Laboratory).                                 
     Copyright (C) 1992-2002 MCNC,                                   
     (C) 1992-2013 Carlie J. Coats, Jr.,                             
     (C) 2003-2012 Baron Advanced Meteorological Systems, LLC, and   
     (C) 2014-2016 UNC Institute for the Environment.                
     Released under the GNU LGPL  License, version 2.1.  See URL     
                                                                     
         https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html     
                                                                     
     for conditions of use.                                          
                                                                     
     ioapi-3.2: $Id: init3.F90 98 2018-04-05 14:35:07Z coats $
     netCDF version 4.4.1.1 of Jan  6 2025 11:33:20 $
      
     SMOKE ---------------
     Copyright (c)2004 Environmental Modeling for Policy Development
     All rights reserved

Program SPCMAT, Version SMOKEv4.7_Oct2019
     Online documentation 
         http://www.cep.unc.edu/empd/products/smoke                 
      
     Program SPCMAT to take a SMOKE area, mobile, or point source
     inventory file, a speciation profiles file, a speciation
     cross-reference file, an optional pollutant-to-pollutant,
     conversion file, and produce mass-based and/or mole-based
     SMOKE speciation matrices for all inventory pollutants
     using run-time defined combinations of pollutants and model
     species. The output species are defined at run time by the
     speciation profiles file, permitting support of any chemical
     mechanism.
      
      
     You will need to enter the logical names for the input and
     output files (and to have set them prior to program start,
     using "setenv <logicalname> <pathname>").
      
     You may use END_OF-FILE (control-D) to quit the program
     during logical-name entry. Default responses are given in
     brackets [LIKE THIS] and can be accepted by hitting the
     <RETURN> key.
      
0.0u 0.0s 0:00.00 0.0% 0+0k 0+8io 0pf+0w
                                                                     
     This program uses the EPA-AREAL/MCNC-EnvPgms/BAMS Models-3      
     I/O Applications Programming Interface, [I/O API] which is      
     built on top of the netCDF I/O library (Copyright 1993, 1996    
     University Corporation for Atmospheric Research/Unidata         
     Program) and the PVM parallel-programming library (from         
     Oak Ridge National Laboratory).                                 
     Copyright (C) 1992-2002 MCNC,                                   
     (C) 1992-2013 Carlie J. Coats, Jr.,                             
     (C) 2003-2012 Baron Advanced Meteorological Systems, LLC, and   
     (C) 2014-2016 UNC Institute for the Environment.                
     Released under the GNU LGPL  License, version 2.1.  See URL     
                                                                     
         https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html

for conditions of use.                                          
                                                                     
     ioapi-3.2: $Id: init3.F90 98 2018-04-05 14:35:07Z coats $
     netCDF version 4.4.1.1 of Jan  6 2025 11:33:20 $
      
     SMOKE ---------------
     Copyright (c)2004 Environmental Modeling for Policy Development
     All rights reserved

     Program GRDMAT, Version SMOKEv4.7_Oct2019
     Online documentation 
         http://www.cep.unc.edu/empd/products/smoke                 
      
     Program GRDMAT to take a SMOKE area, mobile, or point source
     inventory file, gridding surrogates,  surrogate cross-
     reference, and an optional link definitions file, and produce
     a SMOKE gridding matrix for a grid defined at run time. For
     mobile sources, an "ungridding" matrix is also created to
     allow the use of gridded temperature data in assigning
     factors to mobile sources.
      
      
     You will need to enter the logical names for the input and
     output files (and to have set them prior to program start,
     using "setenv <logicalname> <pathname>").
      
     You may use END_OF-FILE (control-D) to quit the program
     during logical-name entry. Default responses are given in
     brackets [LIKE THIS] and can be accepted by hitting the
     <RETURN> key.
      
0.0u 0.0s 0:00.00 0.0% 0+0k 0+8io 0pf+0w
Running part 2, for 20190927 ...
Running part 4, for 20190927...
                                                                     
     This program uses the EPA-AREAL/MCNC-EnvPgms/BAMS Models-3      
     I/O Applications Programming Interface, [I/O API] which is      
     built on top of the netCDF I/O library (Copyright 1993, 1996    
     University Corporation for Atmospheric Research/Unidata         
     Program) and the PVM parallel-programming library (from         
     Oak Ridge National Laboratory).                                 
     Copyright (C) 1992-2002 MCNC,                                   
     (C) 1992-2013 Carlie J. Coats, Jr.,                             
     (C) 2003-2012 Baron Advanced Meteorological Systems, LLC, and   
     (C) 2014-2016 UNC Institute for the Environment.                
     Released under the GNU LGPL  License, version 2.1.  See URL  
 https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html     
                                                                     
     for conditions of use.                                          
                                                                     
     ioapi-3.2: $Id: init3.F90 98 2018-04-05 14:35:07Z coats $
     netCDF version 4.4.1.1 of Jan  6 2025 11:33:20 $
      
     SMOKE ---------------
     Copyright (c)2004 Environmental Modeling for Policy Development
     All rights reserved

     Program TEMPORAL, Version SMOKEv4.7_Oct2019
     Online documentation 
         http://www.cep.unc.edu/empd/products/smoke                 
      
     Program TEMPORAL to take a SMOKE area, mobile, or point
     source inventory file, a temporal profiles file, a temporal
     cross-reference file, an optional SMOKE day-specific file, 
     and an optional SMOKE hour-specific point source file, and
     produce hourly low-level and optionally hourly elevated point
     source emissions for the requested episode.
      
      
     You will need to enter the logical names for the input and
     output files (and to have set them prior to program start,
     using "setenv <logicalname> <pathname>").
      
     You may use END_OF-FILE (control-D) to quit the program
     during logical-name entry. Default responses are given in
     brackets [LIKE THIS] and can be accepted by hitting the
     <RETURN> key.
      
0.0u 0.0s 0:00.00 0.0% 0+0k 0+8io 0pf+0w
                                                                     
     This program uses the EPA-AREAL/MCNC-EnvPgms/BAMS Models-3      
     I/O Applications Programming Interface, [I/O API] which is      
     built on top of the netCDF I/O library (Copyright 1993, 1996    
     University Corporation for Atmospheric Research/Unidata         
     Program) and the PVM parallel-programming library (from         
     Oak Ridge National Laboratory).                                 
     Copyright (C) 1992-2002 MCNC,                                   
     (C) 1992-2013 Carlie J. Coats, Jr.,                             
     (C) 2003-2012 Baron Advanced Meteorological Systems, LLC, and   
     (C) 2014-2016 UNC Institute for the Environment.                
     Released under the GNU LGPL  License, version 2.1.  See URL 

https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html     
                                                                     
     for conditions of use.                                          
                                                                     
     ioapi-3.2: $Id: init3.F90 98 2018-04-05 14:35:07Z coats $
     netCDF version 4.4.1.1 of Jan  6 2025 11:33:20 $
      
     SMOKE ---------------
     Copyright (c)2004 Environmental Modeling for Policy Development
     All rights reserved

     Program SMKMERGE, Version SMOKEv4.7_Oct2019
     Online documentation 
         http://www.cep.unc.edu/empd/products/smoke                 
      
     Program SMKMERGE to merge the inventory or hourly emission
     files with gridding matrices and with optionally any
     combination of speciation matrices, multiplicative control
     matrices, additive control matrices, or reactivity control
     matrices. The program can operate on one to four source 
     categories (area, biogenic, mobile, or point sources), or any
     combination of these.  Gridded and/or state reports and/or
     county reports can be written from this program. If a layer-
     fractions file is input, then the total emissions output file
     is three-dimensional.
      
      
     You will need to enter the logical names for the input and
     output files (and to have set them prior to program start,
     using "setenv <logicalname> <pathname>").
      
     You may use END_OF-FILE (control-D) to quit the program
     during logical-name entry. Default responses are given in
     brackets [LIKE THIS] and can be accepted by hitting the
     <RETURN> key.

After the completion of the operation, the edgarsrc. mycase. txt area. map. edgar. mycase. txt edgar. mycase. ncf edgar. mycase. dat files are all empty files, so it may be an error in the SMKINVEN module, but I don’t know what the specific error is. Now I am attaching my logs and mapping files

smkinven.edgar.mycase

                                                                     
     This program uses the EPA-AREAL/MCNC-EnvPgms/BAMS Models-3      
     I/O Applications Programming Interface, [I/O API] which is      
     built on top of the netCDF I/O library (Copyright 1993, 1996    
     University Corporation for Atmospheric Research/Unidata         
     Program) and the PVM parallel-programming library (from         
     Oak Ridge National Laboratory).                                 
     Copyright (C) 1992-2002 MCNC,                                   
     (C) 1992-2013 Carlie J. Coats, Jr.,                             
     (C) 2003-2012 Baron Advanced Meteorological Systems, LLC, and   
     (C) 2014-2016 UNC Institute for the Environment.                
     Released under the GNU LGPL  License, version 2.1.  See URL     
                                                                     
         https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html     
                                                                     
     for conditions of use.                                          
                                                                     
     ioapi-3.2: $Id: init3.F90 98 2018-04-05 14:35:07Z coats $
     Version with PARMS3.EXT/PARAMETER::MXVARS3= 2048
     netCDF version 4.4.1.1 of Jan  6 2025 11:33:20 $
      
      
     Missing environment variable EXECUTION_ID
     SMOKE ---------------
     Copyright (c)2004 Environmental Modeling for Policy Development
     All rights reserved

     Program SMKINVEN, Version SMOKEv4.7_Oct2019
     Online documentation 
         http://www.cep.unc.edu/empd/products/smoke                 
      
     Program SMKINVEN to take ASCII area or point source files
     in IDA, EMS-95, or SMOKE list format, or mobile files
     in IDA format, and produce the I/O API and ASCII SMOKE
     inventory files and list of unique SCCs in the inventory.
      
      
     You will need to enter the logical names for the input and
     output files (and to have set them prior to program start,
     using "setenv <logicalname> <pathname>").
      
     You may use END_OF-FILE (control-D) to quit the program
     during logical-name entry. Default responses are given in
     brackets [LIKE THIS] and can be accepted by hitting the
     <RETURN> key.
      
     Value for PROMPTFLAG:  N returning FALSE
     Returning default value TRUE for query:
     "Continue with program?"
     Value for SMK_SOURCE:  'A'
     Value for SMK_SOURCE:  'A'
     Value for OUTZONE:  0
     Value for SMKINVEN_FORMULA defined but empty; returning default:  ' '
     Value for SMKINVEN_FORMULA defined but empty; returning default:  ' '
     Value for IMPORT_AVEINV_YN not defined;returning default:   TRUE
     Value for DAY_SPECIFIC_YN:  N returning FALSE
     Value for HOUR_SPECIFIC_YN:  N returning FALSE
     Value for SMK_PROCESS_HAPS not defined; returning defaultval ':  ' '
     Value for SMK_PROCESS_HAPS not defined; returning defaultval ':  ' '
     No processing of combining criteria VOC with hazardous air pollutants (HAP).
     Value for SMK_ARTOPNT_YN not defined;returning default:   FALSE
     Value for IMPORT_GRDIOAPI_YN:  N returning FALSE
     Value for IMPORT_GRDNETCDF_YN:  Y returning TRUE
     Value for NETCDF_POL_UNIT:  'kg m-2 s-1'
     Value for NETCDF_POL_UNIT:  'kg m-2 s-1'
     
     Value for PROMPTFLAG:  N returning FALSE
     Value for IOAPI_CHECK_HEADERS not defined;returning default:   FALSE
      
     "GRIDMASK" opened as OLD:READ-ONLY   
     File name "/home/test/aqm/smoke4.7_local/data/ge_dat/EDGAR/GRIDMASK_EDGAR.ncf"
     File type GRDDED3 
     Execution ID "????????????????"
     Grid name "LATLON_EDGAR0.1"
     Dimensions: 1800 rows, 3600 cols, 1 lays, 2 vbles
     NetCDF ID:     65536  opened as READONLY            
     Time-independent data.
     Value for USE_EXP_GEO_CODES:  Y returning TRUE
     Value for PROMPTFLAG:  N returning FALSE

     File "INVTABLE" opened for input on unit:  98
     /home/test/aqm/smoke4.7_local/data/inventory/myinv/other/invtable_hapcap_cb05soa.txt

     Setting up to read inventory data...
     Value for SMK_DEFAULT_TZONE:  5
     Reading geographic region names and time zones...

     File "GEOCODE_LEVEL1" opened for input on unit:  97
     /home/test/aqm/smoke4.7_local/data/ge_dat/EDGAR/geocode1_edgar.txt


     File "GEOCODE_LEVEL2" opened for input on unit:  97
     /home/test/aqm/smoke4.7_local/data/ge_dat/EDGAR/geocode2_edgar.txt


     File "GEOCODE_LEVEL3" opened for input on unit:  97
     /home/test/aqm/smoke4.7_local/data/ge_dat/EDGAR/geocode3_edgar.txt


     File "GEOCODE_LEVEL4" opened for input on unit:  97
     /home/test/aqm/smoke4.7_local/data/ge_dat/EDGAR/geocode4_edgar.txt

     Value for SMKINVEN_MONTH:  9
     Value for NETCDF_INV_YEAR:  2018

     File "ARINV" opened for input on unit:  97
     /home/test/aqm/smoke4.7_local/data/inventory/myinv/edgar/arinv.edgar.lst

     Value for WKDAY_NORMALIZE:  N returning FALSE
     NOTE: Setting inventory to use full-week normalizer for weekly profiles
     Value for SMKINVEN_FORMULA defined but empty; returning default:  ' '
     Value for SMKINVEN_FORMULA defined but empty; returning default:  ' '
     Value for SMK_BASEYR_OVERRIDE:  0
     Value for INVNAME1:  'edgar.mycase'
     Value for INVNAME1:  'edgar.mycase'
     Value for INVNAME2:  'edgarsrc.mycase'
     Value for INVNAME2:  'edgarsrc.mycase'

     File "AREA" opened for output on unit:  97
     /home/test/aqm/smoke4.7_local/data/inventory/mycase/area.map.edgar.mycase.txt

     Value for AREA:  '/home/test/aqm/smoke4.7_local/data/inventory/mycase/area.map.edgar.mycase.txt'
     Value for AREA:  '/home/test/aqm/smoke4.7_local/data/inventory/mycase/area.map.edgar.mycase.txt'
     NOTE: Inventory base year set to   2018
     Number of variables per file array is not allocated for file set IOAPI_INV;
     using default of  2048 variables per file
     
     Value for IOAPI_CHECK_HEADERS not defined;returning default:   FALSE
     Value for IOAPI_OFFSET_64 not defined;returning default:   TRUE
     Value for IOAPI_CFMETA not defined;returning default:   FALSE
     Value for IOAPI_CMAQMETA not defined; returning defaultval ':  'NONE'
     Value for IOAPI_CMAQMETA not defined; returning defaultval ':  'NONE'
     Value for IOAPI_SMOKEMETA not defined; returning defaultval ':  'NONE'
     Value for IOAPI_SMOKEMETA not defined; returning defaultval ':  'NONE'
     Value for IOAPI_TEXTMETA not defined; returning defaultval ':  'NONE'
     Value for IOAPI_TEXTMETA not defined; returning defaultval ':  'NONE'
      
     "IOAPI_INV" opened as NEW(READ-WRITE )
     File name "/home/test/aqm/smoke4.7_local/data/inventory/mycase/edgar.mycase.ncf"
     File type GRDDED3 
     Execution ID "????????????????"
     Grid name ""
     Dimensions: 6480000 rows, 1 cols, 1 lays, 4 vbles
     NetCDF ID:    131072  opened as READWRITE           
     Time-independent data.

     File "ASRC" opened for output on unit:  96
     /home/test/aqm/smoke4.7_local/data/inventory/mycase/edgarsrc.mycase.txt


 WARNING: output file already exists: REPINVEN
 /home/test/aqm/smoke4.7_local/data/reports/mycase/static/repinven.edgar.mycase.txt


     File "REPINVEN" opened for output on unit:  95
     /home/test/aqm/smoke4.7_local/data/reports/mycase/static/repinven.edgar.mycase.txt

     Writing SMOKE AREA SOURCE INVENTORY file...
     Value for IOAPI_LOG_WRITE not defined;returning default:   TRUE
     TZONES written to IOAPI_INV
     TPFLAG written to IOAPI_INV
     INVYR written to IOAPI_INV
     CELLID written to IOAPI_INV

grdmat.edgar.mycase.GR81KM

                                                                     
     This program uses the EPA-AREAL/MCNC-EnvPgms/BAMS Models-3      
     I/O Applications Programming Interface, [I/O API] which is      
     built on top of the netCDF I/O library (Copyright 1993, 1996    
     University Corporation for Atmospheric Research/Unidata         
     Program) and the PVM parallel-programming library (from         
     Oak Ridge National Laboratory).                                 
     Copyright (C) 1992-2002 MCNC,                                   
     (C) 1992-2013 Carlie J. Coats, Jr.,                             
     (C) 2003-2012 Baron Advanced Meteorological Systems, LLC, and   
     (C) 2014-2016 UNC Institute for the Environment.                
     Released under the GNU LGPL  License, version 2.1.  See URL     
                                                                     
         https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html     
                                                                     
     for conditions of use.                                          
                                                                     
     ioapi-3.2: $Id: init3.F90 98 2018-04-05 14:35:07Z coats $
     Version with PARMS3.EXT/PARAMETER::MXVARS3= 2048
     netCDF version 4.4.1.1 of Jan  6 2025 11:33:20 $
      
      
     Missing environment variable EXECUTION_ID
     SMOKE ---------------
     Copyright (c)2004 Environmental Modeling for Policy Development
     All rights reserved

     Program GRDMAT, Version SMOKEv4.7_Oct2019
     Online documentation 
         http://www.cep.unc.edu/empd/products/smoke                 
      
     Program GRDMAT to take a SMOKE area, mobile, or point source
     inventory file, gridding surrogates,  surrogate cross-
     reference, and an optional link definitions file, and produce
     a SMOKE gridding matrix for a grid defined at run time. For
     mobile sources, an "ungridding" matrix is also created to
     allow the use of gridded temperature data in assigning
     factors to mobile sources.
      
      
     You will need to enter the logical names for the input and
     output files (and to have set them prior to program start,
     using "setenv <logicalname> <pathname>").
      
     You may use END_OF-FILE (control-D) to quit the program
     during logical-name entry. Default responses are given in
     brackets [LIKE THIS] and can be accepted by hitting the
     <RETURN> key.
      
     Value for PROMPTFLAG:  N returning FALSE
     Returning default value TRUE for query:
     "Continue with program?"
     Value for GRDMAT_ADJUST not defined;returning default:   FALSE
     Value for GRDMAT_LINKDEFS not defined;returning default:   FALSE
     Value for USE_VARIABLE_GRID not defined;returning default:   FALSE
     Value for IMPORT_GRDNETCDF_YN:  Y returning TRUE
     Value for SMK_SOURCE:  'A'
     Value for SMK_SOURCE:  'A'
     Value for PROMPTFLAG:  N returning FALSE

     File "AREA" opened for input on unit:  98
     /home/test/aqm/smoke4.7_local/data/inventory/mycase/area.map.edgar.mycase.txt

     Value for AREA:  '/home/test/aqm/smoke4.7_local/data/inventory/mycase/area.map.edgar.mycase.txt'
     Value for AREA:  '/home/test/aqm/smoke4.7_local/data/inventory/mycase/area.map.edgar.mycase.txt'
     
     *** ERROR ABORT in subroutine RDINVMAP
     Corrupted map formatted file - missing lines
     

Hi Liuming,

Looks like SMKINVEN crashed with segmentation fault and incompletely wrote the map file which explained for the subsequent fail in GRDMAT.

It’s impossible to know what caused the “SIGSEGV: Segmentation fault - invalid memory reference” with the current backtrace info. To get more detail on the backtrace, you’ll need to recompile SMOKE in debug mode. Please follow this instruction and change the EFLAG in the Makeinclude file for your corresponding compiler.

If you are able to recompile SMOKE with debug option, try rerun SMOKE for EDGAR, share the traceback info of the segmentation fault and we’ll go from there.

Huy