This package implements a general framework for utilizing R to harness the power
of NVIDIA GPU's. The
gvector classes allow for easy management
of the separate device and host memory spaces. Numerous numerical operations are
implemented for these objects on the GPU. These operations include matrix
multiplication, addition, subtraction, the kronecker product, the outer product,
comparison operators, logical operators, trigonometric functions, indexing, sorting,
random number generation and many more.
To move an R object to the GPU use the
g function. To move the object back the the host use the
Standard operations such as matrix multiplication or addition may be performed on GPU objects as with any
vector object in R.
gvector classes contain a
type slot which determines if the data is stored as a
gvector objects store only a pointer to an object on the GPU device. Thus, a line such as
y<-x will duplicate the pointer but not the actual data on the GPU. One should use instead
Numerous random number generators such as
grnorm have been implemented in this package. This package is intended to work with the companion package
rcula which implements matrix factorization and inversions methods.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
#Look at available GPU devices (use setDevice to change the device) listDevices() #Creating GPU objects g_x=g(1:10) #transfer a sequence to the GPU g_y=gseq(1,10) #create a sequence on the GPU g_A=gmatrix(grnorm(100),10,10,dup=FALSE) #create a random 10x10 matrix #look at and change the properties of these objects type(g_x) type(g_A) type(g_x)="d" #'d' may be used as short form of"double" length(g_x) dim(g_A) nrow(g_A) #Perform some simple calculations g_ans=g_x %*% log(abs(g_A)) %*% sin(-g_y) g_rowsum= rowSums(g_A) #Move data back to the host h_ans=h(g_x) h_roswum =h(g_A)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.