[This article was first published on R – Enchufa2, and kindly contributed to R-bloggers]. (You possibly can report subject in regards to the content material on this web page here)

Need to share your content material on R-bloggers? click here in case you have a weblog, or here in the event you do not.

In our last post, we introduced the FlexiBLAS library, coming to Fedora 33, and the accompanying flexiblas R bundle, which permits reside switching of the BLAS backend among the many numerous open supply choices available within the Fedora repositories.

On this put up, we show the way to set up, register with FlexiBLAS, and at last swap to Intel’s Math Kernel Library (MKL) in just a few steps. First, we put together a correct atmosphere utilizing docker:

$ docker run --rm -it fedora:33
$ dnf set up 'dnf-command(config-manager)' # set up config supervisor
$ dnf set up R-flexiblas # set up R and the FlexiBLAS API interface for R

Then we add Intel’s YUM repository, import the general public key and set up MKL:

$ dnf config-manager --add-repo https://yum.repos.intel.com/mkl/setup/intel-mkl.repo
$ rpm --import https://yum.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS-2019.PUB
$ dnf set up intel-mkl # or a selected model, e.g. intel-mkl-2020.0-088

Then, in an R session:


#> flexiblas BLAS /decide/intel/mkl/lib/intel64/libmkl_rt.so not present in config.
#>  BLAS /decide/intel/mkl/lib/intel64/libmkl_rt.so doesn't present an integer dimension trace. Assuming Four Byte.
#> [1] 2

backends  [1] "OPENBLAS-OPENMP"                        
#> [2] "/decide/intel/mkl/lib/intel64/libmkl_rt.so"

And that’s it: now, we’re capable of swap between the default one and MKL. As in our earlier put up, let’s examine them with a easy GEMM benchmark:

n                                    backend timing [s] efficiency [GFlops]
#> 2 /decide/intel/mkl/lib/intel64/libmkl_rt.so      3.487             4.588471
#> 1                         OPENBLAS-OPENMP      0.754            21.220159

And nonetheless OpenBLAS rocks!

For questions, recommendations or points associated to this R interface, please use its issue tracker or the R-SIG-Fedora mailing record. For extra normal points, please use Red Hat Bugzilla or the upstream issue tracker.

Article initially revealed in Enchufa2.es: Installing and switching to MKL on Fedora.

Source link