trouble building lmp with MPI on MacOS

I am trying to build 7 Aug 2019 using cmake on MacOS (10.14.6).

I build with these commands:

mkdir build
cd build
cmake -D PKG_PYTHON=on -D PKG_MANYBODY=on -D PKG_OPT=on -D BUILD_LIB=yes -D BUILD_SHARED_LIBS=on -D PKG_REPLICA=on …/cmake
make -j 4

followed by
make install
into my ~/.local

The executable lmp is in ~/.local/bin and I added that to my PATH.

When I try running
mpi -np 4 lmp -help

I get four reports of this error:

Fatal error in MPI_Init: Other MPI error, error stack:
MPIR_Init_thread(572)…:
MPID_Init(224)…: channel initialization failed
MPIDI_CH3_Init(105)…:
MPID_nem_init(324)…:
MPID_nem_tcp_init(178)…:
MPID_nem_tcp_get_business_card(425):
MPID_nem_tcp_init(384)…: gethostbyname failed, 52.7.23.172.generic.clemson.edu (errno 1)

I have used mpi with other codes so I am perplexed. Please advise.

…Murray Daw

I’ve never seen the command “mpi” before, is this some non-standard Mac thing? Is it equivalent to mpiexec/mpirun?
Anyhoo, it’s important that the MPI library lammps is compiled against is the same as the one you are using at runtime. If not, that’ll give issues. What output do you get if you use just one core and don’t run it with mpi?
Besides these questions I am not much help. Axel is good with MPI issues.

Is this perhaps related?
https://stackoverflow.com/questions/23112515/mpich2-gethostbyname-failed

[…]

I get four reports of this error:

Fatal error in MPI_Init: Other MPI error, error stack:
MPIR_Init_thread(572)…:
MPID_Init(224)…: channel initialization failed
MPIDI_CH3_Init(105)…:
MPID_nem_init(324)…:
MPID_nem_tcp_init(178)…:
MPID_nem_tcp_get_business_card(425):
MPID_nem_tcp_init(384)…: gethostbyname failed, 52.7.23.172.generic.clemson.edu (errno 1)

I have used mpi with other codes so I am perplexed. Please advise.

this is an error from your MPI library not LAMMPS, and the indication is that the reverse lookup of your machine’s hostname failed.
this is either a machine configuration error or a network connectivity issue.

axel.