-
Notifications
You must be signed in to change notification settings - Fork 0
Extra Setup and Installation for Mac
If you have a Mac and want to take advantage of parallelization for fast run-times, then you'll likely have to take some extra steps if your default compiler (clang on Mac) does not have OpenMP support. If you're on a Windows or Linux machine, no need to read further--you're already benefitting from OpenMP parallelization.
First, we will need to install OpenMP libraries. This can be done by running the following command in the Mac terminal:
brew install libomp
The easiest way to get OpenMP support for looperr on a Mac
is to change the default R compiler to gcc from
clang. Before installing,
we remove gfortran (fortran compiler) because brew install gcc
will install
its own version
rm '/usr/local/bin/gfortran'
brew install gcc
We next create a Makevars file which sets the default C, C++, and Fortran
compilers that R will use when compiling packages. In this case, we are
setting the default compiler to gcc version 10. You can create this file "by hand"
in the ~/.R
directory but you might as well just create it in the terminal as follows:
mkdir ~/.R
touch ~/.R/Makevars
{
echo VER=-10
echo CC=gcc-10
echo CXX=g++-10
echo CXX11=g++-10
echo CXX14=g++-10
echo CXX17=g++-10
echo FC=/usr/bin/gfortran
echo F77=/usr/bin/gfortran
echo CFLAGS=-mtune=native -g -O2 -Wall -pedantic
echo CXXFLAGS=-mtune=native -g -O2 -Wall -pedantic
echo F77="gfortran-4.8"
echo FC="gfortran-4.8"
echo FLIBS = ""
} >~/.R/Makevars
You are then ready to install looperr! From the R console, type:
devtools::install_github("harveybarnhard/looperr")