Title: | Download, Compile and Link 'OpenBLAS' Library with R |
---|---|
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. |
Authors: | Pedro Rafael D. Marinho [aut, cre] , Enes Ahmeti [ctb] |
Maintainer: | Pedro Rafael D. Marinho <[email protected]> |
License: | GPL-3 |
Version: | 0.3.0 |
Built: | 2024-11-16 03:49:29 UTC |
Source: | https://github.com/prdm0/ropenblas |
OpenBLAS library versions
last_version_openblas()
last_version_openblas()
This function automatically searches OpenBLAS library versions in the official GitHub project.
last_version
: Returns the latest stable version of the OpenBLAS library.
versions
: All stable versions of the OpenBLAS library.
n
: Total number of versions.
last_version_r
, ropenblas
, rcompiler
# last_version_openblas()
# last_version_openblas()
R language versions
last_version_r(major = NULL)
last_version_r(major = NULL)
major |
Major release number of R language (e.g. |
This function automatically searches R language versions in the official language repositories. That way,
doing last_version_r(major = NULL)
you will always be well informed about which latest stable version the
R language is in. You can also set the higher version and do a search on the versions of the R language whose major
version was 1L
or 2L
, for example.
A list of two named elements will be returned. Are they:
last_version
: Returns the latest stable version of the language given a major version (major version).
If major = NULL
, the latest stable version of the language will be returned based on the set of all language versions.
versions
: Character vector with all language versions based on a major version (higher version).
If major = NULL
, versions
will be a vector with the latest language versions.
n
: Total number of versions of R based on major version. If major = NULL
, versions
will be a vector with the latest language versions.
# last_version_r(major = NULL)
# last_version_r(major = NULL)
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.
link_again(restart_r = TRUE)
link_again(restart_r = TRUE)
restart_r |
If |
The function link_again
be able to link again the R language with the OpenBLAS library. Thus, link_again will only make the
relinkagem when in some previous section of R the ropenblas function has been used for the initial binding of the R language with the
OpenBLAS library.
Relinking is useful in situations of updating the operating system. In some update, it is possible that the OpenBLAS library compiled
in the /opt
directory is 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.
In situations where there was a disconnection due to an update of the operating system, 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
function link_again
may be useful.
# link_again()
# link_again()
This function is responsible for compiling a version of the R language.
rcompiler(x = NULL, with_blas = NULL, complementary_flags = NULL)
rcompiler(x = NULL, with_blas = NULL, complementary_flags = NULL)
x |
Version of R you want to compile. By default ( |
with_blas |
String, |
complementary_flags |
String, |
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.0"
will compile and link R-4.0.0 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, 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 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 its GNU/Linux distribution,
respectively. If you are in 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 in the system and give you the option to use the binaries
that were built in a previous compilation. This avoids unnecessarys compilations.
In addition to the x
argument, the rcompiler()
function has two other arguments that will allow you to change and pass new compilation flags. Are they:
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. If with_blas = NULL
(default), then it will be considered:
./configure --prefix=/opt/R/version_r --enable-memory-profiling --enable-R-shlib --enable-threads=posix --with-blas="-L/opt/OpenBLAS/lib -I/opt/OpenBLAS/include -lpthread -lm"
Most likely, you will have little reason to change this aprgument. Unless you know what you're doing, consider with_blas = NULL
. Do not change the installation directory,
that is, always consider --prefix = /opt/R/version_r
, where version_r
is a valid version of R. For a list of valid versions of
R, run the last_version_r()
. Installing R in the /opt/R/version_r
directory is important because some
functions in the package require this. Both the R language and the OpenBLAS library will be installed in the /opt
directory.
If this directory does not exist in your GNU/Linux distribution, it will be created;
complementary_flags
: String (complementary_flags = NULL
by default) for adding complementary flags in the R language compilation process.
Passing a string to complementary_flags
will compile it in the form:
./configure --with-blas="..." complementary_flags
Returns a warning message informing you if the procedure occurred correctly. You will also be able to receive information about missing dependencies.
# rcompiler()
# rcompiler()
Returns the contents of the NEWS.html file in the standard browser installed on the operating system.
rnews(pdf = FALSE, dev = FALSE)
rnews(pdf = FALSE, dev = FALSE)
pdf |
If |
dev |
If |
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 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.
Link R with an optimized version of the BLAS library (OpenBLAS).
ropenblas(x = NULL, restart_r = TRUE)
ropenblas(x = NULL, restart_r = TRUE)
x |
OpenBLAS library version to be considered. By default, |
restart_r |
If |
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 olds versions to the single argument of ropenblas()
. The ropenblas()
function downloads,
compiles and link R to use of the OpenBLAS library. Everything is done very simply, just loading the library and
invok the function ropenblas()
.
Considering using the OpenBLAS library rather than the BLAS may bring extra optimizations for your code and improved computational performance for your simulations, since OpenBLAS is an optimized implementation of the library BLAS.
You must install the following dependencies on your operating system (Linux):
GNU Make;
GNU GCC Compiler (C and Fortran).
Your linux operating system may already be configured to use the OpenBLAS library. Therefore, most likely R will already be linked to this library. To find out if the R language is using the OpenBLAS library, at R, do:
extSoftVersion()["BLAS"]
If R is using the OpenBLAS library, something like /any_directory/libopenblas.so
should be returned. Therefore, there should be the name openblas in the shared object returned (file extension .so).
If the ropenblas()
function can identify that the R language is using the version of OpenBLAS you wish to configure, a warning message will be returned asking if you really would like to proceed with the
configuration again.
The ropenblas()
function will download the desired version of the library OpenBLAS, compile and install the library in the /opt
directory of your operational 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 library version OpenBLAS 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 you may also find here.
Returns a warning message informing you if the procedure occurred correctly. You will also be able to receive information about missing dependencies.
You do not have to in every section of R make use of the ropenblas()
function. Once the function is used, R
will always consider using the OpenBLAS library in future sections.
Pedro Rafael D. Marinho (e-mail: [email protected])
# ropenblas()
# ropenblas()