[lammps-users] Compiling with openmpi

Hi,

I was able to compile LAMMPS with mpich2. Now I switched to a new cluster and wanted to try openmpi. I did nothing to the Makefile other than adding the MPI path settings (I attached the makefile). It gives me errors as following. Any suggestion will be highly appreciated. Thanks!

angle_charmm.o: In function MPI::Op::Init(void (*)(void const*, void*, int, MPI::Datatype const&), bool)': angle_charmm.cpp:(.text._ZN3MPI2Op4InitEPFvPKvPviRKNS_8DatatypeEEb[MPI::Op::Init(void (*)(void const*, void*, int, MPI::Datatype const&), bool)]+0x20): undefined reference to ompi_mpi_cxx_op_intercept’
angle_charmm.o: In function MPI::Graphcomm::Clone() const': angle_charmm.cpp:(.text._ZNK3MPI9Graphcomm5CloneEv[MPI::Graphcomm::Clone() const]+0x2f): undefined reference to MPI::Comm::Comm()’
angle_charmm.o: In function MPI::Intracomm::Create(MPI::Group const&) const': angle_charmm.cpp:(.text._ZNK3MPI9Intracomm6CreateERKNS_5GroupE[MPI::Intracomm::Create(MPI::Group const&) const]+0x31): undefined reference to MPI::Comm::Comm()’
angle_charmm.o: In function MPI::Intracomm::Create_cart(int, int const*, bool const*, bool) const': angle_charmm.cpp:(.text._ZNK3MPI9Intracomm11Create_cartEiPKiPKbb[MPI::Intracomm::Create_cart(int, int const*, bool const*, bool) const]+0x144): undefined reference to MPI::Comm::Comm()’
angle_charmm.o: In function MPI::Intracomm::Create_graph(int, int const*, int const*, bool) const': angle_charmm.cpp:(.text._ZNK3MPI9Intracomm12Create_graphEiPKiS2_b[MPI::Intracomm::Create_graph(int, int const*, int const*, bool) const]+0x40): undefined reference to MPI::Comm::Comm()’
angle_charmm.o: In function MPI::Cartcomm::Clone() const': angle_charmm.cpp:(.text._ZNK3MPI8Cartcomm5CloneEv[MPI::Cartcomm::Clone() const]+0x2f): undefined reference to MPI::Comm::Comm()’
angle_charmm.o:angle_charmm.cpp:(.text._ZN3MPI8Cartcomm3SubEPKb[MPI::Cartcomm::Sub(bool const*)]+0x7f): more undefined references to MPI::Comm::Comm()' follow collect2: ld returned 1 exit status make[1]: *** [../lmp_openmpi] Error 1 make[1]: Leaving directory /home/liangfei/src/lammps-3Jul10/src/Obj_openmpi’
make: *** [openmpi] Error 2

Makefile.openmpi (2.6 KB)

Hi,

I was able to compile LAMMPS with mpich2. Now I switched to a new cluster
and wanted to try openmpi. I did nothing to the Makefile other than adding
the MPI path settings (I attached the makefile). It gives me errors as
following. Any suggestion will be highly appreciated. Thanks!

why add those paths?
most likely there is some kind of mismatch with the paths
and the mpic++ wrapper (try: which mpic++).
to make sure you get the right mpi installation, you could try
/home/liangfei/openmpi/bin/mpic++ instead of mpic++

with a correct openmpi installation you should not need
to specify _any_ mpi related paths or libraries as it is shown
in the Makefile.openmpi in the distribution.

the reason why so many packages list those paths explicitly
and use plain gcc/g++/cc/CC instead is found in the incredible
brokenness of the mpic++/mpicc wrappers that come with MPICH.

sadly, the many workarounds for that brokenness have lead to
most packages being easier to compile with MPICH than OpenMPI
or other decent MPI implementations.

cheers,
    axel.

This is not a LAMMPS problem, but a problem with linking the MPI library on this machine. Find someone or something that has figured out how to do this, and follow their example.