Re: AMBER: Fwd: Amber9 parallel compilation openmpi issues

From: David A. Case <>
Date: Wed, 25 Jul 2007 12:56:24 -0700

On Wed, Jul 25, 2007, Mark Williamson wrote:

> I'm desperately trying not cloud the waters here, but here's my take on
> it :)
> When AMBER's configure script is run with the openmpi flag, the
> following section of code within this script is visited:
> ...blah....
> openmpi)
> if [ -z "$MPI_HOME" ]; then
> FILES="mpif.h and libmpi.a, liblam.a or liblamf77mpi.a"
> EXAMPLE="/usr/local/openmpi-1.0"
> par_error
> fi
> echo "MPI_HOME is set to $MPI_HOME"
> loadlib=`$MPI_HOME/bin/mpif90 -showme | perl -p -e
> 's/(-[lLW]\S+\s)|\S+\s/$1/g'`
> fppflags="-I$MPI_HOME/include $fppflags -DMPI"
> ;;
> ...blah....
> Hence, I suggest trying:
> cd $AMBERHOME/src
> make clean
> export MPI_HOME=/usr/local
> ./configure -openmpi ifort_x86_64
> make parallel

I'll defer to Mark here, because I guess this works for him. But here's the
problem I have, and I don't quite understand why he doesn't have it as well:

If config.h has FC=ifort, then the following happens when I try to compile
a parallel code foo.f:

     1. The preprocessor sees the "#include mpif.h" and correctly finds
         $MPI_HOME/include/mpif.h and puts it into the _foo.f file

     2. However, $MPI_HOME/include/mpif.h has inside it a fortran90 include
         line "include 'mpif-common.h'". And when ifort sees this line,
         it doesn't know where to find mpif-common.h, and fails. If FC in
         config.h is set to mpif90, then there is no problem, since mpif90
         is smart enough to know where to find this second include file.

It was after Amber9 was released that the openMPI folks changed their header
file, to use the fortran90 include mechanism to get mpif-common.h.
Previously, $MPI_HOME/include/mpif.h had been a simple file that could just
be included at the cpp pre-processing step. So, the configure script above
worked at release time, but stopped working later on (at least for me!).

The simple question for Mark is this: what version of openMPI are you using?
Can you check on what is inside your $MPI_HOME/include/mpif.h file?

Somewhat of an aside: we've found that relying on the "showme" command is
not always that reliable. This has been more a problem with lam than
openmpi,if I remember correctly. But the general consensus among Amber
developers is that we are better off setting FC=mpif90 (or mpif77 for lam)
and relying on mpif90 to do the right thing, both for compiling and loading.
(After all, that is its purpose in life.)

Bottom line: it's a real pain that we have to rely on a outside MPI
installation, which might be one of several flavors. For amber10, I am
seriously considering including an MPI installation with Amber, along with
instructions that we know(!?!) will work. This will at least get people
going; more advanced users can then substitute a local MPI library in place
of the one we supply, if they need that for efficiency. Comments and
suggestions would be welcome here.


The AMBER Mail Reflector
To post, send mail to
To unsubscribe, send "unsubscribe amber" to
Received on Sun Jul 29 2007 - 06:07:15 PDT
Custom Search