Apple has explicitly disabled OpenMP support in compilers that they ship in Xcode:
$ clang -c omp.c -fopenmp
clang: error: unsupported option '-fopenmp'
even though clang
had OpenMP support for quite a long time now. In fact, the clang
compiler in Xcode can generate all the necessary code for OpenMP. It can be tricked into performing its designed function by using -Xclang -fopenmp
flags.
The unfortunate part about this is that Apple is not shipping the necessary libomp.dylib
run-time library needed for OpenMP support. Fortunately, some clever folks made them available for us: see <https://mac.r-project.org/openmp/.