Skip to content

Instantly share code, notes, and snippets.

@qingl97
Last active August 29, 2015 14:13
Show Gist options
  • Save qingl97/52881fac3dc8e6e287a9 to your computer and use it in GitHub Desktop.
Save qingl97/52881fac3dc8e6e287a9 to your computer and use it in GitHub Desktop.
Build program using both MPI and openMP

First install openMPI on your target system.

As openMPI suggests strongly to use its wrapper compilers(GCC version 4.2, can be checked by ompi_info | grep 'C compiler' command), the wrapper compiler doesn't support openMP. OpenMP_3.1 version is supported since gcc_4.7. The wrapper compiler is just out of date to support openMP. The solution is to change the default wrapper compiler to another compiler that supports openMP.

On Linux, use export OMPI_CC=gcc to change the wrapper compiler to the gcc compiler on your local linux system.

On Mac OSX(10.9.5), the default compiler is Apple LLVM version 6.0(x86_64-apple-darwin13.4.0), which doesn't support openMP by default. One solution is to use the Intel C/C++ compiler as the openMPI wrapper compiler. Use export OMPI_CC=icc to change it.

Ref:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment