Re: [AMBER] cuda parallel - can't find mpi.h

From: Ross Walker <>
Date: Fri, 1 Jun 2012 09:19:33 -0700

AAARRRGHHHH!!! This is why "I hate Ubuntu"(tm). Ubuntu installs the mpi
libraries, binaries and header files in non-standard paths, separate from
the way everyone else does it. Granted the GPU installation of AMBER has to
rely on several assumption for parallel builds, as there is not an MPI
wrapper for the NVCC compiler but it is so much simpler on other versions of

Essentially the problem is that Ubuntu places it's package installed OpenMPI



Or something similar. This means there is no way to have $MPI_HOME that can
be automated to point to the binaries and the include files. You have two
options. The first is to locate mpi.h which will be in
/usr/include/openmpi... or something similar - I don't have an Ubuntu
machine at hand right now so I can't find the exact path. However, once you
have this edit the AMBER config.h file and change the -I/usr/include in
PMEMD_CU_INCLUDES to -I/usr/include/the_path_to_mpi.h

Then make again and it should work. The second option is to ditch OpenMPI
altogether since the performance sucks and instead switch to using mpich2.
You can either build this yourself from source obtained from the mpich2 site
or I think you can do the following on Ubuntu.

sudo apt-get remove openmpi-bin libopenmpi-dev
sudo apt-get install libmpich2-dev mpich2

This 'should' I hope put things in a more consistent path. I.e. where
$MPI_HOME/bin and $MPI_HOME/lib and $MPI_HOME/include all point to valid

On the other hand do you have multiple 'identical' GPUs in your machine? -
If not then there is nothing to be gained by building the parallel version
of pmemd.cuda.

All the best

> -----Original Message-----
> From: Jonathan Gough []
> Sent: Friday, June 01, 2012 8:45 AM
> To: AMBER Mailing List
> Subject: [AMBER] cuda parallel - can't find mpi.h
> I did search for this answer, but it was not there exactly. What was
> there
> i tried and it didn't work.
> ubuntu 12.04
> amber 12
> openmpi
> in .bashrc
> export LD_LIBRARY_PATH=/usr/local/cuda/lib:$LD_LIBRARY_PATH
> export LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH
> export AMBERHOME=/home/jonathan/amber12
> export PATH=$PATH:/usr/local/cuda/bin
> export CUDA_HOME=/usr/local/cuda
> export PATH=$PATH:/$CUDA_HOME/bin
> serial compile and test worked/passed
> parallel compile and test worked/passed
> cuda compile and test worked/passed (finally - thanks Ross, David case,
> Jason and others)
> (this uses the 'dac' method of editing of the config.h file moving
> ./cuda/cuda.a infront of the flags post configure, pre install)
> finally while trying to compile the paralllel cuda version, I get the
> following error.
> make[3]: Entering directory `/home/jonathan/amber12/src/pmemd/src'
> make -C ./cuda
> make[4]: Entering directory `/home/jonathan/amber12/src/pmemd/src/cuda'
> /usr/local/cuda/bin/nvcc -use_fast_math -O3 -gencode
> arch=compute_13,code=sm_13 -gencode arch=compute_20,code=sm_20 -DCUDA -
> -DMPICH_IGNORE_CXX_SEEK -I/usr/local/cuda/include -IB40C
> -IB40C/KernelCommon -I/usr/include -c
> In file included from gpu.h:15:0,
> from
> gputypes.h:30:17: fatal error: mpi.h: No such file or directory
> compilation terminated.
> make[4]: *** [kForcesUpdate.o] Error 1
> make[4]: Leaving directory `/home/jonathan/amber12/src/pmemd/src/cuda'
> make[3]: *** [cuda/cuda.a] Error 2
> make[3]: Leaving directory `/home/jonathan/amber12/src/pmemd/src'
> make[2]: *** [cuda_parallel] Error 2
> Here are the path's that are in place using whereis
> mpi: /usr/include/mpi
> openmpi: /etc/openmpi /usr/lib/openmpi /usr/include/openmpi
> /usr/share/openmpi
> mpif90: /usr/bin/mpif90.openmpi /usr/bin/mpif90
> /usr/bin/X11/mpif90.openmpi
> /usr/bin/X11/mpif90 /usr/share/man/man1/mpif90.1.gz
> the one it can't find is at:
> /usr/include/mpi/mpi.h
> Previously it was suggested to add MPI_HOME. to the path /usr and I did
> try
> that. no dice.
> (export MPI_HOME=/usr)
> -- also tried
> (export PATH=$PATH:/$MPI_HOME/usr/bin/mpif90)
> no dice
> tried it without the mentioned edit in the config.h file, no dice
> I did a full clean and recompiled parallel successfully and it passed
> all
> tests.
> parallel cuda compile (after that) still gives the same error.
> jason mentioned adding the path to the nvcc flags, which I understand
> in
> theory, but I'm not sure exactly of how the syntax is supposed to look.
> (if
> someone could show me that would be great =))
> any insight on fixing this would be appreciated!
> Thanks,
> Jonathan
> _______________________________________________
> AMBER mailing list

AMBER mailing list
Received on Fri Jun 01 2012 - 09:30:04 PDT
Custom Search