Installation Details - jsilve24/fido GitHub Wiki

We are still just learning best practices for installing fido on various systems. If you encounter an error not discussed below please open a new issue (listing your OS, c++ compiler versions). User feedback is very helpful for us in improving fido.

There are four levels of installation depending on how much work users want to put into accelerating fido. Levels 2-4 can be done in any order as long as they precede level 1.

Level 1: Minimal Work

Install Fido via devtools, with minimal forethought.

devtools::install_github("jsilve24/fido")

Or to download the development version

devtools::install_github("jsilve24/fido", ref="develop")

Platform-Specific Notes

  • Mac OS X: if you haven't before, you need to install XCode Command Line Tools. You may also have to modify your ~.R/Makevars file as described Here
  • Windows: Should work well without any specific prep
  • Linux: Should work well without any prep.

Compiler Requirements

Still working these out, we have figured out that gcc 4.9.3 seems to have trouble (things compile but you don't get the right answer... which is obviously bad). Up to date clang on OS X or gcc >= 6.1.0 seem to work without difficulties.

Building Vignettes

Vignettes are prebuilt on the fido webpage. If you want vignettes to build locally during package installation you must also pass the build=TRUE and build_opts = c("--no-resave-data", "--no-manual") options to install_github.

Level 2: Enable Compiler Vectorization

Prior to installation (e.g., before running 'Level 1' above), we recommend you edit the default compiler options (on Unix systems located at ~/.R/Makevars) to include the following line

CXXFLAGS = -O3 -march=native
CXX11FLAGS= -O3 -march=native

this will enable full compiler optimization and vectorization.

This could also be done with the following code run directly in an R console:

dotR <- file.path(Sys.getenv("HOME"), ".R")
if (!file.exists(dotR)) dir.create(dotR)
M <- file.path(dotR, ifelse(.Platform$OS.type == "windows", "Makevars.win", "Makevars"))
if (!file.exists(M)) file.create(M)
cat("\nCXXFLAGS=-O3 -march=native", 
      "CXX11FLAGS=-O3 -march=native",
      file = M, sep = "\n", append = TRUE)

Level 3: Enable OpenMP Parallelization (Mac OS X Only)

Recent versions of OS X ship with C/C++ compilers missing OpenMP support. One path for enabling OpenMP on Mac OS X

  1. Install the Homebrew package manager: https://brew.sh/

  2. Install libomp and the latest version of llvm (which includes the clang compiler) via:

brew install libomp
brew install llvm
  1. Update the C/C++ compiler paths in your ~/.R/Makevars to point to the newly installed C/C++ compilers:
CC=/usr/local/opt/llvm/bin/clang-8
CXX=/usr/local/opt/llvm/bin/clang++
CXX11=/usr/local/opt/llvm/bin/clang++

Note: The locations of these symlinks and the version of clang installed by vary. Check that these paths are reflected in your installed configuration.

Level 4: Enable Intel MKL

For those looking for extreme speed (without sacrificing accuracy), we have enabled the Eigen MKL linkages in the code via the compiler flag -DFIDO_USE_MKL. Moreover, this flag even enables some hand-coded calls to MKL routines that really give the code a boost.

Currently, this option is for advanced users only. It requires you to download the package source, modify the file src/Makevars.in with the path to MKL, and the compile. In case it helps, the src/Makevars.in file has a commented out version of how the file looks on my machine with MKL set up.