Data.table: [Request] Test for compiler compatibility with `-fopenmp` before using `SHLIB_OPENMP_CFLAGS`

Created on 12 May 2017  ·  3Comments  ·  Source: Rdatatable/data.table

This will allow installation of data.table on systems / compilers that do not support openmp, even if the site Makeconf file defines SHLIB_OPENMP_CFLAGS. This is the case on macOS as of R 3.4.0 with the default clang compiler.

Something like the following should be sufficient, note that ifeq is a GNU make extension, so it will need to be noted in your DESCRIPTION

```shell
CXX11=$(shell "${R_HOME}"/bin/R CMD config CXX11)
ifeq ($(shell $(CXX11) -fopenmp -E -xc++ - 2>&1 >/dev/null && echo 'true'), true)
PKG_CFLAGS=$(SHLIB_OPENMP_CFLAGS)
PKG_LIBS=$(SHLIB_OPENMP_CFLAGS)
endif

openmp

Most helpful comment

Just a note that this still causes issues (e.g. this new one on R community), particularly after a new release when CRAN has not yet built a binary. Now that you are using a configure script (https://github.com/Rdatatable/data.table/pull/3951) it might be worth adding this test to the configure script so compilation will work with the native macOS toolchain (albeit without parallelization).

All 3 comments

This issue is currently blocking use of data.table on Mac with the devel version of R, which in turn blocks a number of other packages, and in turn, development and updating of packages:

> sessionInfo()
R Under development (unstable) (2017-05-26 r72742)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS Sierra 10.12.5

Matrix products: default
BLAS: /Library/Frameworks/R.framework/Versions/3.5/Resources/lib/libRblas.0.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.5/Resources/lib/libRlapack.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets 
[6] methods   base     

loaded via a namespace (and not attached):
[1] compiler_3.5.0 tools_3.5.0   

Just a note that this still causes issues (e.g. this new one on R community), particularly after a new release when CRAN has not yet built a binary. Now that you are using a configure script (https://github.com/Rdatatable/data.table/pull/3951) it might be worth adding this test to the configure script so compilation will work with the native macOS toolchain (albeit without parallelization).

@jimhester Thanks for the note. I thought it already worked with compilers without openmp, and that's checked in CRAN_Release.cmd here: https://github.com/Rdatatable/data.table/blob/b2d618ce291a50872e10fc1ca7137faa8484005a/.dev/CRAN_Release.cmd#L183. But clearly I am wrong and that isn't sufficient. I'll try and get my head around what you're saying and suggesting.

I get a bit frustrated with claims from users that data.table is blocking anything. It's MacOS that's the problem ... why doesn't it include openmp by default? It all works smoothly on Linux and Windows.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

tcederquist picture tcederquist  ·  3Comments

mattdowle picture mattdowle  ·  3Comments

alex46015 picture alex46015  ·  3Comments

MichaelChirico picture MichaelChirico  ·  3Comments

jameslamb picture jameslamb  ·  3Comments