Computing rdf results in segmentation fault error

Dear Lammps Users

I am simulating a binary Lennard Jones and I want to have radial distribution function calculated and saved to a file during the simulation.

The Problem that I am facing is that the run completes smoothly if I comment the rdf calculation line and its output. I don’t know what is the problem, as I have implemented the compute command as it is specified in the manual :expressionless: I have included the input script below.

I would be pleased if someone help me with resolving this problem.

Best Regards

Dear Lammps Users

I am simulating a binary Lennard Jones and I want to have radial
distribution function calculated and saved to a file during the simulation.

The Problem that I am facing is that the run completes smoothly if I comment
the rdf calculation line and its output. I don't know what is the problem,
as I have implemented the compute command as it is specified in the manual
:expressionless: I have included the input script below.

cannot reproduce it here.

which version of LAMMPS do you use. what platform (CPU, OS, RAM,
parallel/serial (MPI?/OpenMP?)) are you running on?

Dear Alex
I am using Lammps version 9November 2013 on my Ubuntu desktop and built Lammps as serial.

Thanks for your response.

Best Regards

Dear Alex
I am using Lammps version 9November 2013 on my Ubuntu desktop and built
Lammps as serial.

still going strong here after 200000 steps.

can you do the following:

- check that your executable was compiled with the -g flag included
(if not, please add it and recompile).

then make sure you have the gdb debugger installed and run:

gdb --args lmp_serial -in ...

this will take you to the (gdb) prompt where you type "run" and hit enter.
this will run lammps under the control of the debugger and as soon as
the segmentation fault happens, it will drop you back into the
debugger and telling you exactly where the problem happened.

you should also type: "where"

and then copy/paste this information into your next e-mail.

axel.

Dear Axel

I have a question, I don’t know where exactly in Makefile.serial I have to put the -g flag. there are several line as I have included below:

Thanks in advance.

Dear Axel

I have a question, I don't know where exactly in Makefile.serial I have to
put the -g flag. there are several line as I have included below:

CCFLAGS and LINKFLAGS

(obviously)

axel.

Dear Axel
Here is the outcome of what you told me to do:

gdb --args lmp_serial -in.eq_2D_LJ_SingleComponenet_NVT
GNU gdb (GDB) 7.6.1-ubuntu
Copyright © 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type “show copying”
and “show warranty” for details.
This GDB was configured as “i686-linux-gnu”.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>…
Reading symbols from /home/muhammad/lammps_runs/fcc_nvt_T2/lmp_serial…done.
(gdb) run
Starting program: /home/muhammad/lammps_runs/fcc_nvt_T2/lmp_serial -in.eq_2D_LJ_SingleComponenet_NVT
ERROR: Invalid command-line argument (…/lammps.cpp:172)
[Inferior 1 (process 8629) exited with code 01]
(gdb) where
No stack.

Dear Axel
Here is the outcome of what you told me to do:

gdb --args lmp_serial -in.eq_2D_LJ_SingleComponenet_NVT
GNU gdb (GDB) 7.6.1-ubuntu
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
<http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "i686-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from
/home/muhammad/lammps_runs/fcc_nvt_T2/lmp_serial...done.
(gdb) run
Starting program: /home/muhammad/lammps_runs/fcc_nvt_T2/lmp_serial
-in.eq_2D_LJ_SingleComponenet_NVT
ERROR: Invalid command-line argument (../lammps.cpp:172)

useless. your command line was incorrect. you first have to make sure
that lammps runs correctly and then run under the debugger with gdb
--args prepended.

Dear Axel

I think lammps works correctly since when I use the command :
./lmp_serial < in. …
it works fine and results the same segmentation fault (when I comment the rdf lines, it works smoothly and without any problem).
I don’t know what is the problem with my command, can you suggest me how to solve it?

Best Regards

Dear Axel

I think lammps works correctly since when I use the command :
./lmp_serial < in. ...

RTFM!

the syntax is

./lmp_serial -in in.xxx

I/O redirection as you do it is *evil* and should be avoided.

it works fine and results the same segmentation fault (when I comment the
rdf lines, it works smoothly and without any problem).
I don't know what is the problem with my command, can you suggest me how to
solve it?

read the &$$%##-ing manual. it is all there.

axel.

Dear Axel

Okey. I read the …ing Manual, and I got it! lmp_serial < in…

Now the original problem still exists. How to debug it with gdb since it works fine without the rdf lines. and it return the following line with gdb:

muhammad@…4653…:~/lammps_runs/fcc_nvt_T2$ gdb --args lmp_serial in.eq

GNU gdb (GDB) 7.6.1-ubuntu
Copyright © 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type “show copying”
and “show warranty” for details.
This GDB was configured as “i686-linux-gnu”.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>…
Reading symbols from /home/muhammad/lammps_runs/fcc_nvt_T2/lmp_serial…done.
(gdb) run
Starting program: /home/muhammad/lammps_runs/fcc_nvt_T2/lmp_serial in.eq
ERROR: Invalid command-line argument (…/lammps.cpp:172)
[Inferior 1 (process 3310) exited with code 01]

Dear Axel

Okey. I read the ...ing Manual, and I got it! lmp_serial < in....

no, you *didn't*.

Dear Axel
Thanks for guiding me, I hadn’t got it correctly. here is the gdb results:

gdb --args lmp_serial -in in.eq
GNU gdb (GDB) 7.6.1-ubuntu
Copyright © 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type “show copying”
and “show warranty” for details.
This GDB was configured as “i686-linux-gnu”.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>…
Reading symbols from /home/muhammad/lammps_runs/fcc_nvt_T2/lmp_serial…done.
(gdb) run
Starting program: /home/muhammad/lammps_runs/fcc_nvt_T2/lmp_serial -in in.eq
LAMMPS (9 Nov 2013)
Lattice spacing in x,y,z = 1.0483 1.0483 1.0483
Created orthogonal box = (0 0 0) to (10.483 10.483 41.9319)
1 by 1 by 1 MPI processor grid
Created 3456 atoms
Setting atom values …
699 settings made for type/fraction
3456 atoms in group alles
Setting up run …

Program received signal SIGSEGV, Segmentation fault.
LAMMPS_NS::NeighList::memory_usage (this=0x84b2e48) at …/neigh_list.cpp:272
272 bytes += ipage[i].size();
(gdb) where
#0 LAMMPS_NS::NeighList::memory_usage (this=0x84b2e48)
at …/neigh_list.cpp:272
#1 0x081c1a81 in LAMMPS_NS::Neighbor::memory_usage (this=)
at …/neighbor.cpp:1951
#2 0x081d5be1 in LAMMPS_NS::Output::memory_usage (this=this@…4654…=0x8451988)
at …/output.cpp:760
#3 0x081d627b in LAMMPS_NS::Output::setup (this=0x8451988,
memflag=memflag@…4654…=1) at …/output.cpp:253
#4 0x083a7cb7 in LAMMPS_NS::Verlet::setup (this=0x8452b00)
at …/verlet.cpp:145
#5 0x08385feb in LAMMPS_NS::Run::command (this=this@…4654…=0xbfffef10,
narg=narg@…4654…=1, arg=arg@…4654…=0x8498b50) at …/run.cpp:170
#6 0x081831de in LAMMPS_NS::Input::command_creator<LAMMPS_NS::Run> (
lmp=0x8440b80, narg=1, arg=0x8498b50) at …/input.cpp:618
#7 0x081820dc in LAMMPS_NS::Input::execute_command (this=this@…12…4654…=0x84410a8)
at …/input.cpp:601
#8 0x0818245d in LAMMPS_NS::Input::file (this=0x84410a8) at …/input.cpp:215
#9 0x0818e586 in main (argc=3, argv=0xbffff0c4) at …/main.cpp:30

Dear Axel
Thanks for guiding me, I hadn't got it correctly. here is the gdb results:

thanks. this is a very puzzling case. the code in question should not
trip this error.

i have a few more questions:

does your LAMMPS version include any modifications?
can you send me the output of "gcc -v" ?

can you please check, if you have a program called "valgrind" installed?
if yes, can you run

valgrind ./lmp_serial -in in.eq

and post the output?
(not (yet) needed, if you don't have it)

thanks,
     axel.

Dear Axel

I downloaded lammps tarball from Lammps website and I did not do any modifications. I just activate the meam package, and compiled the necessary library for it, then I used “make” command in the STUB folder and finally make serial in the src folder.

gcc -v output :

muhammad@…4653…:~/lammps_runs/fcc_nvt_T2$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/i686-linux-gnu/4.8/lto-wrapper
Target: i686-linux-gnu
Configured with: …/src/configure -v --with-pkgversion=‘Ubuntu/Linaro 4.8.1-10ubuntu8’ --with-bugurl=file:///usr/share/doc/gcc-4.8/README.Bugs --enable-languages=c,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.8 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.8 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-4.8-i386/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-4.8-i386 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-4.8-i386 --with-arch-directory=i386 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-targets=all --enable-multiarch --disable-werror --with-arch-32=i686 --with-multilib-list=m32,m64,mx32 --with-tune=generic --enable-checking=release --build=i686-linux-gnu --host=i686-linux-gnu --target=i686-linux-gnu
Thread model: posix
gcc version 4.8.1 (Ubuntu/Linaro 4.8.1-10ubuntu8)

and the valgrind results in:

muhammad@…4653…:~/lammps_runs/fcc_nvt_T2$ valgrind ./lmp_serial -in in.eq
==5179== Memcheck, a memory error detector
==5179== Copyright © 2002-2012, and GNU GPL’d, by Julian Seward et al.
==5179== Using Valgrind-3.8.1 and LibVEX; rerun with -h for copyright info
==5179== Command: ./lmp_serial -in in.eq
==5179==
LAMMPS (9 Nov 2013)
Lattice spacing in x,y,z = 1.0483 1.0483 1.0483
Created orthogonal box = (0 0 0) to (10.483 10.483 41.9319)
1 by 1 by 1 MPI processor grid
Created 3456 atoms
Setting atom values …
676 settings made for type/fraction
3456 atoms in group alles
Setting up run …
==5179== Invalid read of size 4
==5179== at 0x81CD6CC: LAMMPS_NS::NeighList::memory_usage() (my_page.h:184)
==5179== by 0x81C1A80: LAMMPS_NS::Neighbor::memory_usage() (neighbor.cpp:1951)
==5179== by 0x81D5BE0: LAMMPS_NS::Output::memory_usage() (output.cpp:760)
==5179== by 0x81D627A: LAMMPS_NS::Output::setup(int) (output.cpp:253)
==5179== by 0x83A7CB6: LAMMPS_NS::Verlet::setup() (verlet.cpp:145)
==5179== by 0x44C6ED7: ???
==5179== Address 0x10 is not stack’d, malloc’d or (recently) free’d
==5179==
==5179==
==5179== Process terminating with default action of signal 11 (SIGSEGV)
==5179== Access not within mapped region at address 0x10
==5179== at 0x81CD6CC: LAMMPS_NS::NeighList::memory_usage() (my_page.h:184)
==5179== by 0x81C1A80: LAMMPS_NS::Neighbor::memory_usage() (neighbor.cpp:1951)
==5179== by 0x81D5BE0: LAMMPS_NS::Output::memory_usage() (output.cpp:760)
==5179== by 0x81D627A: LAMMPS_NS::Output::setup(int) (output.cpp:253)
==5179== by 0x83A7CB6: LAMMPS_NS::Verlet::setup() (verlet.cpp:145)
==5179== by 0x44C6ED7: ???
==5179== If you believe this happened as a result of a stack
==5179== overflow in your program’s main thread (unlikely but
==5179== possible), you can try to increase the size of the
==5179== main thread stack using the --main-stacksize= flag.
==5179== The main thread stack size used in this run was 8388608.
==5179==
==5179== HEAP SUMMARY:
==5179== in use at exit: 2,338,816 bytes in 726 blocks
==5179== total heap usage: 870 allocs, 144 frees, 2,532,497 bytes allocated
==5179==
==5179== LEAK SUMMARY:
==5179== definitely lost: 0 bytes in 0 blocks
==5179== indirectly lost: 0 bytes in 0 blocks
==5179== possibly lost: 4,757 bytes in 209 blocks
==5179== still reachable: 2,334,059 bytes in 517 blocks
==5179== suppressed: 0 bytes in 0 blocks
==5179== Rerun with --leak-check=full to see details of leaked memory
==5179==
==5179== For counts of detected and suppressed errors, rerun with: -v
==5179== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)
Segmentation fault (core dumped)

Dear Axel

I downloaded lammps tarball from Lammps website and I did not do any
modifications. I just activate the meam package, and compiled the necessary
library for it, then I used "make" command in the STUB folder and finally
make serial in the src folder.

thanks. this is very helpful. i have no idea, where this segfault is
coming from, but i know where and how to look now. more later. axel.

Dear Axel

I downloaded lammps tarball from Lammps website and I did not do any
modifications. I just activate the meam package, and compiled the necessary
library for it, then I used "make" command in the STUB folder and finally
make serial in the src folder.

thanks. this is very helpful. i have no idea, where this segfault is
coming from, but i know where and how to look now. more later. axel.

ok. i tried pretty much everything that i can think of to narrow this down.
one final thing you can try out, would be to type

ulimit -s unlimited

before you run your job and see, if that makes a difference. failing
that, my best guess is that there may be something wrong with the
compiler or hardware on your machine and i would recommend to install
a precompiled executable.

i've tried your input on several different machines with difference
Linux OS and bitness and it worked everywhere.

axel.

Dear Axel
Thank you very much for your time and considering the problem. I used the “ulimit -s unlimited” as well and it could not do the job. I also built the lmp_serial on another computer, and the problem was still there. I guess there might be some bug in this.
I used the precompiled just now and it works smoothly with the input scripts. I have a question about this prebuilt version, does it include all packages enabled, like meam?

Thanks again.

Best Regards

Dear Axel
Thank you very much for your time and considering the problem. I used the
"ulimit -s unlimited" as well and it could not do the job. I also built the
lmp_serial on another computer, and the problem was still there. I guess
there might be some bug in this.

there has to be something very unusual going on, since it doesn't seem
to happen elsewhere. it would be *extremely* helpful, if other people
on this list could see, if they can run the attached input and report
if they do get a segmentation fault or not and what platform (OS
version, 32-bit/64-bit, compiler, CPU) they are running on.

I used the precompiled just now and it works smoothly with the input
scripts. I have a question about this prebuilt version, does it include all
packages enabled, like meam?

i don't know, since there are several ways to obtain a precompiled
binary and those may be different. the binaries (for windows and
centos/fedora/opensuse) that *i* prepare *do* contain meam. i only
exclude packages, where licensing restrictions prohibit bundling
(CUDA, OpenKIM) and where the package is obsolete (i.e. the Fortran
based implementation of ReaxFF). you can easily check for yourself by
using the -h flag, e.g. lmp_g++ -h, then it will print out all
"styles" that are included and you should find meam among them, if it
was compiled into the binary.

axel.

in.rdf (1.01 KB)

Dear Axel and Muhammad,

OK for 1000000 steps here, Ubuntu 12.04 LTS 64-bit, Intel C++ compiler 12.1.5, MPICH 3.0.3, Core i7 950, lammps-svn r11016 (11 Nov 2013). No segfaults. Really strange that the error was reproduced on another machine. Was any of makefiles changed?

Oleg.