[R-SIG-Mac] Apple Clang does support OpenMP (if libomp is available)

Balamuta, James Joseph b@|@mut2 @end|ng |rom ||||no|@@edu
Thu Jun 6 16:11:15 CEST 2019


Greetings and Salutations Jon,

> Lack of OpenMP support in Apple’s build of Clang is cited as one reason for not using it in CRAN builds

From R 3.4.x forward, OpenMP has been enabled in CRAN builds as the toolchain is using a custom compiler.

You can see this with regard to the work done to enable OpenMP with RcppArmadillo with a configure script to detect the compiler:

https://github.com/RcppCore/RcppArmadillo/pull/170 
https://github.com/RcppCore/RcppArmadillo/pull/219 

> but this is only partly true: after installing libomp ***from Homebrew***, I have been adding

Unfortunately, both Xcode and Xcode CLI do not ship clang with support for OpenMP. By installing `libomp` from homebrew, the system is getting a clang-compliant OpenMP compiler from the llvm formula. To check, please see:

which clang

I wish it were the case though... 

Sincerely,

JJB

On 6/6/19, 5:43 AM, "R-SIG-Mac on behalf of Jon Clayden" <r-sig-mac-bounces using r-project.org on behalf of jon.clayden using gmail.com> wrote:

    Dear all,
    
    Lack of OpenMP support in Apple’s build of Clang is cited as one
    reason for not using it in CRAN builds, but this is only partly true:
    after installing libomp from Homebrew, I have been adding
    “-Wp,-fopenmp” to CXXFLAGS and CFLAGS (and “-lomp” to LIBS) to my
    builds for a while, and everything seems to work OK.
    
    I’m not sure how far back this support goes (and I haven’t tried the
    Xcode 11 tools yet), but is there any known reason not to take this
    approach, and if not, would it make sense for R’s configure script to
    try “-Wp,-fopenmp” when testing for OpenMP support?
    
    All the best,
    Jon
    
    _______________________________________________
    R-SIG-Mac mailing list
    R-SIG-Mac using r-project.org
    https://stat.ethz.ch/mailman/listinfo/r-sig-mac
    



More information about the R-SIG-Mac mailing list