Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

fatal error: mpi.h: No such file or directory #include <mpi.h>

Tags:

c++

c

mpi

openmpi

when I compile my script with only

#include <mpi.h> 

it tells me that there is no such file or directory. But when i include the path to mpi.h as

#include "/usr/include/mpi/mpi.h" 

(the path is correct) it returns:

In file included from /usr/include/mpi/mpi.h:2087:0,                  from lbm.cc:7: /usr/include/mpi/openmpi/ompi/mpi/cxx/mpicxx.h:35:17: fatal error: mpi.h: No such file or directory  #include "mpi.h"                  ^ compilation terminated. 

Anyone know how to fix this?

like image 813
user2804865 Avatar asked Nov 13 '14 23:11

user2804865


1 Answers

The problem is almost certainly that you're not using the MPI compiler wrappers. Whenever you're compiling an MPI program, you should use the MPI wrappers:

  • C - mpicc
  • C++ - mpiCC, mpicxx, mpic++
  • FORTRAN - mpifort, mpif77, mpif90

These wrappers do all of the dirty work for you of making sure that all of the appropriate compiler flags, libraries, include directories, library directories, etc. are included when you compile your program.

like image 150
Wesley Bland Avatar answered Sep 24 '22 02:09

Wesley Bland