In general, how do I build MPI applications with Open MPI?
The Open MPI team strongly recommends that you simply use Open MPI’s “wrapper” compilers to compile your MPI applications. That is, instead of using (for example) gcc to compile your program, use mpicc. Open MPI provides a wrapper compiler for four languages: Language Wrapper compiler name C mpicc C++ mpiCC, mpicxx, or mpic++ (note that mpiCC will not exist on case-insensitive filesystems) Fortran 77 mpif77 Fortran 90 mpif90 Hence, if you expect to compile your program as: shell$ gcc my_mpi_application.c -o my_mpi_application Simply use the following instead: shell$ mpicc my_mpi_application.c -o my_mpi_application Note that Open MPI’s wrapper compilers do not do any actual compiling or linking; all they do is manipulate the command line and add in all the relevant compiler / linker flags and then invoke the underlying compiler / linker (hence, the name “wrapper” compiler). More specifically, if you run into a compiler or linker error, check your source code and/or back-end compiler —