nvcc: Compile CUDA code

Description Usage Arguments Value Author(s) References Examples

Description

This is a utility function to help users compile CUDA source code using the nvcc compiler. As such, it is just a front-end to calling nvcc.

nvccCmd is the fully-qualified name of the CUDA compiler command.

Usage

1
2
nvcc(file, out = swapExtension(file, target),
     target = "ptx", ..., .opts = list(...), .run = TRUE)

Arguments

file

the name of the file to compile

out

the name of the output file. If this is missing, file is used with a different extension, taken from the target.

target

a string giving the name of the target format, one of ptx, cubin or fatbin.

...

individual arguments to be passed to the nvcc compiler. These should be name = value pairs or if for flags that take no arguments, just the string.

.opts

an alternative way to specify arguments to nvcc as a single R object.

.run

a logical value that if FALSE causes the function to return the command but not run the call to nvcc.

Value

If .run is TRUE, a character vector with the output from invoking the nvcc compiler. If there is an error, the character vector contains the output from nvcc.

If .run is FALSE, a character vector with one element which is the command to run.

Author(s)

Duncan Temple Lang

References

NVIDIA CUDA SDK documentation.

Examples

1
2
3
4
5
6
f = system.file("sampleKernels", "dnormOutput.ptx", package = "RCUDA")
nvcc(f, .run = FALSE)
nvcc(f, target = "fatbin", .run = FALSE)
nvcc(f, target = "cubin", .run = FALSE)
nvcc(f, "-use_fast_math", .run = FALSE)
nvcc(f, gencode = "arch=compute_10,code=sm_10", .run = FALSE)

duncantl/RCUDA documentation built on May 15, 2019, 5:26 p.m.