Location of mpi.h
Typically, you should use mpicc
(or mpicxx
for C++) to compile instead of gcc
(or g++
for C++). These commands are simple wrappers around gcc
and g++
that simply add in the appropriate -I/path/to/mpi/includes
and -L/path/to/mpi/libs
automatically and should be included with your openmpi
install. In the absence of that, simply add -I/path/to/mpi/includes
in your command to compile the appropriate files. This tells the compiler where to look for the appropriate header files.
Comments
-
Shibli almost 2 years
I have a code on my computer uses
Petsc
which depends onmpi
. On my computer it works well. I put it on cluster, exported paths ofgcc
,Petsc
andopenmpi
(although I was usingmpich
on my computer I hopeopenmpi
will also work) toLD_LIBRARY_PATH
andPATH
. I also changed paths in makefile. Petsc, gcc, openmpi were all available on cluster so I did not configure anything. When I didmake
, compiler gave error:fatal error: mpi.h: No such file or directory
I know I did not give complete information but I can tell more if needed. How can I make the
Petsc
to know where ismpi.h
?