# Compiling R with multi-threaded linear algebra libraries on Ubuntu

[This article was first published on

Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

**Pachá**, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

# Motivation

You may have an R setup that is not using hardware resources in an efficient way.

Linear algebra libraries such as OpenBLAS and Intel MKL can compute matrix/vector operations with all available processing power to significantly reduce computation times.

# Use apt-get instead of compiling sources

If you prefer to use `apt-get`

there is an option. Intel MKL is hardware specific while OpenBLAS boosts operations both for Intel and AMD

To install R linked to Intel MKL, Dirk Eddelbuettel’s blog provides detailed instructions.

To install R linked to OpenBLAS you only need this:

sudo apt-get update sudo apt-get install libopenblas-base r-base

# Compiling sources

I’ll stick to R 3.4.2 that is what I use at work.

## R linked to MKL

You need to install MKL first. You can either use `apt-get`

or download the installer. I have downloaded the installer.

### Install MKL

### Compile R

## R linked to OpenBLAS

### Compile R

To

**leave a comment**for the author, please follow the link and comment on their blog:**Pachá**.R-bloggers.com offers

**daily e-mail updates**about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.

Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.