GPU Computing

Transfer data between MATLAB® and a graphics processing unit (GPU); run code on a GPU

You can use your computer's GPU for matrix operations. In many cases, execution on a GPU is faster than on the CPU, so the techniques described here might offer improved performance. For information about supported features and performance for GPU computing in Parallel Computing Toolbox™, see GPU Capabilities and Performance .


gpuArray Create array on GPU
gather Transfer distributed array or gpuArray to local workspace
existsOnGPU Determine if gpuArray or CUDAKernel is available on GPU
gpuDevice Query or select GPU device
gpuDeviceCount Number of GPU devices present
gputimeit Time required to run function on GPU
reset Reset GPU device and clear its memory
wait (GPUDevice) Wait for GPU calculation to complete
arrayfun Apply function to each element of array on GPU
bsxfun Binary singleton expansion function for gpuArray
pagefun Apply function to each page of array on GPU
parallel.gpu.CUDAKernel Create GPU CUDA kernel object from PTX and CU code
feval Evaluate kernel on GPU
setConstantMemory Set some constant memory on GPU

C Functions

mxInitGPU Initialize MATLAB GPU library on currently selected device
mxGPUCopyFromMxArray Copy mxArray to mxGPUArray
mxGPUCopyGPUArray Duplicate (deep copy) mxGPUArray object
mxGPUCopyImag Copy imaginary part of mxGPUArray
mxGPUCopyReal Copy real part of mxGPUArray
mxGPUCreateComplexGPUArray Create complex GPU array from two real gpuArrays
mxGPUCreateFromMxArray Create read-only mxGPUArray object from input mxArray
mxGPUCreateGPUArray Create mxGPUArray object, allocating memory on GPU
mxGPUCreateMxArrayOnCPU Create mxArray for returning CPU data to MATLAB with data from GPU
mxGPUCreateMxArrayOnGPU Create mxArray for returning GPU data to MATLAB
mxGPUDestroyGPUArray Delete mxGPUArray object
mxGPUGetClassID mxClassID associated with data on GPU
mxGPUGetComplexity Complexity of data on GPU
mxGPUGetData Raw pointer to underlying data
mxGPUGetDataReadOnly Read-only raw pointer to underlying data
mxGPUGetDimensions mxGPUArray dimensions
mxGPUGetNumberOfDimensions Size of dimension array for mxGPUArray
mxGPUGetNumberOfElements Number of elements on GPU for array
mxGPUIsSame Determine if two mxGPUArrays refer to same GPU data
mxGPUIsSparse Determine if mxGPUArray contains sparse GPU data
mxGPUIsValidGPUData Determine if mxArray is pointer to valid GPU data
mxIsGPUArray Determine if mxArray contains GPU data


gpuArray Array stored on GPU
GPUDevice Graphics processing unit (GPU)
CUDAKernel Kernel executable on GPU

C Classes

mxGPUArray Type for MATLAB gpuArray

Related Information

Was this topic helpful?