title: 'ropenblas: Download, Compile and Link OpenBLAS Library with R' tags: - R - Compiling R and OpenBLAS - Link OpenBLAS - Switch between versions of R - Fast algebraic computing authors: - name: Pedro Rafael Diniz Marinho orcid: 0000-0003-1591-8300 affiliation: 1 affiliations: - name: Department of Statistics, Federal University of Paraíba, João Pessoa, Paraíba - PB, Brazil index: 1 citation_author: Marinho date: "2020-10-02" year: "2020" bibliography: paper.bib output: rticles::joss_article header-includes: - \usepackage{float} csl: apa.csl journal: JOSS
The ropenblas
package aims to facilitate the daily life of R programmers on GNU/Linux systems without removing the possibility of specifying configurations that they deem convenient. Through the ropenblas()
and rcompiler()
functions, the package user will be able to compile and link the R language in his GNU/Linux distribution and link it to the OpenBLAS library, all within R and in a very simple way. All functions work without being influenced by the GNU/Linux distribution and its repositories, that is, it doesn't matter which GNU/Linux distribution is being used. Linking to the OpenBLAS library to R will bring a better computational performance of the language in the most diverse algebraic operations that are commonly used in areas such as statistics, data science and machine learning.
The ropenblas
package aims to allow algebraic computing of R to be performed using the OpenBLAS library, that is, it allows easy linking of R to the OpenBLAS library on GNU/Linux systems without depending on the distribution repositories. This will allow several researches in the areas of statistics, data science and machine learning to take advantage of a more efficient performance in algebraic calculations, for example, multiplication, factorization and matrix inversion. The ropenblas
library, version 0.2.8 will also allow the R programmer to have, in his GNU/Linux distribution, several compiled versions of the R language giving the possibility to easily switch between these versions, this being an Open Source functionality that is only possible in some commercial IDEs of R. All this is done within the R language, minimizing the chance of less experienced users to break their operating system by running several instructions that are not perfectly understood.
The fact that the ropenblas
package does not depend on the repositories of the GNU/Linux distribution will allow that in more stable distributions the R programmer will have at his disposal the most recent version of the OpenBLAS libraries and the R language. Everything is done in a safe way, a since the ropenblas
package uses the stable versions of the official development repositories of the OpenBLAS library and the R programming language, respectively. Until the present version, the package has more than 6600 downloads, having an average of more than 820 downloads in the month prior to the date of this submission, based on the official R language repositories.
The term "computational efficiency" is very common for those who program statistical methods, in which a large part of them involve algebraic operations that are often reproduced in computationally intensive simulations, such as Monte-Carlo simulations - MC and resampling methods, as is the case with bootstrap resampling. Statistics is just one example within so many other areas that need performance and uses the R language.
In addition to the adoption of good programming practices and the maximum, efficient and adequate use of available computational resources, such as code parallelization, through multicore parallelism procedures allowed by most current processors and operating systems, small adjustments and linkage of libraries can provide useful benefits.
The ropenblas
package aims to provide useful and simple experiences to R [@R] programmers who develop their activities on GNU/Linux operating systems, these many developers around the world producing codes of great impact for the community. These experiences consist of being able to link any version of the OpenBLAS [@openblas] library to the R language, as well as allowing the programmer to install and link various versions of R and make them available on his operating system as well as switch between these versions as they see fit.
Linking the R language to the OpenBLAS library can bring several benefits to algebraic computing in R. OpenBLAS is an Open-Source implementation of the Basic Linear Algebra Subprograms - BLAS library that is often the first library option for algebraic computing to be linked in the installation of R on many GNU/Linux distributions. The OpenBLAS library is available at https://github.com/xianyi/OpenBLAS and adds optimized implementations of linear algebra kernels that can run optimized on various processor architectures. OpenBLAS is based on the GotoBLAS2 project code in version 1.13 [@gotoblas2], code available under the terms of the BSD license.
The ropenblas
is a package designed to facilitate the linking of the library OpenBLAS with the language R. The package, which works only for Linux systems, will automatically download the latest source code from the OpenBLAS library and compile the code. The package will automatically bind the language R, through the ropenblas()
function, to use the OpenBLAS library. Everything will be done automatically regardless of the Linux distribution you are using. Enumerating some advantages of the package:
The ropenblas
package can be installed in two ways. The first is using the install.packages()
function of the utils
package which is available in any basic language installation and the second is using the devtools
package which will allow the package to be installed directly from the development directory on GitHub.
The ropenblas
library exports six functions for use which are the rcompiler()
, ropenblas()
, last_version_r()
, last_version_openblas()
, link_again()
and rnews()
. All of them are very simple to use and have few arguments that are sufficient to maintain flexibility of use. Any example that follows will consider that the installation of the ropenblas
package has been carried out and the package has been loaded (library(ropenblas)
). In addition, functions like rcompiler()
and ropenblas()
do not return content or data structures that are of any practical use. What these functions do is configure the GNU/Linux system to use R, configure different versions of the language, switch between versions and link with the OpenBLAS library. It is also possible to obtain a summary of the versions of R and the OpenBLAS library that are available.
The function last_version_r()
automatically searches, in the official repositories of language R, for information about versions of language R. Its general use is last_version_r(major = NULL)
, where the argument major
indicates which is the largest version of R that you want to search for the version list. Therefore, for the argument major
a number must be passed, preferably an integer that indicates which is the largest version to be considered.
The last_version_openblas()
function works similarly to the last_version_r()
function, returning a list of three elements named in the same way with the information from the latest version, all the versions and the number of versions of the OpenBLAS library, respectively.
This function is responsible for compiling a version of the R language. The x argument is the version of R that you want to compile. For example, x = "4.0.2"
will compile and link R-4.0.2 version as the major version on your system. By default (x = NULL
) will be compiled the latest stable version of the R. For example, to compile the latest stable version of the R language, run rcompiler()
. The rcompiler()
function can only be used if the user is an administrator of the GNU/Linux distribution. If the user is using programming IDE's, a screen similar to the image below will be displayed requesting the entry of the system administrator password.
> rcompiler(x = NULL, with_blas = NULL, complementary_flags = NULL)
x
: String with a valid R language version. A list valid of the latest language versions can be obtained using the last_version_r()
function. You can move to `x
any of the returned versions. This is the best way to choose a valid argument for x
. By default, x = NULL
is equivalent to pass last_version_r()$last_version
, that is, it will be considered the last stable version of the R language;with_blas
: This argument sets the --with-blas
flag in the R language compilation process and must be passed as a string. Details on the use of this flag can be found here;complementary_flags
: String with complementary flags to be used in the R language compilation process.The ropenblas()
function, a function of the same name in the package, links the main version of the R language installed on your operating system with the OpenBLAS library. As in the rcompiler()
function, the ropenblas()
function requires the operating system administration password, that is, it must be executed by the system administrator.
> ropenblas(x = NULL, restart_r = TRUE)
The ropenblas()
function is made up of two arguments. Are they:
x
: String with the version of the OpenBLAS library to be compiled, installed and linked with the main R installation (by default it is considered the latest version);restart_r
: Logical value (default restart_r = TRUE
) to update the R section after compiling, installing and linking the OpenBLAS library.The link_again()
function links again the OpenBLAS library with the R language, being useful to correct problems of untying the OpenBLAS library that is common when the operating system is updated.
The function be able to link again the R language with the OpenBLAS library.
> link_again()
The rnews()
function returns the contents of the NEWS.html
file in the standard browser installed on the operating system. The NEWS.html
file contains the main changes from the recently released versions of the R language. The goal is to facilitate the query by invoking it directly from the R command prompt.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.