This is an R GPU computing package via NVIDIA CUDA framework. It consists of wrappers of cuBLAS cuRAND libraries and self-defined CUDA functions. By defining gpu objective in R environment, we want to provide a high performance GPU solution to linear algebra and random number generators. Our package enables users to keep as much work on the GPU side as possible and avoid unnecessary data transfer between CPU and GPU.
R version over 3.2.0 available at https://www.r-project.org/
NVIDIA GPU with computing capacity over 2.0 (you can check your hardware spec at https://en.wikipedia.org/wiki/Nvidia_Tesla)
CUDA toolkit version over 7.5 available at (https://developer.nvidia.com/cuda-downloads)
LINUX system with GNU Compiler Collection GCC version over 4.8.4 available at https://gcc.gnu.org/
RCUDA is currently LINUX-only package
To install RCUDA, user needs to speficy the path for both R and CUDA includes and library.
R_HOME specifies the R root path, for example 'R_HOME = /usr/bin/R'
R_INC specifies the R include path, for example 'R_INC := /usr/share/R/include'
R_LIB specifies the R library path, for example 'R_LIB := /usr/lib/'
CUDA_HOME specifies the CUDA root path, for example 'CUDA_HOME := /usr/local/cuda-7.5'
CUDA_INC specifies the CUDA include path, for example 'CUDA_INC := $(CUDA_HOME)/include'
CUDA_LIB specifies the CUDA library path, for example 'CUDA_LIB := $(CUDA_HOME)/lib64' (depends on your system structure 32-bit or 64-bit)
Build the package in linux by command 'R CMD build RCUDA' to get the file RCUDA_1.0.tar.gz
In R, compile your package by command 'install.packages("yourpath/RCUDA_1.0.tar.gz", repos = NULL)'
In R, load the library by command 'library(RCUDA)'
In R, run the test file (located at the 'tests' folder) by command 'source("yourpath/srcs/test.R")'
Suppose we already installed and loaded the library in R, here is a sample code to perform GPU object creating and matrix-vector multiplication.
creategpu(1:4, 2, 2) -> A ##create a 2 by 2 matrix in GPU and assign it to object A ##function creategpu second and third input is the row and column numbers of matrix creategpu(1:2) -> b ##create a vector in GPU and assign it to object b ##without dimension specification, creategpu defautly assumes ##vector with length equals to number of input elements mvgpu(A, b) -> c ##compute the result A*b and store the result in GPU object c. ##Here mvgpu is the matrix-vector multiplication function in RCUDA gathergpu(c) -> result ##transfer the outcome from c (GPU object) to result (CPU object) ##which can be applied to native R function later
gb: general banded
sb: symmetric banded
sp: symmetric packed
tb: triangular banded
tp: triangular packed
hb: hermitian banded
hp: hermitian packed
This project is licensed under the MIT License - see the LICENSE.md file for details
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.