RcppBlaze-package: RcppBlaze - 'Rcpp' Integration for the 'Blaze'...

RcppBlaze-packageR Documentation

RcppBlaze - 'Rcpp' Integration for the 'Blaze' High-Performance 'C++' Math Library

Description

RcppBlaze constructs a bridge between R and Blaze.

Details

Blaze is an open-source, high-performance C++ math library for dense and sparse arithmetic. With its state-of-the-art Smart Expression Template implementation Blaze combines the elegance and ease of use of a domain-specific language with HPC-grade performance, making it one of the most intuitive and fastest C++ math libraries available. The RcppBlaze package includes the header files from the Blaze library with disabling some functionalities related to link to the thread and system libraries which make RcppBlaze be a header-only library. Therefore, users do not need to install Blaze.

Using RcppBlaze

To use RcppBlaze in your package, there are some important steps:

  1. Include the ‘⁠RcppBlaze.h⁠’ header file, which also includes ‘⁠blaze/Blaze.h⁠’.

  2. Import Rcpp, LinkingTo Rcpp and RcppBlaze by adding these lines to the ‘⁠DESCRIPTION⁠’ file:

      Imports: Rcpp (>= 1.0.0)
      LinkingTo: Rcpp, RcppBlaze
    
  3. Link against the BLAS and LAPACK libraries, by adding following two lines in the ‘⁠Makevars⁠’ and ‘⁠Makevars.win⁠’ files:

      PKG_CXXFLAGS=$(SHLIB_OPENMP_CXXFLAGS)
      PKG_LIBS = $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS) $(SHLIB_OPENMP_CXXFLAGS)
    
  4. Since there are conflicted definitions between R and blaze which is TRUE and FALSE. You have to write the initializing function for C/C++ code which the function is named after R_init_YourPackageName You can refer to our another package, https://github.com/ChingChuan-Chen/RcppLbfgsBlaze for example.

Notes

  1. If you would like to enable Boost threads support, you need to import BH package in your DESCRIPTION.

  2. CompressedVector and CompressedMatrix only support int, float and double types.

Author(s)

For RcppBlaze: Ching-Chuan Chen Maintainer: Ching-Chuan Chen <zw12356@gmail.com> For blaze: Klaus Iglberger, Georg Hager, Christian Godenschwager, Tobias Scharpff

References

  1. Blaze project: https://bitbucket.org/blaze-lib/blaze.

  2. K. Iglberger, G. Hager, J. Treibig, and U. Ruede: Expression Templates Revisited: A Performance Analysis of Current Methodologies. SIAM Journal on Scientific Computing, 34(2): C42–C69, 2012, \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1137/110830125")}.

  3. K. Iglberger, G. Hager, J. Treibig, and U. Ruede, High Performance Smart Expression Template Math Libraries. Proceedings of the 2nd International Workshop on New Algorithms and Programming Models for the Manycore Era (APMM 2012) at HPCS 2012, \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1109/HPCSim.2012.6266939")}.

See Also

Useful links:


RcppBlaze documentation built on May 29, 2024, 4:04 a.m.