Description Usage Arguments Value Author(s) References See Also Examples
These functions load a module and allow us to get a reference to any of the named functions/routines or global variables it contains.
1 2 3 4 5 6 7 8 9 10 | loadModule(filename, ctx = cuGetContext(TRUE),
isCode = is(filename, "raw") ||
is(filename, "AsIs") ||
grepl(" __cudaparm", filename),
...)
getFunction(module, name)
## S4 method for signature 'CUmodule'
x$name
## S4 method for signature 'CUmodule,character,missing'
x[[i,j, globalVar = FALSE, ...]]
|
filename |
the name of the file containing the GPU module. This can be in PTX, cubin or fatbin format. It is important that the code be compiled correctly for the appropriate architecture/GPU device. If not, an error is raised. |
ctx |
the context into which to load the module. If none has been created, this creates default contet that is used for this and subsequent computations. |
isCode |
a logical value that indicates whether |
... |
additional parameters for methods |
module,x |
the module object returned by |
name,i |
the name of the function to find in the module.
It is imperative that the kernel we want be compiled with the
declaration |
j |
missing/not supplied |
globalVar |
a logical that controls whether we are looking for a variable or a routine/function in the module. |
loadModule
returns an reference to the C object
and is of class CUmodule
in R.
getFunction
, if it succeeds, returns an object of class
CUfunction
and is a reference to the C data type representing
this routine.
Duncan Temple Lang
1 2 3 4 5 6 | if(getNumDevices() > 0) {
ctx = cuGetContext(TRUE)
ptx = system.file("sampleKernels", "dnormOutput.ptx", package = "RCUDA")
m = loadModule(ptx)
kernel = m$dnorm_kernel
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.