The hardware and bandwidth for this mirror is donated by dogado GmbH, the Webhosting and Full Service-Cloud Provider. Check out our Wordpress Tutorial.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]dogado.de.
Provides functions to switch the BLAS/LAPACK optimized backend and change the number of threads without leaving the R session, which needs to be linked against the FlexiBLAS wrapper library.
See the installation section below for instructions on how to set a proper environment and install this package.
library(flexiblas)
# check whether FlexiBLAS is available
flexiblas_avail()
#> [1] TRUE
# get the current backend
flexiblas_current_backend()
#> [1] "OPENBLAS-OPENMP"
# list all available backends
flexiblas_list()
#> [1] "NETLIB" "__FALLBACK__" "BLIS-THREADS" "OPENBLAS-OPENMP"
#> [5] "BLIS-SERIAL" "ATLAS" "OPENBLAS-SERIAL" "OPENBLAS-THREADS"
#> [9] "BLIS-OPENMP"
# get/set the number of threads
flexiblas_set_num_threads(12)
flexiblas_get_num_threads()
#> [1] 12
Example of GEMM benchmark for all the backends available:
library(flexiblas)
<- 2000
n <- 10
runs <- "__FALLBACK__"
ignore
<- matrix(runif(n*n), nrow=n)
A <- matrix(runif(n*n), nrow=n)
B
# load backends
<- setdiff(flexiblas_list(), ignore)
backends <- flexiblas_load_backend(backends)
idx
# benchmark
<- sapply(idx, function(i) {
timings flexiblas_switch(i)
# warm-up
<- A[1:100, 1:100] %*% B[1:100, 1:100]
C
unname(system.time({
for (j in seq_len(runs))
<- A %*% B
C 3])
})[
})
<- data.frame(
results backend = backends,
`timing [s]` = timings,
`performance [GFlops]` = (2 * (n / 1000)^3) / timings,
check.names = FALSE)
order(results$performance),]
results[#> backend timing [s] performance [GFlops]
#> 1 NETLIB 56.776 0.2818092
#> 5 ATLAS 5.988 2.6720107
#> 2 BLIS-THREADS 3.442 4.6484602
#> 8 BLIS-OPENMP 3.408 4.6948357
#> 4 BLIS-SERIAL 3.395 4.7128130
#> 6 OPENBLAS-SERIAL 3.206 4.9906425
#> 7 OPENBLAS-THREADS 0.773 20.6985770
#> 3 OPENBLAS-OPENMP 0.761 21.0249671
Fedora 33+ ships R linked against FlexiBLAS. You can install multiple
backends (atlas
, blis-[serial|openmp|threads]
,
openblas-[serial|openmp|threads]
) as well as compile
third-party libraries (such as MKL), and switch between them without
leaving your R session using this package. If you are not running Fedora
>= 33, you can set up a proper environment using docker.
$ docker run --rm -it fedora:rawhide
The following command installs R and all the optimized BLAS/LAPACK
backends shipped in Fedora (use sudo
if appropriate):
$ dnf install R flexiblas-*
Within the environment above, it can be installed from the official repos:
$ dnf install R-flexiblas
or install the release version from CRAN:
install.packages("flexiblas")
The installation from GitHub requires the remotes package.
# install.packages("remotes")
::install_github("Enchufa2/r-flexiblas") remotes
These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.
Health stats visible at Monitor.