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.
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:
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:
brew install open-mpi
port install openmpi
apt-get install libopenmpi-dev
yum install openmpi-devel
pkg install openmpi
If using the MPI backend, you may also wish to have a system installation of ScaLAPACK:
brew install scalapack
port install scalapack +openmpi
apt-get install libscalapack-openmpi-dev
yum install scalapack-openmpi
pkg install scalapack
If you have an appropriate GPU, you can also install NVIDIA® CUDA™.
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.
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:
fmlr::fml_cpu()
- is the CPU backend available? Always returns TRUE
.fmlr::fml_gpu()
- is the GPU backend available?fmlr::fml_mpi()
- is the MPI backend available?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:
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:
git clone --recurse-submodules https://github.com/fml-fam/fmlr.git
R CMD INSTALL fmlr/ --configure-args="--enable-gpu"
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”.
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"
.