FastR with Intel MKL

Follow the instructions here => Quick Linking MKL to R.

Note: If you are building from the source and want to use 3rd party tools such as RStudio, pay attention to point #1.

  1. Use the --enable-R-shlib option when configuring.
  2. The offline Intel MKL installer will try to install a bunch more packages by default. You just need to install the MKL library. Everything else is truely optional.
  3. The location of the libmkl_rt.so is not the same as indicated in the link above. In my case, I used find to locate the library.
  4. Just don’t make install. After the make command, your R is fully functional.
  5. Check that your R.HOME_DIR variable in R/bin/R is correctly set.
  6. The MKL related environment variables need to be set every time you run R. Add the following lines to your ~/.bashrc file.
# Intel MKL oneAPI MKL
source /opt/intel/oneapi/mkl/latest/env/vars.sh
export MKL_INTERFACE_LAYER=GNU,LP64
export MKL_THREADING_LAYER=GNU

To see whether this makes any difference, try benchmarking it (R-benchmark-25). On my old 4th gen intel Core i7 laptop, MKL scored 4.8 secs while the default library scored 38 secs.

There has been a time when Intel intentionally crippled code generation on AMD processors. But I believe it is not the case now. At least it is not as obvious as it used to be, so if you have an AMD processor, feel free to upgrade as well.

Just a friendly reminder:

Each day, 80k acres of forests are disappearing ...

So think about that when you try to print something next time.
      
        - - -
        -        -  -     --    -
     -                 -         -  -
                     -
                    -                --
    -          -            -              -
    -            '-,        -               -
    -              'b      *
     -              '$    #-                --
    -    -           $:   #:               -
  --      -  --      *#  @):        -   - -
               -     :@,@):   ,-**:'   -
   -      -,         :@@*: --**'      -   -
            '#o-    -:(@'-@*"'  -
    -  -       'bq,--:,@@*'   ,*      -  -
               ,p$q8,:@)'  -p*'      -
        -     '  - '@@Pp@@*'    -  -
         -  - --    Y7'.'     -  -
                   :@):.
                  .:@:'.
                .::(@:.      -Sam Blumenstein-