launchKernel: Cuda class method: launchKernel

Description Arguments Examples

Description

Launch a loaded kernel with provided arguments.

Arguments

grid

Three member list giving x, y, and z dimensions (in blocks) of grid. The list members do not need to be named, but must be in x, y, z order.

block

Three member list giving x, y, and z dimensions (in threads) of each block. The list members do not need to be named, but must be in x, y, z order.

args

List of numerics and XPtrs to device memory (as returned by h2dVector & h2dMatrix). Type and order of arguments must match kernel signature, and there is no checking that this is the case. Incorrect argument specification may either result in memory faults or, worse, silent but unforeseen behavior.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
## Not run: 
cu <- new(Cuda)

# create data matrix and load on device
x <- cu$h2dMatrix(matrix(rnorm(20), nrow=5, ncol=4));

# create a matrix to hold results and load on device
y <- cu$h2dMatrix(matrix(0, nrow=5, ncol=4));

# load and launch kernel
k <- system.file("extdata", "stride.cu", package="cudalite")
cu$loadKernel(k)
cu$launchKernel(list(1,1,1), list(3,2,1), list(5, 4, x, y))

#retrieve results
res <- cu$d2hMatrix(y)

## End(Not run)

erikor/cudalite documentation built on May 31, 2019, 8:07 a.m.