Main Content

Kernel Creation from MATLAB Code

MATLAB code structures and patterns that create CUDA®GPU kernels

GPU Coder™ generates and executes optimized CUDA kernels for specific algorithm structures and patterns in your MATLAB®code. The generated code calls optimized NVIDIA®CUDA libraries, including cuFFT, cuSolver, cuBLAS, cuDNN, and TensorRT. The generated code can be integrated into your project as source code, static libraries, or dynamic libraries, and can be compiled for desktops, servers, and GPUs embedded on NVIDIA Jetson, DRIVE, and other platforms. GPU Coder lets you incorporate handwritten CUDA code into your algorithms and into the generated code.

Apps

expand all

GPU Coder Generate GPU code fromMATLABcode
GPU Environment Check Verify and set up GPU code generation environment

Functions

expand all

codegen Generate C/C++ code fromMATLABcode
gpucoder OpenGPU Coderapp
coder.checkGpuInstall Verify GPU code generation environment
coder.gpuConfig Configuration parameters forCUDAcode generation fromMATLABcode by usingGPU Coder
coder.gpu.kernel Pragma that mapsfor-loops to GPU kernels
coder.gpu.kernelfun Pragma that maps function to GPU kernels
coder.gpu.nokernel Pragma to disable kernel creation for loops
coder.ceval Call external C/C++ function
coder.gpu.iterations Pragma that provides information to the code generator for making parallelization decisions on variable bound loops
coder.gpu.constantMemory Pragma that maps a variable to the constant memory on GPU
coder.gpu.persistentMemory Pragma to allocate a variable as persistent memory on the GPU
gpucoder.atomicAdd Atomically add a specified value to a variable in global or shared memory
gpucoder.atomicAnd Atomically perform bit-wise AND between a specified value and a variable in global or shared memory
gpucoder.atomicCAS Atomically compare and swap the value of a variable in global or shared memory
gpucoder.atomicDec Atomically decrement a variable in global or shared memory within a specified upper bound
gpucoder.atomicExch Atomically exchange a variable in global or shared memory with the specified value
gpucoder.atomicInc Atomically increment a variable in global or shared memory within a specified upper bound
gpucoder.atomicMax Atomically find the maximum between a specified value and a variable in global or shared memory
gpucoder.atomicMin Atomically find the minimum between a specified value and a variable in global or shared memory
gpucoder.atomicOr Atomically perform bit-wise OR between a specified value and a variable in global or shared memory
gpucoder.atomicSub Atomically subtract a specified value from a variable in global or shared memory
gpucoder.atomicXor Atomically perform bit-wise XOR between a specified value and a variable in global or shared memory
gpucoder.stencilKernel CreateCUDAcode for stencil functions
gpucoder.matrixMatrixKernel Optimized GPU implementation of functions containing matrix-matrix operations
gpucoder.batchedMatrixMultiply Optimized GPU implementation of batched matrix multiply operation
gpucoder.stridedMatrixMultiply Optimized GPU implementation of strided and batched matrix multiply operation
gpucoder.batchedMatrixMultiplyAdd Optimized GPU implementation of batched matrix multiply with add operation
gpucoder.stridedMatrixMultiplyAdd 向的优化GPU实现,成批的matrix multiply with add operation
gpucoder.sort Optimized GPU implementation of theMATLABsort function
gpucoder.transpose Optimized GPU implementation of theMATLABtranspose function
gpucoder.reduce Optimized GPU implementation for reduction operations

Objects

expand all

coder.gpuConfig Configuration parameters forCUDAcode generation fromMATLABcode by usingGPU Coder
coder.CodeConfig Configuration parameters for C/C++ code generation fromMATLABcode
coder.EmbeddedCodeConfig Configuration parameters for C/C++ code generation fromMATLABcode withEmbedded Coder
coder.gpuEnvConfig Create configuration object containing the parameters passed tocoder.checkGpuInstallfor performing GPU code generation environment checks

Topics