Array stored on GPU
gpuArray
converts
an array in the MATLAB workspace into a gpuArray with elements stored
on the GPU device.
Also, the following create gpuArrays:
|
|
|
|
|
|
| gpuArray. colon |
| gpuArray. freqspace |
| gpuArray. linspace |
| gpuArray. logspace |
gpuArray. speye |
For class specific help on the three methods with the gpuArray
prefix,
type
help gpuArray.methodname
where methodname
is the name of the
method. For example, to get help on colon
, type
help gpuArray.colon
The following methods control the random number stream on the GPU:
parallel.gpu.RandStream |
parallel.gpu.rng |
A gpuArray
object represents an array stored
on the GPU. You can use the array for direct calculations, or in CUDA
kernels that execute on the GPU. You can return the array to the MATLAB
workspace with the gather
function.
arrayfun | Apply function to each element of array on GPU |
bsxfun | Binary singleton expansion function for gpuArray |
classUnderlying | Class of elements within gpuArray or distributed array |
existsOnGPU | Determine if gpuArray or CUDAKernel is available on GPU |
eye | Identity matrix |
false | Array of logical 0 (false) |
gather | Transfer distributed array or gpuArray to local workspace |
Inf | Array of infinity |
NaN | Array of Not-a-Numbers |
ones | Array of ones |
pagefun | Apply function to each page of array on GPU |
rand | Array of rand values |
randi | Array of random integers |
randn | Array of randn values |
true | Array of logical 1 (true) |
zeros | Array of zeros |
Other overloaded methods for a gpuArray object are too numerous to list here. Most resemble and behave the same as built-in MATLAB functions. See Run Built-In Functions on a GPU .
Among the gpuArray methods there are several for examining the characteristics of a gpuArray object. Most behave like the MATLAB functions of the same name:
Function | Description |
---|---|
| Class (data type) of the elements in the array |
existsOnGPU | Indication if array exists on the GPU and is accessible |
isreal | Indication if array elements are real |
length | Length of vector or largest array dimension |
ndims | Number of dimensions in the array |
size | Size of array dimensions |