Type: Package
Title: Download, Compile and Link 'OpenBLAS' Library with R
Version: 0.4.0
Maintainer: Pedro Rafael D. Marinho <pedro.rafael.marinho@gmail.com>
Description: The 'ropenblas' package (https://prdm0.github.io/ropenblas/) is useful for users of any 'GNU/Linux' distribution. It will be possible to download, compile and link the 'OpenBLAS' library (https://www.openblas.net/) with the R language, always by the same procedure, regardless of the 'GNU/Linux' distribution used. With the 'ropenblas' package it is possible to download, compile and link the latest version of the 'OpenBLAS' library even the repositories of the 'GNU/Linux' distribution used do not include the latest versions of 'OpenBLAS'. If of interest, older versions of the 'OpenBLAS' library may be considered. Linking R with an optimized version of 'BLAS' (https://netlib.org/blas/) may improve the computational performance of R code. The 'OpenBLAS' library is an optimized implementation of 'BLAS' that can be easily linked to R with the 'ropenblas' package.
Depends: R (≥ 3.1.0)
License: GPL-3
URL: https://prdm0.github.io/ropenblas/, https://github.com/prdm0/ropenblas
BugReports: https://github.com/prdm0/ropenblas/issues
SystemRequirements: GNU Make, GCC Compiler Suite (C and Fortran)
Encoding: UTF-8
Imports: glue, stringr, magrittr, git2r, pingr, cli, getPass, rvest, withr, rlang, stats, utils, fs
RoxygenNote: 7.3.2
NeedsCompilation: no
Packaged: 2025-06-28 12:14:39 UTC; prdm0
Author: Pedro Rafael D. Marinho ORCID iD [aut, cre], Enes Ahmeti [ctb]
Repository: CRAN
Date/Publication: 2025-06-28 12:30:02 UTC

OpenBLAS library versions

Description

OpenBLAS library versions

Usage

last_version_openblas()

Details

This function automatically searches OpenBLAS library versions in the official GitHub project.

  1. last_version: Returns the latest stable version of the OpenBLAS library.

  2. versions: All stable versions of the OpenBLAS library.

  3. n: Total number of versions.

See Also

last_version_r, ropenblas, rcompiler

Examples

# last_version_openblas()

R language versions

Description

R language versions

Usage

last_version_r()

See Also

ropenblas, rcompiler

Examples

# last_version_r()

Description

The link_again function relinks the OpenBLAS library with the R language, which is useful for correcting unlinking problems that are common when the operating system is updated.

Usage

link_again(restart_r = TRUE)

Arguments

restart_r

If TRUE (default), a new R session is started after linking the OpenBLAS library.

Details

The link_again function can relink the R language with the OpenBLAS library. Thus, link_again will only perform the relinking when the ropenblas function has been used in a previous R session for the initial binding of the R language with the OpenBLAS library.

Relinking is useful in situations of operating system updates. In some updates, it is possible that the OpenBLAS library compiled in the /opt directory gets unlinked. In this scenario, when the OpenBLAS library has already been compiled using the ropenblas function, the link_again function performs a new link without the need to recompile, thus making the process less time consuming.

Note

In situations where there was a disconnection due to an operating system update, the ropenblas function can be used to re-link the OpenBLAS library with the R language, however, it will be necessary to compile the OpenBLAS library again. If you are interested in recompiling the OpenBLAS library and linking with R, use the ropenblas function. If the interest is to take advantage of a previous compilation of the OpenBLAS library, the link_again function may be useful.

See Also

ropenblas

Examples

# link_again()

Compile a version of R on GNU/Linux systems

Description

This function is responsible for compiling a version of the R language.

Usage

rcompiler(x = NULL)

Arguments

x

Version of R you want to compile. By default (x = NULL) the latest stable version of the R language will be compiled. For example, x = "4.5.0" will compile and link R-4.5.0 as the major version on your system.

Details

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.5.1" will compile and link the R-4.5.1 version as the major version on your system. By default (x = NULL), the latest stable version of R will be compiled.

For example, to compile the latest stable version of the R language, do:

 rcompiler()

Regardless of your GNU/Linux distribution and what version of R is in your repositories, you can have the latest stable version of the R language compiled into your computer's architecture.

You can use the rcompiler() function to compile different versions of R. For example, running rcompiler(x = "3.6.3") and rcompiler() will install versions 3.6.3 and 4.0.0 on your GNU/Linux distribution, respectively. If you are on version 4.0.0 of R and run the code rcompiler(x = "3.6.3") again, the function will identify the existence of version 3.6.3 on the system and give you the option to use the binaries that were built in a previous compilation. This avoids unnecessary compilations.

Value

Returns a message informing you if the procedure occurred correctly. You will also be able to receive information about missing dependencies.

See Also

ropenblas, last_version_r

Examples

# rcompiler()

R News file

Description

Returns the contents of the NEWS.html file in the standard browser installed on the operating system.

Usage

rnews(pdf = FALSE, dev = FALSE)

Arguments

pdf

If FALSE (default), the NEWS.html file will open in the browser, otherwise NEWS.pdf will be opened.

dev

If FALSE (default), it will not show changes made to the language development version. To see changes in the development version, do dev = TRUE.

Details

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. The rnews function is analogous to the news function of the utils package. However, using the news command in a terminal style bash shell, it is possible to receive a message like:

news()
starting httpd help server ... done
Error in browseURL(url) : 'browser' must be a non-empty character string

This is an error that may occur depending on the installation of R. Always prefer the use of the news function, but if you need to, use the rnews function.


Download, Compile and Link OpenBLAS Library with R

Description

Links R with an optimized version of the BLAS library (OpenBLAS).

Usage

ropenblas(x = NULL, restart_r = TRUE)

Arguments

x

OpenBLAS library version to be considered. By default, x = NULL.

restart_r

If TRUE, a new R session is started after compiling and linking the OpenBLAS library.

Details

The ropenblas() function will only work on Linux systems. When calling the ropenblas() function on Windows, no settings will be made. Only a warning message will be issued informing you that the configuration can only be performed on Linux systems.

The function will automatically download the latest version of the OpenBLAS library. However, it is possible to inform old versions to the single argument of ropenblas(). The ropenblas() function downloads, compiles and links R to use the OpenBLAS library. Everything is done very simply, just by loading the library and invoking the function ropenblas().

Considering using the OpenBLAS library rather than BLAS may bring extra optimizations for your code and improved computational performance for your simulations, since OpenBLAS is an optimized implementation of the BLAS library.

You must install the following dependencies on your operating system (Linux):

  1. GNU Make;

  2. GNU GCC Compiler (C and Fortran).

Your Linux operating system may already be configured to use the OpenBLAS library. Therefore, R will most likely already be linked to this library. To find out if R is using the OpenBLAS library, in R, do:

extSoftVersion()["BLAS"]

If R is using the OpenBLAS library, something like /any_directory/libopenblas.so should be returned. Therefore, the name 'openblas' should be in the returned shared object (file with a .so extension).

If the ropenblas() function can identify that R is using the version of OpenBLAS you wish to configure, a warning message will be returned asking if you would really like to proceed with the configuration again.

The ropenblas() function will download the desired version of the OpenBLAS library, compile and install it in the /opt directory of your operating system. If the directory does not exist, it will be created so that the installation can be completed. Subsequently, files from the version of BLAS used in R will be symbolically linked to the shared object files of the OpenBLAS library version compiled and installed in /opt.

You must be the operating system administrator to use this library. Therefore, do not attempt to use it without telling your system administrator. If you have the ROOT password, you will be responsible for everything you do on your operating system. Other details can also be found here.

Value

Returns a message informing you if the procedure occurred correctly. You will also be able to receive information about missing dependencies.

Note

You do not have to use the ropenblas() function in every R session. Once the function is used, R will always consider using the OpenBLAS library in future sessions.

Author(s)

Pedro Rafael D. Marinho (e-mail: pedro.rafael.marinho@gmail.com)

See Also

rcompiler, last_version_r

Examples

# ropenblas()