[lammps-users] trouble installing LAMMPS with MPICH2

I compiled MPICH myself. I have indeed tested MPICH using a c-compiled program…everything there seems to be working fine. All the (what I believe to be) relevant lib files, such as libmpich.a etc. are in ~/mpich/mpich2-install/lib, linked in the makefile below. Could I be missing some files, or perhaps my makefile isnt in the correct format…

Here is my lammps makefile:

SHELL = /bin/bash
.SUFFIXES: .cpp .d
.IGNORE:

System-specific settings

CC = g++
CCFLAGS = -g -O -I/Users/andy/mpich/mpich2-install/include -DFFT_FFTW -DLAMMPS_GZIP -DMPICH_IGNORE_CXX_SEEK
DEPFLAGS = -D
LINK = g++
LINKFLAGS = -g -O -L/Users/andy/mpich/mpich2-install/lib -L/Users/andy/mpich/mpich2-1.0.8/src/binding/f77
USRLIB = -lfftw -lfmpich -lmpich -L/sw/lib/ -lg2c -g77libs
SYSLIB = -lpthread
ARCHIVE = ar
ARFLAGS = -rc
SIZE = size

#Link target

(EXE): (OBJ)
(LINK) (LINKFLAGS) (OBJ) (USRLIB) (SYSLIB) -o (EXE)
(SIZE) (EXE)

Library target

lib: (OBJ) (ARCHIVE) (ARFLAGS) (EXE) $(OBJ)

Compilation rules

.cpp.o:
(CC) (CCFLAGS) -c $<

Individual dependencies

(OBJ): (INC)

I compiled MPICH myself. I have indeed tested MPICH using a
c-compiled program...everything there seems to be working fine.
All the (what I believe to be) relevant lib files, such as
libmpich.a etc. are in ~/mpich/mpich2-install/lib, linked in the
makefile below. Could I be missing some files, or perhaps my
makefile isnt in the correct format...

actually, you should not need to provide any of the include or
linker paths related, when you use the mpiCC wrapper instead of
g++ as compiler and linker.

on top of that, the following flags are useless: -lg2c -g77libs -lfmpich
you don't use fortran, so you don't need to link with fortran
related files. the mpiCC wrapper should take care that you
link with the proper files. only when compiling mixed c++/fortran
code, one hast to fiddle around.

if not, it is a bug in the wrapper scripts. unfortunately, too many
people seem to believe that MPICH is the only MPI implementation
around and that it is easier to just work around the problems in
wrapper scripts rather than having them fixed or using a different
implmentation (e.g. OpenMPI, or its precursor LAM/MPI), where the
wrappers work very well, so makefiles have become needlessly
complicated.

cheers,
   axel.

When you do this in your Makefile.mac on a mac:

-L/Users/andy/mpich/mpich2-install/lib

and you have another MPI library on your system
somewhere (it may be bundled with OSX), then
it is possible the linker will find that one and not
yours, despite the -L. I have only seen this on Macs.

However, if you don't use -L, but just point to your
lib directly, e.g.

USRLIB = /Users/andy/mpich/mpich2-install/libmpi.a

then there should be no ambiguity about which MPI lib
to link against.

Steve