OpenMP Clang in Xcode

I’ve been playing around with prime numbers recently, which (naturally?) extended into an investigation into parallel programming. I installed the latest version of GCC 5 (v5.3.0 at the time of writing) using these instructions and got OpenMP running (support is built-in). I’m fine with using Terminal but I thought it would be interesting to try this in Xcode.

I installed the OpenMP C/C++ language extensions for Clang using homebrew with instructions from here. Unfortunately, I received the following error:

can't exec '/usr/local/bin/clang++-omp' (No such file or directory)

It turns out those instructions were missing a symlink that needs to be created. It’s as follows:

sudo ln -s /usr/local/bin/clang-omp++ /usr/local/bin/clang++-omp

Thanks to Stack Overflow for the “full” instructions. I can now build and run C++ parallelized code directly inside Xcode. I am finding a performance difference running the same code via the Terminal vs inside Xcode (which is slower). Hmm…