Summary

knitr::opts_chunk$set(fig.pos = 'H')

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.

Statement of Need

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.

Introduction

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:

  1. Everything is done within the R language;
  2. The procedure (use of functions) will be the same for any Linux distribution;
  3. The OpenBLAS library will be compiled and you will choose which build version to bind to R, regardless of your Linux distribution;
  4. The package allows you to install R $\geq 3.1.0$, also allowing you to install one more version, in addition to allowing you to easily switch between those versions;
  5. The linked versions of R will continue to be recognized by their Integrated Development Environment - IDE and nothing will have to be adjusted in your GNU/Linux distribution after using any function of the package;
  6. Unnecessary builds will be avoided. Therefore, if you need to switch between compiled versions of the R language, the use of binaries compiled in previous times will be suggested;
  7. If any errors occur, the functions of the package will not damage the previous installation of the language;
  8. If something better can be done or if a newer version of what you want to install (R or OpenBLAS) exists, the functions will automatically suggest that you consider installing newer versions.

Brief explanation

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.

'last_version_r' function

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.

'last_version_openblas' function

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.

'rcompiler' function

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)

'ropenblas' function

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:

'link_again' function

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()

'rnews function'

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.

References



de-ufpb/ropenblas documentation built on Dec. 21, 2020, 7:10 a.m.