Basics

Assuming you have the system software dependencies met, then in principle, installation can be as simple as:

install.packages("fmlr", repos=c("https://hpcran.org", "https://cran.rstudio.com"))

However, before you do, it is strongly advised that you read this document, because there are several important considerations when installing this package.

You may also find the container recipes for Docker and Singularity helpful.

System Dependencies

TLDR

  • R
  • Modern C and C++ compilers
  • Optionally, any of:
    • OpenBLAS (or MKL or whatever)
    • MPI and ScaLAPACK
    • CUDA

Long version

First, of course, you will need an installation of R.

Next, you will need to be able to build R packages from source, since we do not provide any binary packages for fmlr. Generally this requires:

  • Windows: Rtools
  • Mac:
    • Install XCode from the Mac App Store
    • Open XCode and choose “Preferences”, “Downloads”, then “Install Command Line Tools”
  • Linux/FreeBSD: You need C and C++ compilers, which you may well already have installed. Consult your distribution’s package manager.

It is recommended, but not required, that you use a high-performance BLAS library with R. For example, OpenBLAS. There are numerous resources for how to do this on the internet. Unfortunately, they can be somewhat involved for some platforms, so we do not repeat them here.

If you wish to use the MPI backend, you will need to have a system installation of MPI, e.g. OpenMPI, MPICH, or MSMPI. We recommend MSMPI for Windows and OpenMPI for everything else:

  • Windows: Install MS-MPI
  • Mac: Choose any one of the following
    • Homebrew: brew install open-mpi
    • MacPorts: port install openmpi
    • You can also build from source
  • Linux/FreeBSD
    • deb (Debian, Ubuntu): apt-get install libopenmpi-dev
    • rpm (Fedora, Centos): yum install openmpi-devel
    • FreeBSD: pkg install openmpi
    • You can also build from source.

If using the MPI backend, you may also wish to have a system installation of ScaLAPACK:

  • Windows: ScaLAPACK for Windows
  • Mac: Choose any one of the following
    • Homebrew: brew install scalapack
    • MacPorts: port install scalapack +openmpi
    • You can also build from source
  • Linux/FreeBSD
    • deb (Debian, Ubuntu): apt-get install libscalapack-openmpi-dev
    • rpm (Fedora, Centos): yum install scalapack-openmpi
    • FreeBSD: pkg install scalapack
    • You can also build from source.

If you have an appropriate GPU, you can also install NVIDIA® CUDA™.

R Dependencies

TLDR

CRAN Packages - R6 - float - Optionally: - pbdMPI and pbdSLAP - memuse

HPCRAN Packages - fmlh - Optionally: - merkhet

Long version

The R package dependencies should install automatically via R’s dependency resolution. However, there are some things that can go wrong.

With float, if you do not have a high-performance BLAS library installed (and you will want one, so if not, go back to the system dependencies section above), then the package will build the reference float (as in floating point) BLAS and LAPACK functions. These are slow, and take a long time to compile. When you build float from source, you can see in the configure log which BLAS/LAPACK library it is using. The float package vignette discusses this somewhat.

If you want to use the MPI backend, you will need to install both of the pbdMPI and pbdSLAP packages. Assuming you installed MPI correctly, the pbdMPI should install fine. If you have any issues, you may find the pbdMPI package vignette helpful.

For pbdSLAP, you will need a version that contains the float symbols. If you didn’t do a system installation of ScaLAPACK, then you need to run:

remotes::install_github("snoweye/pbdSLAP@single")

The advantage to this is that it’s easy. The disadvantage is that it takes forever to compile. So if you did create a system installation of ScaLAPACK, then you can do something like this:

install.packages("pbdSLAP", configure.vars="EXT_LDFLAGS='-lscalapack-openmpi'")

where you set the EXT_LDFLAGS appropriately. The example provided is for Ubuntu. Yours may look something like -L/path/to/scalapack -lscalapack. If you can’t figure this out, then use the option above installing from GitHub.

Installing fmlr

fmlr can be built with or without MPI support, and orthogonally with or without GPU support. Right now, “GPU” exclusively means CUDA.

If you build the package without MPI or GPU support, then the various MPI/GPU functions won’t work (obviously). You can test for backend support in the installed package via:

Default Installation

This will only make the CPU backend available.

Stable releases are published on the hpcran. You can install them via

install.packages("fmlr", repos=c("https://hpcran.org", "https://cran.rstudio.com"))

The development version of fmlr is maintained on GitHub. However, because we use git submodules, you can not use any of the various install_github() functions. You can install the package from the command line via:

GPU and MPI Support: Mac, Linux

You can install the stable version of fmlr with GPU support via:

install.packages("fmlr", configure.args="--enable-gpu", repos=c("https://hpcran.org", "https://cran.rstudio.com"))

To install the development version, you can do something like:

For MPI, you would do the same as the above, but set the configure args to “–enable-mpi”. For both GPU and MPI support, you would do the same as the above, but set the configure args to “–enable-gpu –enable-mpi”.

GPU and MPI Support: Windows

Warning: I have not successfully tested this, so this may or may not work. If you can help, please let me know here.

First, you will need CUDA and the Microsoft Visucal C++ compiler since CUDA only supports this compiler on Windows. Then you will need to set CXX14=cl.exe (set the path to cl.exe as necessary) in your ~/.R/Makevars.win file.

You will need to download the package source. You can get the stable version of fmlr from the hpcran.

You can get the development version from GitHub:

Once you download the package, you will need to modify the first few lines of the src/Makevars.win file. To enable GPU support, set USE_GPU = "TRUE", and modify CUDA_DIR as necessary. To enable MPI support, set USE_MPI = "TRUE".