LAMMPS Stuck on Startup When Running with MPI (Windows) – Works Without MPI but Slow

Dear LAMMPS community,

I am encountering an issue where LAMMPS runs successfully in single-threaded mode (without MPI), but when executed with MPI, it gets stuck immediately after displaying the version information:

LAMMPS (4 Feb 2025)

No further output is produced, and the simulation does not start. The process does not crash but remains idle indefinitely. However, when running without MPI, the simulation executes correctly but much slower.

Execution Commands I Used:

MPI execution (not working, gets stuck):
mpiexec -np 8 lmp -in input_script.lmp

Single-threaded execution (working but slow):
lmp -in input_script.lmp

Troubleshooting Steps Taken:

  1. Verified MPI installation:

mpiexec --version confirms MS-MPI is installed correctly.

mpiexec -np 2 hostname prints correct output, proving MPI is functioning.

  1. Checked LAMMPS binary:

Running lmp -h correctly displays the help menu.

Running “lmp.exe” alone also gets stuck at the version banner when executed with MPI.

  1. Validated input script:

Confirmed that input_script.lmp is correctly formatted and not an incorrect .txt file.

  1. Attempted different execution approaches:

Running MPI with local-only option:
mpiexec -localonly -np 8 lmp -in input_script.lmp
“Unknown option: -localonly” output is received

  1. Checked log and output files:

log.lammps remains empty, suggesting LAMMPS never starts execution.

Redirecting output (mpiexec -np 8 lmp.exe -in input_script.lmp > output.log 2>&1) does not provide additional details.

Observations:

LAMMPS successfully runs without MPI, but is significantly slower.

When run with MPI, it starts, prints the version information, and then hangs indefinitely.

No CPU or memory usage is observed in Task Manager, suggesting MPI processes are not executing the simulation.

Questions:

  1. Why does LAMMPS get stuck when executed with MPI but works fine without it?

  2. Are there additional debugging steps I should take to identify the issue?

Any insights or suggestions would be greatly appreciated!

Best Regards

Could you try using older versions of the LAMMPS Windows executable and see what happens?

Sorry – it is tedious. But you have done a nice thorough job trying to debug your setup, so this is the next step unfortunately.

It is difficult to say anything specific without being able to reproduce what you are seeing.
It is quite possible that an input file will complete in a serial run while it fails in parallel due to atoms moving too fast and thus are being lost when synchronizing the parallel sub-domains.

However, the MPI library used on Windows will buffer output until it has reached the size of a buffer block (typically 4096 bytes) and that can make a run appear to not producing any output.

This could be circumvented by adding the -nb flag to the LAMMPS command line.

Another item to try out is to see, if you can run any of the inputs that are bundled with the LAMMPS distribution, e.g. the inputs in the bench folder. Those are tested to run well in parallel and thus if they don’t complete on your machine, there is likely a problem with the overall setup of your MPI library and not with LAMMPS itself.