Segmentation fault in ts_au example in tbtrans with netcdf

Asked by Sergey Pyrlin on 2018-12-03

Hi everyone!

Tried compiling Siesta and TBtrans 4.1 both versions b3 and b4 with gnu (tired 7.2 and 6.0), openmpi 2.0 and mkl's libraries.
Without netCDF support transport calculations go fine (although without printing current as this now requires netCDF).

With netCDF support, however, only au_111_capacitor.fdf example finishes fine, but bulk_au_111.fdf produces the following error in the very beginning of "TBtrans contour" section:

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

Backtrace for this error:
#0 0x3b8023291f in ???
#1 0xd7ded3 in ???
#2 0xadbc02 in __m_tbt_tri_scat_MOD_a_gamma
 at /home/pyrlinsv/src/SIESTA/siesta-4.1-b4/Util/TS/TBtrans/m_tbt_tri_scat.F90:1071
#3 0xacd857 in __m_tbt_trik_MOD_tbt_trik
 at /home/pyrlinsv/src/SIESTA/siesta-4.1-b4/Util/TS/TBtrans/m_tbt_trik.F90:1254
#4 0xabc725 in __m_tbtrans_MOD_tbt
 at /home/pyrlinsv/src/SIESTA/siesta-4.1-b4/Util/TS/TBtrans/m_tbtrans.F90:326
#5 0xb57e04 in tbtrans
 at /home/pyrlinsv/src/SIESTA/siesta-4.1-b4/Util/TS/TBtrans/tbtrans.F90:34
#6 0xb57e45 in main
 at /home/pyrlinsv/src/SIESTA/siesta-4.1-b4/Util/TS/TBtrans/tbtrans.F90:23
/var/spool/torque/mom_priv/jobs/658717.search6.di.uminho.pt.SC: line 46: 44808 Segmentation fault $TBT ${SCAT}.fdf > tbt_${SCAT}.out

Compiled Siesta and TBtrans using arch.make:

--------------------------------------------------------------------------
#
# Copyright (C) 1996-2016 The SIESTA group
# This file is distributed under the terms of the
# GNU General Public License: see COPYING in the top directory
# or http://www.gnu.org/copyleft/gpl.txt.
# See Docs/Contributors.txt for a list of contributors.
#
#-------------------------------------------------------------------
# arch.make file for gfortran compiler.
# To use this arch.make file you should rename it to
# arch.make
# or make a sym-link.
# For an explanation of the flags see DOCUMENTED-TEMPLATE.make

.SUFFIXES:
.SUFFIXES: .f .F .o .c .a .f90 .F90

SIESTA_ARCH = unknown

CC = mpicc
FPP = $(FC) -E -P -x c
FC = mpif90
FC_SERIAL = gfortran
MPI_INCLUDE=./
MPI_INTERFACE=libmpi_f90.a

#FFLAGS = -O2 -fPIC -ftree-vectorize
FFLAGS = -g -O0 -fbacktrace -fbounds-check

AR = ar
RANLIB = ranlib

SYS = nag

SP_KIND = 4
DP_KIND = 8
KINDS = $(SP_KIND) $(DP_KIND)

LDFLAGS =

COMP_LIBS =

FPPFLAGS = $(DEFS_PREFIX)-DFC_HAVE_ABORT

MKLROOT=/opt/intel/composer_xe_2013.1.117/mkl/
NCDFROOT=/home/pyrlinsv/NetCDF

LIBS = /home/pyrlinsv/lib/libfftw3xf_gnu.a \
 $(MKLROOT)/lib/intel64/libmkl_scalapack_lp64.a \
 -Wl,--start-group $(MKLROOT)/lib/intel64/libmkl_intel_lp64.a \
 $(MKLROOT)/lib/intel64/libmkl_sequential.a \
 $(MKLROOT)/lib/intel64/libmkl_core.a \
 $(MKLROOT)/lib/intel64/libmkl_blacs_openmpi_lp64.a -Wl,--end-group \
 -L${NCDFROOT}/netcdf/lib \
    -L${NCDFROOT}/hdf5/lib \
    -L${NCDFROOT}/zlib/lib \
    -lnetcdff -lnetcdf -lhdf5_hl -lhdf5 -lz -lcurl -lpthread -ldl -lm

# NetCDF support:
INCFLAGS += -I${NCDFROOT}/netcdf/include
LDFLAGS += -L${NCDFROOT}/zlib/lib -Wl,-rpath=${NCDFROOT}/zlib/lib
LDFLAGS += -L${NCDFROOT}/hdf5/lib -Wl,-rpath=${NCDFROOT}/hdf5/lib
LDFLAGS += -L${NCDFROOT}/netcdf/lib -Wl,-rpath=${NCDFROOT}/netcdf/lib
LIBS += -lnetcdff -lnetcdf -lhdf5_hl -lhdf5 -lz
COMP_LIBS += libncdf.a libfdict.a
FPPFLAGS += -DCDF -DNCDF -DNCDF_4

NETCDF_ROOT = ${NCDFROOT}/netcdf
NETCDF_INCFLAGS = -I$(NETCDF_ROOT)/include
NETCDF_LIBS = -L$(NETCDF_ROOT)/lib -lnetcdff -lnetcdf

COMP_LIBS += libncdf.a libfdict.a
FPPFLAGS += -DNCDF -DNCDF_4 -DMPI

# Dependency rules ---------

FFLAGS_DEBUG = -g -O1 # your appropriate flags here...

# The atom.f code is very vulnerable. Particularly the Intel compiler
# will make an erroneous compilation of atom.f with high optimization
# levels.
atom.o: atom.F
 $(FC) -c $(FFLAGS_DEBUG) $(INCFLAGS) $(FPPFLAGS) $(FPPFLAGS_fixed_F) $<

.c.o:
 $(CC) -c $(CFLAGS) $(INCFLAGS) $(CPPFLAGS) $<
.F.o:
 $(FC) -c $(FFLAGS) $(INCFLAGS) $(FPPFLAGS) $(FPPFLAGS_fixed_F) $<
.F90.o:
 $(FC) -c $(FFLAGS) $(INCFLAGS) $(FPPFLAGS) $(FPPFLAGS_free_F90) $<
.f.o:
 $(FC) -c $(FFLAGS) $(INCFLAGS) $(FCFLAGS_fixed_f) $<
.f90.o:
 $(FC) -c $(FFLAGS) $(INCFLAGS) $(FCFLAGS_free_f90) $<

The full output of bulk_au_111 tbtrans calculation:

--------------------------------------------------------------------------
TBtrans Version: v4.1-b4
Architecture : unknown
Compiler flags: mpif90 -g -O0 -fbacktrace -fbounds-check
PP flags : -DFC_HAVE_ABORT -DCDF -DNCDF -DNCDF_4 -DNCDF -DNCDF_4 -DMPI -DTBTRANS
Libraries : libncdf.a libfdict.a libncdf.a libfdict.a /home/pyrlinsv/lib/libfftw3xf_gnu.a /opt/intel/composer_xe_2013.1.117/mkl//lib/intel64/libmkl_scalapack_lp64.a -Wl,--start-group /opt/intel/composer_xe_2013.1.117/mkl//lib/intel64/libmkl_intel_lp64.a /opt/intel/composer_xe_2013.1.117/mkl//lib/intel64/libmkl_sequential.a /opt/intel/composer_xe_2013.1.117/mkl//lib/intel64/libmkl_core.a /opt/intel/composer_xe_2013.1.117/mkl//lib/intel64/libmkl_blacs_openmpi_lp64.a -Wl,--end-group -L/home/pyrlinsv/NetCDF/netcdf/lib -L/home/pyrlinsv/NetCDF/hdf5/lib -L/home/pyrlinsv/NetCDF/zlib/lib -lnetcdff -lnetcdf -lhdf5_hl -lhdf5 -lz -lcurl -lpthread -ldl -lm -lnetcdff -lnetcdf -lhdf5_hl -lhdf5 -lz
PARALLEL version
NetCDF support
NetCDF-4 support

* Running in serial mode with MPI
>> Start of run: 30-NOV-2018 18:55:36

                           ************************
                           * WELCOME TO TBtrans *
                           ************************

reinit: Reading from bulk_au_111.fdf

reinit: -----------------------------------------------------------------------
reinit: System Name: bulk_au_111
reinit: -----------------------------------------------------------------------
reinit: System Label: bulk_au_111
reinit: -----------------------------------------------------------------------

k-point displ. along 1 input, could be: 0.00 0.50
k-point displ. along 2 input, could be: 0.00 0.50
 Kpoints in: 40 . Kpoints trimmed: 34
tbt: Number of transport k-points = 34
tbt: Method = Monkhorst-Pack grid.
tbt: k-grid: Supercell and displacements
tbt: 8 0 0 0.000
tbt: 0 8 0 0.000
tbt: 0 0 1 0.000

tbt: **************************************************************
tbt: Electronic temperature (reference) = 99.9993 K
tbt: No applied bias
tbt: Calculate transmission only using diag(Gf) = F
tbt: Saving bulk transmission for electrodes = F
tbt: Saving DOS from bulk electrodes = F
tbt: Saving DOS from Green function = F
tbt: Saving DOS from spectral functions = F
tbt: Saving bond currents (orb-orb) = F
tbt: Saving DM from Green function = F
tbt: Saving DM from spectral functions = F
tbt: Saving COOP from Green function = F
tbt: Saving COOP from spectral functions = F
tbt: Saving COHP from Green function = F
tbt: Saving COHP from spectral functions = F
tbt: Calc. # transmission eigenvalues = 0
tbt: Calc. T between all electrodes = F
tbt: Calc. total T out of electrodes = F
tbt: Non-polarized Hamiltonian
tbt: BTD creation algorithm = speed
tbt: BTD spectral function algorithm = propagation
tbt: Divide and conquer diagonalization = F
tbt: Assume LAPACK <i|S|j> = delta_ij = F
tbt: Saving downfolded self-energies = F
tbt: No delta Hamiltonian
tbt: No delta self-energy
tbt: Data files stored in current folder
tbt: No compression of TBT.nc files
tbt: Default NetCDF precision = single
tbt: Parallel MPI-IO not possible
tbt: >> Electrodes <<
tbt: >> Left
tbt: Electrode cell pivoting: E1, E2, E3 = A1, A2, A3
tbt: In-core self-energy calculation
tbt: Electrode TSHS file = ./elec_au_111_abc.TSHS
tbt: # atoms used in electrode = 3
tbt: Electrode Bloch unity [E1 x E2 x E3] = 1 x 1 x 1
tbt: Position in geometry = 1 -- 3
tbt: Semi-infinite direction for electrode = negative wrt. E3
tbt: Chemical shift = 0.000000 eV
tbt: Electronic temperature = 99.999269 K
tbt: Gamma-only electrode = F
tbt: Bulk H, S in electrode region = T
tbt: Electrode self-energy imaginary Eta = 0.1000E-03 eV
tbt: Electrode self-energy accuracy = 0.1000E-13 eV
tbt: Electrode inter-layer distance (semi-inf) = 2.3867 Ang
tbt: >> Right
tbt: Electrode cell pivoting: E1, E2, E3 = A1, A2, A3
tbt: In-core self-energy calculation
tbt: Electrode TSHS file = ./elec_au_111_abc.TSHS
tbt: # atoms used in electrode = 3
tbt: Electrode Bloch unity [E1 x E2 x E3] = 1 x 1 x 1
tbt: Position in geometry = 7 -- 9
tbt: Semi-infinite direction for electrode = positive wrt. E3
tbt: Chemical shift = 0.000000 eV
tbt: Electronic temperature = 99.999269 K
tbt: Gamma-only electrode = F
tbt: Bulk H, S in electrode region = T
tbt: Electrode self-energy imaginary Eta = 0.1000E-03 eV
tbt: Electrode self-energy accuracy = 0.1000E-13 eV
tbt: Electrode inter-layer distance (semi-inf) = 2.3867 Ang
ts: >> TBtrans contour <<
ts: Device Green function imaginary Eta = 0.000 eV
ts: Contour name = TBT.Contour.neq
ts: line contour E_min = -0.5000 eV

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

Backtrace for this error:
#0 0x3b8023291f in ???
#1 0xd7ded3 in ???
#2 0xadbc02 in __m_tbt_tri_scat_MOD_a_gamma
 at /home/pyrlinsv/src/SIESTA/siesta-4.1-b4/Util/TS/TBtrans/m_tbt_tri_scat.F90:1071
#3 0xacd857 in __m_tbt_trik_MOD_tbt_trik
 at /home/pyrlinsv/src/SIESTA/siesta-4.1-b4/Util/TS/TBtrans/m_tbt_trik.F90:1254
#4 0xabc725 in __m_tbtrans_MOD_tbt
 at /home/pyrlinsv/src/SIESTA/siesta-4.1-b4/Util/TS/TBtrans/m_tbtrans.F90:326
#5 0xb57e04 in tbtrans
 at /home/pyrlinsv/src/SIESTA/siesta-4.1-b4/Util/TS/TBtrans/tbtrans.F90:34
#6 0xb57e45 in main
 at /home/pyrlinsv/src/SIESTA/siesta-4.1-b4/Util/TS/TBtrans/tbtrans.F90:23
/var/spool/torque/mom_priv/jobs/658717.search6.di.uminho.pt.SC: line 46: 44808 Segmentation fault $TBT ${SCAT}.fdf > tbt_${SCAT}.out
--------------------------------------------------------------------------

Do I miss something while compileing Siesta?

Thank you in advance,

Sergey

Question information

Language:
English Edit question
Status:
Solved
For:
Siesta Edit question
Assignee:
No assignee Edit question
Solved by:
Nick Papior
Solved:
2018-12-04
Last query:
2018-12-04
Last reply:
2018-12-03
Best Nick Papior (nickpapior) said : #1

When using gnu compilers you should link to the GNU variants of MKL,

$(MKLROOT)/lib/intel64/libmkl_intel_lp64.a

should be:

$(MKLROOT)/lib/intel64/libmkl_gf_lp64.a

Sergey Pyrlin (pyrlinsv) said : #2

Dear Nick Papior,

Indeed that was a problem. Thank you for looking into this.

Sergey