Serial LAMMPS with Python

To whom it may concern,

When using LAMMPS through Python there is an issue that occurs. If mpi4py is installed, there is no way to use a serial version of LAMMPS. I have an MWE below which does not work for me because I have mpi4py installed.

import lammps
lmp = lammps.lammps(‘serial’)

The error that I get is as follows:

[zapp:08231] *** Process received signal ***

[zapp:08231] Signal: Segmentation fault (11)

[zapp:08231] Signal code: Address not mapped (1)

[zapp:08231] Failing at address: 0x19

[zapp:08231] [ 0] /lib64/libpthread.so.0(+0x13030)[0x7fa0318d2030]

[zapp:08231] [ 1] /usr/lib64/openmpi/lib/libmpi.so.20(PMPI_Type_size+0x4b)[0x7fa02a3dbe2b]

[zapp:08231] [ 2] /global/lammps/builds/stable/lib/liblammps_serial.so(_ZN9LAMMPS_NS6LAMMPSC1EiPPci+0x383)[0x7fa023d94883]

[zapp:08231] [ 3] /global/lammps/builds/stable/lib/liblammps_serial.so(lammps_open_no_mpi+0x3f)[0x7fa023bcd90f]

[zapp:08231] [ 4] /lib64/libffi.so.6(ffi_call_unix64+0x4c)[0x7fa02a866ace]

[zapp:08231] [ 5] /lib64/libffi.so.6(ffi_call+0x35f)[0x7fa02a86648f]

[zapp:08231] [ 6] /usr/lib64/python3.7/lib-dynload/_ctypes.cpython-37m-x86_64-linux-gnu.so(_ctypes_callproc+0x601)[0x7fa02a7cef71]

[zapp:08231] [ 7] /usr/lib64/python3.7/lib-dynload/_ctypes.cpython-37m-x86_64-linux-gnu.so(+0x136ef)[0x7fa02a7cf6ef]

[zapp:08231] [ 8] /lib64/libpython3.7m.so.1.0(_PyObject_FastCallKeywords+0x4bd)[0x7fa031a5956d]

[zapp:08231] [ 9] /lib64/libpython3.7m.so.1.0(_PyEval_EvalFrameDefault+0x5b0e)[0x7fa031aaa07e]

[zapp:08231] [10] /lib64/libpython3.7m.so.1.0(_PyEval_EvalCodeWithName+0x2e8)[0x7fa0319f39b8]

[zapp:08231] [11] /lib64/libpython3.7m.so.1.0(_PyFunction_FastCallDict+0x2ed)[0x7fa0319f4b8d]

[zapp:08231] [12] /lib64/libpython3.7m.so.1.0(_PyObject_Call_Prepend+0x66)[0x7fa031a05136]

[zapp:08231] [13] /lib64/libpython3.7m.so.1.0(+0x171f71)[0x7fa031a52f71]

[zapp:08231] [14] /lib64/libpython3.7m.so.1.0(_PyObject_FastCallKeywords+0x116)[0x7fa031a591c6]

[zapp:08231] [15] /lib64/libpython3.7m.so.1.0(_PyEval_EvalFrameDefault+0x5b0e)[0x7fa031aaa07e]

[zapp:08231] [16] /lib64/libpython3.7m.so.1.0(_PyEval_EvalCodeWithName+0x2e8)[0x7fa0319f39b8]

[zapp:08231] [17] /lib64/libpython3.7m.so.1.0(PyEval_EvalCodeEx+0x43)[0x7fa0319f4873]

[zapp:08231] [18] /lib64/libpython3.7m.so.1.0(PyEval_EvalCode+0x1b)[0x7fa0319f489b]

[zapp:08231] [19] /lib64/libpython3.7m.so.1.0(+0x23a8c2)[0x7fa031b1b8c2]

[zapp:08231] [20] /lib64/libpython3.7m.so.1.0(+0xd928b)[0x7fa0319ba28b]

[zapp:08231] [21] /lib64/libpython3.7m.so.1.0(PyRun_InteractiveLoopFlags+0xeb)[0x7fa0319be106]

[zapp:08231] [22] /lib64/libpython3.7m.so.1.0(+0xdd1a3)[0x7fa0319be1a3]

[zapp:08231] [23] /lib64/libpython3.7m.so.1.0(+0x23f261)[0x7fa031b20261]

[zapp:08231] [24] /lib64/libpython3.7m.so.1.0(_Py_UnixMain+0x3c)[0x7fa031b2049c]

[zapp:08231] [25] /lib64/libc.so.6(__libc_start_main+0xf3)[0x7fa03158e413]

[zapp:08231] [26] python3(_start+0x2e)[0x55f98a07008e]

[zapp:08231] *** End of error message ***

zsh: segmentation fault (core dumped) python3

If I change ‘serial’ in the MWE above to ‘mpi’, everything works fine. I have not been able to find a fix for it and wanted to let you know of the issue.

Thank you,
Brandon Laufer

To whom it may concern,

When using LAMMPS through Python there is an issue that occurs. If mpi4py is installed, there is no way to use a serial version of LAMMPS. I have an MWE below which does not work for me because I have mpi4py installed.

sorry, but i cannot confirm this. here is what i did:

make serial mode=shlib
make install-python

python

import mpi4py
import lammps
l = lammps.lammps()
LAMMPS (28 Feb 2019)

can you please tell us which LAMMPS version you are using?
and send us the output of:

ldd ./liblammps_serial.so

import lammps
lmp = lammps.lammps(‘serial’)

The error that I get is as follows:

[zapp:08231] *** Process received signal ***

[zapp:08231] Signal: Segmentation fault (11)

[zapp:08231] Signal code: Address not mapped (1)

[zapp:08231] Failing at address: 0x19

this error i have only seen, when using a LAMMPS shared library that was compiled/linked against OpenMPI while the LD_LIBRARY_PATH was set up for MPICH or vice versa.

what happens, if you build an executable with:

make serial mode=shexe

then run ./lmp_serial and input:

info config communication

and send us the output.

thanks,
axel.

[…]