profileCUDA: Profiling functions for CUDA calls

Description Usage Arguments Value Author(s) References See Also Examples

Description

These functions allow us to profile CUDA interactions and calls. We can profile an entire sequence of one or more R calls. Alternatively, we can use more fine-grained control over what we profile by first creating a profiler and then starting and stopping it as we want. We can read the profiling results with readCUDAProfile although profileCUDA returns them for us.

There are two possible formats for the profiling result file. One is a CSV. The other is a name=value format.

We can specify what to profile via a configuration file.

Usage

1
2
3
4
5
6
7
profileCUDA(expr, file = tempfile(), ...)
cudaProfiler(file = tempfile(),
             config = getOption("CUDAProfilerConfig",
                                system.file('prof.config', package = 'RCUDA')),
               format = "csv", start = TRUE)
cudaStartProfiler()
cudaStopProfiler()

Arguments

expr

the R expression or set of expressions to profile as a single block

file

the name of the file to which to write the profiling results. This defaults to a temporary file.

...

additional arguments passed to cudaProfiler. This includes the configuration file.

config

the name of a configuration file identifying what counters to store, i.e. the names of the columns of the data frame and what the profiler will record for each routine.

format

the format of the data the profiler will output. This is either CSV or key=value pairs. One can specify this with either of the cudaCSV or cudaKeyValuePair constants, or use a string that identifies "CSV" or "KeyValue". Any string that uniquely matches the name of either constant, using lower case matching will work.

start

a logical value that controls whether we also start the profiler immedialtey after creating it (TRUE) or not.

Value

profileCUDA returns a data frame.

Author(s)

Duncan Temple Lang

References

http://docs.nvidia.com/cuda/profiler-users-guide/index.html

A sample configuration file is available at https://svn.ece.lsu.edu/svn/gp/cuda/matrix-mult/.cuda-profile-config

See Also

.cuda

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
if(getNumDevices() > 0) {

 createContext()

 info = profileCUDA( {
     ptx = system.file("sampleKernels", "dnormOutput.ptx", package = "RCUDA")
     m = loadModule(ptx)
     kernel = m$dnorm_kernel

     N = 1e6L
     x = rnorm(N)

     ans = .cuda(kernel, x, N, .5, 1.5, numeric(N),
                  gridDim = c(64L, 32L), blockDim = 512L, outputs = "out")
   })

  info
}

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