Difference between revisions of "Identify what's causing segmentation fault in Yambo"

From The Yambo Project
Jump to navigation Jump to search
Line 6: Line 6:
'''Rule out possible causes of the segmentation fault:'''
'''Rule out possible causes of the segmentation fault:'''


# '''GPU''': are you running Yambo with GPU support? In this case try to recompile without <code>--enable-cuda</code> flag. If this solve the problem report your bug in the section [http://www.yambo-code.org/forum/viewforum.php?f=38 Yambo on GPU machines] otherwise to the next step.
# '''GPU''': recompile without GPU support, remove the <code>--enable-cuda</code> flag. If this solve the problem report the bug in forum GPU section [http://www.yambo-code.org/forum/viewforum.php?f=38 Yambo on GPU machines].
# '''OPEN-MP''': compile and run Yambo without open-mp support, no <code>--enable-open-mp</code> flag in compilation and <code>OMP_NUM_THREADS="1"</code>.
# '''OPEN-MP''': compile and run Yambo without open-mp support, no <code>--enable-open-mp</code> flag in compilation and <code>OMP_NUM_THREADS="1"</code>.
# '''Lapack/Blas''': compile Yambo with internal Lapack/Blas libraries <code>--enable-int-linalg</code> in the configure.
# '''Lapack/Blas''': use internal Lapack/Blas. Reconfigure and recompile Yambo with the flag <code>--enable-int-linalg</code>.
# '''FFT''': compile Yambo with internal FFT libraries <code>--enable-internal-fftsg</code> in the configure.
# '''FFT''': compile Yambo with internal FFT libraries <code>--enable-internal-fftsg</code> .
# '''Scalapack''': compile without Scalpack, unset the flag <code>--with-scalapack-libs</code> if you use it.
# '''Scalapack''': compile without Scalpack, unset the flag <code>--with-scalapack-libs</code>.
# '''Parallelism'''
# '''Parallelism'''
## Change the number of processors
## Change the number of processors
Line 16: Line 16:
## Run in serial
## Run in serial
# '''Optimization''': use a lower optimization level for example O1 or O0, by doing <code>./configure FCFLAGS="-O0" F77FLAGS="-O1"</code>
# '''Optimization''': use a lower optimization level for example O1 or O0, by doing <code>./configure FCFLAGS="-O0" F77FLAGS="-O1"</code>
# '''Compilers''': change  C/Fortran compiler if it is possible, move form  intel fortran to gfortran or vice-versa. <br>In order to set compilers use for intel <code>./configure FC=ifort F77=ifort CC=icc</code> and for gfortran <code>./configure FC=gfortran F77=gfortran CC=gcc</code>
# '''Compilers''': change  C/Fortran compiler if it is possible, move form  intel fortran to gfortran or vice-versa. <br>In order to set compilers in the configure use <code>./configure FC=ifort F77=ifort CC=icc</code> for Intel        and <code>./configure FC=gfortran F77=gfortran CC=gcc</code> for gfortran.
<br>
<br>
If no one of the previous steps solved your problem or you want to try to identity from where the segmentation fault came from, you can try to debug it:  
If no one of the previous steps solved your problem, report the problem in the forum. <br>
If you want you can try to debug Yambo and identity from where the segmentation fault following the steps below, this will help developers to find a solution to your problem more quickly:  


'''Debugging the segmentation fault:'''
'''Debugging the segmentation fault:'''

Revision as of 18:06, 10 January 2021

There may be different reasons why the Yambo code generates segmentation faults in a run.
To help Yambo developers understand where the problem lies and help you, please follow the steps below. If one of the step solves your problem and please report the result in the forum.


Rule out possible causes of the segmentation fault:

  1. GPU: recompile without GPU support, remove the --enable-cuda flag. If this solve the problem report the bug in forum GPU section Yambo on GPU machines.
  2. OPEN-MP: compile and run Yambo without open-mp support, no --enable-open-mp flag in compilation and OMP_NUM_THREADS="1".
  3. Lapack/Blas: use internal Lapack/Blas. Reconfigure and recompile Yambo with the flag --enable-int-linalg.
  4. FFT: compile Yambo with internal FFT libraries --enable-internal-fftsg .
  5. Scalapack: compile without Scalpack, unset the flag --with-scalapack-libs.
  6. Parallelism
    1. Change the number of processors
    2. Use automatic parallelization, unset all parallel variable input
    3. Run in serial
  7. Optimization: use a lower optimization level for example O1 or O0, by doing ./configure FCFLAGS="-O0" F77FLAGS="-O1"
  8. Compilers: change C/Fortran compiler if it is possible, move form intel fortran to gfortran or vice-versa.
    In order to set compilers in the configure use ./configure FC=ifort F77=ifort CC=icc for Intel and ./configure FC=gfortran F77=gfortran CC=gcc for gfortran.


If no one of the previous steps solved your problem, report the problem in the forum.
If you want you can try to debug Yambo and identity from where the segmentation fault following the steps below, this will help developers to find a solution to your problem more quickly:

Debugging the segmentation fault:

  1. Checing options: compile Yambo with the compiler checking options and run again your simulation, report the result in the forum:
    1. for g-fortran compiler ./configure FCFLAGS="-O1 -g -fcheck=all" UFLAGS="-O0 -g -fcheck=all" FFLAGS="-O1 -g -fcheck=all" --enable-keep-src"
    2. for intel fortran ./configure FCFLAGS="-O1 -g -CB -CA -debug" UFLAGS="-O0 -g -CB -CA -debug" FFLAGS="-O1 -g -CB -CA -debug" --enable-keep-src"
  2. Use a debugger: Compile with debugging options, "-O1 -g" for gfortran "-O1 -g -debug for ifortran, plus the --enable-keep-src flag, then execute your job in a debugger for example gdb --args yambo -F yambo_input.in. It can work also in parallel see here and here
  3. Memory leaks: [only for experts] compile Yambo with debugging option then run your job with valgrind: valgrind --tool=memcheck --leak-check=summary ./yambo