Skip to Main Content Skip to Search
Product Documentation

GPUArray - Array of data stored on GPU

Constructor

gpuArray converts an array in the MATLAB workspace into a GPUArray with data stored on the GPU device.

Also, the following static methods create GPUArray data:

parallel.gpu.GPUArray.colonparallel.gpu.GPUArray.ones
parallel.gpu.GPUArray.eyeparallel.gpu.GPUArray.rand
parallel.gpu.GPUArray.falseparallel.gpu.GPUArray.randi
parallel.gpu.GPUArray.infparallel.gpu.GPUArray.randn
parallel.gpu.GPUArray.linspaceparallel.gpu.GPUArray.true
parallel.gpu.GPUArray.logspaceparallel.gpu.GPUArray.zeros
parallel.gpu.GPUArray.nan 

You can get help on any of these methods with the command

help parallel.gpu.GPUArray.methodname

where methodname is the name of the method. For example, to get help on rand, type

help parallel.gpu.GPUArray.rand

The following methods control the random number stream on the GPU:

parallel.gpu.RandStream
parallel.gpu.rng

Description

A GPUArray object represents an array of data stored on the GPU. You can use the data for direct calculations, or in CUDA kernels that execute on the GPU. You can return data to the MATLAB workspace with the gather function.

Methods

arrayfunApply function to each element of array on GPU
bsxfunBinary singleton expansion function for GPUArray
existsOnGPUDetermine if GPUArray or CUDAKernel is available on GPU

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 Using GPUArray. For the complete list of those supported, use the methods function on the GPUArray class:

 methods('parallel.gpu.GPUArray')

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:

FunctionDescription
classUnderlyingClass of the underlying data in the array
existsOnGPUIndication if array exists on the GPU and is accessible
isrealIndication if array data is real
lengthLength of vector or largest array dimension
ndimsNumber of dimensions in the array
sizeSize of array dimensions

See Also

CUDAKernel, GPUDevice

  


Free Parallel Computing Interactive Kit

See how to solve large problems with minimal effort and reduce simulation time.

Get free kit

Trials Available

Try the latest versions of parallel computing products.

Get trial software
 © 1984-2012- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS