README.md

RCUDA

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.

Prerequisities

Installing package

To install RCUDA, user needs to speficy the path for both R and CUDA includes and library.

  1. R_HOME specifies the R root path, for example 'R_HOME = /usr/bin/R'

  2. R_INC specifies the R include path, for example 'R_INC := /usr/share/R/include'

  3. R_LIB specifies the R library path, for example 'R_LIB := /usr/lib/'

  4. CUDA_HOME specifies the CUDA root path, for example 'CUDA_HOME := /usr/local/cuda-7.5'

  5. CUDA_INC specifies the CUDA include path, for example 'CUDA_INC := $(CUDA_HOME)/include'

  6. CUDA_LIB specifies the CUDA library path, for example 'CUDA_LIB := $(CUDA_HOME)/lib64' (depends on your system structure 32-bit or 64-bit)

Running the tests

Sample code

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

Available functions

BLAS implementation progress

Level 1

CUBLAS functions:

Level 2

Key: ge: general gb: general banded sy: symmetric sb: symmetric banded sp: symmetric packed tr: triangular tb: triangular banded tp: triangular packed he: hermitian hb: hermitian banded * hp: hermitian packed

CUBLAS functions:

Level 3

CUBLAS functions:

BLAS-like extensions

Random number generators

High level statistical functions

Authors

License

This project is licensed under the MIT License - see the LICENSE.md file for details



yuanli22/RCUDA documentation built on May 4, 2019, 6:35 p.m.