Speedup R by using OpenBlas

I had to analyse a big dataset (>12GB). Although I have enough memory, it needs a lot of time so I looked for some optimisations - with success.

OpenBlas is a optimised blas library, which can be used in R. This will speedup the execution time in many cases and it's quite easy to install - So I would recommend it in many cases. First install openBlas:

sudo apt-get install libopenblas-base

Then it normally works directly, but you can check it easily. Open another terminal and start an interactive R process (just run R). Then search for the process using ps aux | grep R. The result should look like this:

We have a match! As you can see the first result is a R-process. So take its process id (in this case 6839) and call:

lsof -p <process_id> | grep blas

The result will look like this:

If you take a look at the second match, you will see that this process uses already the new openblas lib :)