[MacPorts] #61256: Multicore support for math/R
MacPorts
noreply at macports.org
Thu Oct 1 23:31:46 UTC 2020
#61256: Multicore support for math/R
--------------------------+----------------------
Reporter: webbp | Owner: kjellpk
Type: enhancement | Status: assigned
Priority: Normal | Milestone:
Component: ports | Version:
Resolution: | Keywords:
Port: R |
--------------------------+----------------------
Comment (by webbp):
{{{compiler.openmp_version 4.5}}} did not enable R to build packages with
OpenMP, e.g., with {{{compiler.openmp_version 4.5}}}:
{{{
clang: error: unknown argument: '-pipe -Os
-isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk -arch
x86_64'
*** OpenMP not supported! data.table uses OpenMP to automatically
*** parallelize operations like sorting, grouping, file reading, etc.
}}}
I've investigated the problem a bit more. The issue mostly or entirely
affects packages installed by R rather than the R binary itself, that is,
there are many R packages which benefit greatly from being built with
openmp, but the R binary may not. The above .R/Makevars cause R to build
packages with OpenMP in Mac OS 10.11, whereas these below work for 10.15.
(Those are the only two Mac OS versions I have readily available.)
{{{
CC=/opt/local/bin/clang -fopenmp
CXX=/opt/local/bin/clang++ -fopenmp
# -O3 should be faster than -O2 (default) level optimisation ..
CFLAGS=-isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -g
-O3 -Wall -pedantic -std=gnu99 -mtune=native -pipe
CCFLAGS=-isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk
CXXFLAGS=-isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -g
-O3 -Wall -pedantic -std=c++11 -mtune=native -pipe
LDFLAGS=-L/opt/local/lib -Wl,-rpath,/opt/local/lib
CPPFLAGS=-I/opt/local/include
}}}
Source: https://github.com/Rdatatable/data.table/wiki/Installation
Also, I believe that R uses the flags with which it was built as the
default flags for building packages, so specifying these flags the
Portfile should solve the problem. However, the specific flags that work
differ for different Mac OS versions, and they are also known to be
incompatible with some R packages. So maybe the best thing to do here is
just to add some lines to the Portfile long_description, e.g.: to install
multicore packages in R, do {{{sudo port install clang-10 pkgconfig &&
sudo port select clang mp-clang-10}}} and create ~/.R/Makevars as above.
--
Ticket URL: <https://trac.macports.org/ticket/61256#comment:8>
MacPorts <https://www.macports.org/>
Ports system for macOS
More information about the macports-tickets
mailing list