2

I tried to compile the Hello World program in C, inside Eclipse PTP, but it gives me an error related to mpi.h.

I have included /usr/local/include and /usr/local/lib in my paths, and also tried running a search with find / -name mpi.h. I still get a No such file or directory error.

I tried to install mpich2, but still couldn't find mpi.h.

Also:

  • There is no folder inside the include directory, why is that?
  • I can find mpicc at /usr/bin/mpicc

The same problem occurs when trying to compile the project as C++ code. What should I do?

  • What OS? You probably don't have something like the mpi-devel or such package installed that includes the headers. – thrig Oct 21 '15 at 14:42
  • centos 6.7 i use eclipse PTP ( parallel Tool Plateform ) – Dalia Shouman Oct 21 '15 at 14:43
1

This Stack Overflow question answers yours.

According to yum, the mpi.h header file is provided by the following packages:

$ yum whatprovides '*/mpi.h'
openmpi-devel-1.8.1-1.el6.x86_64
mpich2-devel-1.2.1-2.3.el6.x86_64
mvapich2-devel-2.0rc1-1.el6.x86_64
mvapich-devel-1.2.0-0.3563.rc1.5.el6.x86_64
mvapich2-psm-devel-2.0rc1-1.el6.x86_64
mpich-devel-3.1-4.el6.x86_64
mvapich-psm-devel-1.2.0-0.3563.rc1.5.el6.x86_64   

I've removed most of the output, as well as the i686 versions. Pick the package according to what (variant) you're trying to work with. :)

Note that most of these packages create a subdirectory in /usr/include when installed. For instance, the mpi.h file provided by openmpi-devel is available at /usr/include/openmpi-x86_64/mpi.h, meaning you'd have to either include openmpi-x86_64/mpi.h in your source code, or add the /usr/include/openmpi-x86_64 directory to your include paths.

Also: some of these packages (such as mvapich-devel) don't even use /usr/include at all, and put their headers under /usr/lib64/{package}/include/.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.