Find, Install, or Uninstall OpenMP
openmp.Rd
Set of functions that seek to identify whether OpenMP was installed, allow OpenMP to be installed, and removing OpenMP.
Details
The openmp_*()
suite of functions attempts to locate, install, and uninstall
the OpenMP runtime library based on the installed Xcode version. These functions
mirror the logic described on the macOS R Project OpenMP page
and should be used by advanced users who wish to compile R packages
that use OpenMP for parallel processing. They are not required for most users.
OpenMP runtime is downloaded from the R-project repository for macOS and installed to:
Library:
/usr/local/lib/libomp.dylib
Headers:
/usr/local/include/omp.h
;/usr/local/include/ompt.h
;/usr/local/include/omp-tools.h
; and,/usr/local/include/ompx.h
(added in LLVM 19.1.0).
Note: Apple has explicitly disabled OpenMP support in Xcode compilers, but the
runtime library can be installed separately and used with -Xclang -fopenmp
compiler flags.
Check if OpenMP
is installed
Checks the local file system for whether OpenMP runtime library is installed
in the default installation location. Specifically, it checks for the
libomp.dylib
library file and the omp.h
header file, e.g:
Installing OpenMP
The openmp_install()
function aims to install the appropriate OpenMP
runtime library based on the detected Xcode version.
OpenMP Installation Process
The installation process automatically detects your Xcode version and downloads the corresponding OpenMP runtime from the R-project repository:
Uninstalling OpenMP
The openmp_uninstall()
attempts to remove OpenMP from the default
installation locations.
We use the R sanitized shell command to remove the installed files:
sudo rm -f /usr/local/lib/libomp.dylib
sudo rm -f /usr/local/include/omp.h
sudo rm -f /usr/local/include/ompt.h
sudo rm -f /usr/local/include/omp-tools.h
sudo rm -f /usr/local/include/ompx.h
Note: ompx.h
was included in LLVM 19.1.0 and
may not exist in older OpenMP versions.