Openmpi For Mac
Using the following command: CC=icc CFLAGS='-O3 -xcore-avx2 -ip -mp1 -m64 -shared-intel' CXX=icpc CXXFLAGS='-O3 -xcore-avx2 -ip -mp1 -m64.
I've been looking for MPI for OS X and some websites say that it is already installed in OS X (since 10.5). Could someone point out where is it installed? I cannot find mpicc nor mpirun. Alpine Testing aarch64 Official openmpi-4.0.5-r0.apk: Message passing library for high-performance computing: Alpine Testing armhf Official openmpi-4.0.5-r0.apk: Message passing library for high-performance computing.
I’ve been taking the course Parallel Computing this semester, and I’m also participating in some student cluster competitions. Therefore, I wanted to configure OpenMP and MPI on my Mac to run some OpenMP and MPI programs. This post describes how I successfully configured OpenMP and MPI with Homebrew.
Pre-requisite
Make sure you have Homebrew installed on your Mac. Homebrew is a package manager for macOS. It is in some way similar to package managers in Linux distributions, such as apt-get
and yum
. It’s very easy to install, just go to their website and follow the steps.
Remember to run brew update
before you continue.
Installing OpenMP
One thing you should know is that OpenMP is not really a package that you install on your computer. Instead, it’s part of the compiler. Therefore, what we need to do is to compile a compiler with OpenMP support. We’ll use Homebrew to build the GNU Compiler Collection (GCC) on our Mac from source, with OpenMP support. To do that, type in the following command
If you have installed gcc
before on your Mac using Homebrew, then reinstall it with the following command
According to my experience, it takes about half an hour to one hour to build gcc
since it’s quite a large piece of program. Just be patient. After you installed it, you should be able to compile programs with OpenMP support with
Installing MPI
MPI is only an interface. Therefore, there are several MPI implementations, such as MPICH, OpenMPI, and Intel MPI. In this post, we’ll install OpenMPI. Here we also want to build it from source because then our MPI compiler is using the gcc
we built just now with OpenMP support. If you installed the binary distribution, it’s compiled with clang
without any OpenMP support. To build OpenMPI, type in the following command
Openmpi Macports
This command forces Homebrew to build OpenMPI from source with the gcc-6
compiler. (On Mac, the brewed gcc
has the name gcc-6
to avoid name clash with the system link gcc
that is in your Mac)
Now you should have OpenMPI installed on your Mac, with OpenMP support! To compile any MPI programs, just type