This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

Supported Functions

You can generate CUDA® code for a subset of MATLAB® built-in functions and toolbox functions that you call from MATLAB code. These functions appear in alphabetical order in the following table. Some of these functions especially from the Image Processing Toolbox™ contain calls to other functions, GPU Coder™ does not create CUDA kernels for all the loops and functions that the parent function relies on. However, GPU Coder does generate C/C++ code for sections that cannot be mapped to the GPU. The results from the code generated for functions in this list are also numerically equivalent (within tolerance) to its MATLAB counterpart. See, Numerical Differences Between CPU and GPU.

To find partially supported functions, see Partially Supported Functions.

Name

Product

Usage Notes and Limitations

abs

MATLAB

 

accumneg

Fixed-Point Designer™

 

accumpos

Fixed-Point Designer

 

acos

MATLAB

 

acosd

MATLAB

 

acosh

MATLAB

 

acot

MATLAB

 

acotd

MATLAB

 

activations

Deep Learning Toolbox™

  • The input X must not have a variable size. The size must be fixed at code generation time.

  • The layer argument must be constant.

  • Only the 'OutputAs' name-value pair argument is supported. The value must be 'channels'.

affine2d

Image Processing Toolbox

 

alexnet

Deep Learning Toolbox

For code generation, you can load the network by using the syntax net = alexnet or by passing the alexnet function to coder.loadDeepLearningNetwork. For example: net = coder.loadDeepLearningNetwork('alexnet')

and

MATLAB

 

angle

MATLAB

 

asin

MATLAB

 

asind

MATLAB

 

asinh

MATLAB

 

atan

MATLAB

 

atan2

MATLAB

 

atan2d

MATLAB

 

atand

MATLAB

 

atanh

MATLAB

 

bin2dec

MATLAB

 
bitand

MATLAB

 
bitcmp

MATLAB

 
bitget

MATLAB

 
bitor

MATLAB

 
bitrevorder

Signal Processing Toolbox™

 
bitset

MATLAB

 
bitshift

MATLAB

 
bitsll

Fixed-Point Designer

 
bitsra

Fixed-Point Designer

 
bitsrl

Fixed-Point Designer

 
bitxor

MATLAB

 
blkdiag

MATLAB

 
bsxfun

MATLAB

 

bwareaopen

Image Processing Toolbox

 

bwboundaries

Image Processing Toolbox

 

bwconncomp

Image Processing Toolbox

 

bwdist

Image Processing Toolbox

 

bweuler

Image Processing Toolbox

 

bwlabel

Image Processing Toolbox

 

bwlookup

Image Processing Toolbox

 

bwmorph

Image Processing Toolbox

 

bwperim

Image Processing Toolbox

 

bwselect

Image Processing Toolbox

 

bwtraceboundary

Image Processing Toolbox

 

bwunpack

Image Processing Toolbox

 

cart2pol

MATLAB

 

cast

MATLAB

 

ceil

MATLAB

 

chol

MATLAB

 

classUnderlying

MATLAB

 

compan

MATLAB

 

complex

MATLAB

 

conj

MATLAB

 

conndef

Image Processing Toolbox

 

conv

MATLAB

 

conv2

MATLAB

 

cos

MATLAB

 

cosh

MATLAB

 

cot

MATLAB

 

coth

MATLAB

 

cross

MATLAB

 

csc

MATLAB

 

csch

MATLAB

 

ctranspose

MATLAB

 

cwt

Wavelet Toolbox™

  • Timetable input signal is not supported.

  • All inputs must be constant and specified at compilation time.

  • Only analytic Morse ('morse') and Morlet ('amor') wavelets are supported.

  • The following input arguments are not supported: Sampling period (ts), PeriodLimits name-value pair, NumOctave name-value pair, and FilterBank name-value pair.

  • Scaling coefficient output and filter bank output are not supported.

  • Plotting is not supported.

cummax

MATLAB

 

cummin

MATLAB

 

cumprod

MATLAB

 

cumsum

MATLAB

 

DAGNetwork

Deep Learning Toolbox

deg2rad

MATLAB

 

del2

MATLAB

 

demosaic

Image Processing Toolbox  

det

MATLAB

 

diag

MATLAB

 

double

MATLAB

 

edge

Image Processing Toolbox  

exp

MATLAB

 

eye

MATLAB

 

factorial

MATLAB

 

fft

MATLAB

 

fft2

MATLAB

 

fftn

MATLAB

 

fitgeotrans

Image Processing Toolbox

 

fix

MATLAB

 

floor

MATLAB

 

fspecial

Image Processing Toolbox

 

gather

MATLAB

 

ge

MATLAB

 

getrangefromclass

Image Processing Toolbox  

googlenet

Deep Learning Toolbox

For code generation, you can load the network by using the syntax net = googlenet or by passing the googlenet function to coder.loadDeepLearningNetwork. For example: net = coder.loadDeepLearningNetwork('googlenet')

gt

MATLAB

 

hough

Image Processing Toolbox

 

houghlines

Image Processing Toolbox

 

houghpeaks

Image Processing Toolbox

 

hsv2rgb

MATLAB

 

hypot

MATLAB

 

im2double

MATLAB

 

im2int16

Image Processing Toolbox

 

im2single

Image Processing Toolbox

 

im2uint8

Image Processing Toolbox

 

imabsdiff

Image Processing Toolbox

 

imadjust

Image Processing Toolbox

 

imag

MATLAB

 

imboxfilt

Image Processing Toolbox

 

imcomplement

Image Processing Toolbox

 

imcrop

Image Processing Toolbox

 

imdilate

Image Processing Toolbox

  • The input image, IM, must be 2-D or 3-D.

  • Packed binary input image (PACKOPT syntax) is not supported.

  • For 3-D input images with more than three channels, only C/C++ code is generated.

  • CUDA code is generated only for 1-D or 2-D structuring elements. If the structuring element is 3-D, C/C++ code is generated. Code generation is not supported for structuring elements with more than three dimensions.

  • For non-flat structuring elements, only C/C++ code is generated.

imerode

Image Processing Toolbox

imfilter

Image Processing Toolbox

With CUDA toolkit v9.0, a bug in the NVIDIA® optimization causes numerical mismatch between the results from the generated code and MATLAB. As a workaround, turn off the optimization by passing the following flags to the configuration object (cfg) before generating the code.

cfg.GpuConfig.CompilerFlags = ‘-Xptxas -O0’

NVIDIA is expected to fix this bug in CUDA toolkit v9.1.

imgaussfilt

Image Processing Toolbox

 

imgradient3

Image Processing Toolbox

 

imgradientxyz

Image Processing Toolbox

 

imhist

Image Processing Toolbox

 

imhmax

Image Processing Toolbox

 

immse

Image Processing Toolbox

 

imopen

Image Processing Toolbox

 

imoverlay

Image Processing Toolbox

 

impyramid

Image Processing Toolbox

 

imquantize

Image Processing Toolbox

 

imread

Image Processing Toolbox

 

imresize

Image Processing Toolbox

  • 'Colormap' and 'Dither' Name-Value pair arguments are not supported.

  • Indexed image is not supported.

  • Custom interpolation kernel is not supported.

  • For certain interpolation kernels, there may be a small numerical mismatch between the results in MATLAB and the generated code.

imtophat

Image Processing Toolbox

 

imwarp

Image Processing Toolbox

  • The geometric transformation object input, tform, must be either an affine2d or projective2d object and must be constants.

  • The spatial referencing information output, RB, is not supported.

int8, int16, int32, int64

MATLAB

 

integralBoxFilter

Image Processing Toolbox

 

intlut

Image Processing Toolbox

 

isaUnderlying

MATLAB

 

isequal

MATLAB

 

isfloat

MATLAB

 

isinteger

MATLAB

 

islogical

MATLAB

 

ismatrix

MATLAB

 

isnumeric

MATLAB

 

isreal

MATLAB

 

isrow

MATLAB

 

issparse

MATLAB

 

issymmetric

MATLAB

 

istril

MATLAB

 

istriu

MATLAB

 

isvector

MATLAB

 

kron

MATLAB

 

lab2rgb

Image Processing Toolbox

 

label2idx

Image Processing Toolbox

 

ldivide

MATLAB

 

le

MATLAB

 

length

MATLAB

 

linsolve

MATLAB

 

log

MATLAB

 

log10

MATLAB

 

log1p

MATLAB

 

logical

MATLAB

 

lt

MATLAB

 

lu

MATLAB

 

matchFeatures

Computer Vision Toolbox™

CUDA code is generated only for the exhaustive matching method. If the Approximate method is selected, GPU Coder issues a warning and generates C/C++ code for this function.

mean

MATLAB

 

mean2

Image Processing Toolbox  

meshgrid

MATLAB

 

minus

MATLAB

 

mldivide

MATLAB

 

mpower

MATLAB

 

mrdivide

MATLAB

 

mtimes

MATLAB

 

multithresh

Image Processing Toolbox  

NaN or nan

MATLAB

 

ne

MATLAB

 

nextpow2

MATLAB

 

nnz

MATLAB

 

numel

MATLAB

 

ones

MATLAB

 

ordfilt2

Image Processing Toolbox

  • GPU code generation requires the inputs to be bounded. If the input is of variable dimension, the software generates C code.

  • The generated GPU code is not optimized if the domain value that defines the neighborhood for the filtering operation is of size greater than 11x11.

    For better performance, consider setting the StackLimitPerThread option in the gpuConfig object to Inf.

otsuthresh

Image Processing Toolbox  

padarray

Image Processing Toolbox

 
pdist Statistics and Machine Learning Toolbox™

  • The supported distance input argument values (Distance) for optimized CUDA code are 'euclidean', 'squaredeuclidean', 'seuclidean', 'cityblock', 'minkowski', 'chebychev', 'cosine', 'correlation', 'hamming', and 'jaccard'.

  • Distance cannot be a custom distance function.

  • Distance must be a compile-time constant.

pdist2 Statistics and Machine Learning Toolbox

  • The supported distance input argument values (Distance) for optimized CUDA code are 'euclidean', 'squaredeuclidean', 'seuclidean', 'cityblock', 'minkowski', 'chebychev', 'cosine', 'correlation', 'hamming', and 'jaccard'.

  • Distance cannot be a custom distance function.

  • Distance must be a compile-time constant.

  • Names in name-value pair arguments must be compile-time constants.

  • The sorted order of tied distances in the generated code can be different from the order in MATLAB due to numerical precision.

plus

MATLAB

 

pol2cart

MATLAB

 

polyint

MATLAB

 

pow2

Fixed-Point Designer

 

power

MATLAB

 

predict

Deep Learning Toolbox

  • Only the syntax YPred = predict(net,X) is supported.

  • The input X must not have a variable size. The size must be fixed at code generation time.

prod

MATLAB

 

projective2d

Image Processing Toolbox  

psnr

Image Processing Toolbox

 

qr

MATLAB

 

rad2deg

MATLAB

 

rank

MATLAB

 

rcond

MATLAB

 

rdivide

MATLAB

 

real

MATLAB

 

reallog

MATLAB

 

realsqrt

MATLAB

 

rectint

MATLAB

 

repelem

MATLAB

 

repmat

MATLAB

 

reshape

MATLAB

 

resnet50

Deep Learning Toolbox

For code generation, you can load the network by using the syntax net = resnet50 or by passing the resnet50 function to coder.loadDeepLearningNetwork. For example: net = coder.loadDeepLearningNetwork('resnet50')

resnet101

Deep Learning Toolbox

For code generation, you can load the network by using the syntax net = resnet101 or by passing the resnet101 function to coder.loadDeepLearningNetwork. For example: net = coder.loadDeepLearningNetwork('resnet101')

rgb2gray

MATLAB

 

rgb2hsv

MATLAB

 

rgb2lab

Image Processing Toolbox  

rgb2ycbcr

Image Processing Toolbox  

rot90

MATLAB

 

round

MATLAB

 

sec

MATLAB

 

sech

MATLAB

 

SeriesNetwork

Deep Learning Toolbox

sin

MATLAB

 

single

MATLAB

 

sinh

MATLAB

 

size

MATLAB

 

sortrows

MATLAB

 

sph2cart

MATLAB

 

sqrt

MATLAB

 

squeeze

MATLAB

 

squeezenet

Deep Learning Toolbox

For code generation, you can load the network by using the syntax net = squeezenet or by passing the squeezenet function to coder.loadDeepLearningNetwork. For example: net = coder.loadDeepLearningNetwork('squeezenet')

std

MATLAB

 

stretchlim

Image Processing Toolbox  

sub2ind

MATLAB

 

subsasgn

Fixed-Point Designer

 

subsindex

MATLAB

 

subsref

Fixed-Point Designer

 
   

sum

MATLAB

 

superpixels

Image Processing Toolbox  

svd

MATLAB

 

swapbytes

MATLAB

 

tan

MATLAB

 

tanh

MATLAB

 

times

MATLAB

 

trace

MATLAB

 

transpose

MATLAB

 

tril

MATLAB

 

triu

MATLAB

 

true

MATLAB

 

typecast

MATLAB

 

uint8, uint16, uint32, uint64

MATLAB

 

uminus

MATLAB

 

unetLayers

Computer Vision Toolbox

 

uplus

MATLAB

 

vander

MATLAB

 

var

MATLAB

 

vertcat

Fixed-Point Designer

 

vgg16

Deep Learning Toolbox

For code generation, you can load the network by using the syntax net = vgg16 or by passing the vgg16 function to coder.loadDeepLearningNetwork. For example: net = coder.loadDeepLearningNetwork('vgg16')

vgg19

Deep Learning Toolbox

For code generation, you can load the network by using the syntax net = vgg19 or by passing the vgg19 function to coder.loadDeepLearningNetwork. For example: net = coder.loadDeepLearningNetwork('vgg19')

watershed

Image Processing Toolbox  

xor

MATLAB

 

ycbcr2rgb

Image Processing Toolbox  

zeros

MATLAB