Kernel Creation

Algorithm structures and patterns that create CUDA® GPU kernels

CUDA kernels are functions that are executed on the GPU device. These kernels are executed by many GPU threads in parallel. By efficiently mapping compute intensive portions of your algorithm to kernels, you can take advantage of the performance improvements provided by GPU computing technology. You can trigger GPU Coder™ to create CUDA kernels for specific algorithm structures and patterns in your MATLAB® code.

Apps

GPU CoderGenerate GPU code from MATLAB code
Check GPU InstallVerify and set up the GPU code generation environment

Functions

halfConstruct half-precision numeric object
coder.checkGpuInstallVerify GPU code generation environment
coder.gpuConfigConfiguration parameters for CUDA code generation from MATLAB code by using GPU Coder
codegenGenerate C/C++ code from MATLAB code
gpucoderOpen GPU Coder app
coder.gpu.kernelPragma that maps for-loops to GPU kernels
coder.gpu.kernelfunPragma that maps function to GPU kernels
coder.gpu.nokernelPragma to disable kernel creation for loops
coder.gpu.constantMemoryPragma that maps a variable to the constant memory on GPU
gpucoder.stencilKernelCreate CUDA code for stencil functions
gpucoder.matrixMatrixKernelOptimized GPU implementation of functions containing matrix-matrix operations
gpucoder.batchedMatrixMultiplyOptimized GPU implementation of batched matrix multiply operation
gpucoder.stridedMatrixMultiplyOptimized GPU implementation of strided and batched matrix multiply operation
gpucoder.batchedMatrixMultiplyAddOptimized GPU implementation of batched matrix multiply with add operation
gpucoder.stridedMatrixMultiplyAddOptimized GPU implementation of strided, batched matrix multiply with add operation
gpucoder.sortOptimized GPU implementation of the MATLAB sort function
coder.gpu.iterationsPragma that provides information to the code generator for making parallelization decisions on variable bound loops
gpucoder.transposeOptimized GPU implementation of the MATLAB transpose function
gpucoder.reduceOptimized GPU implementation for reduction operations
coder.cevalCall external C/C++ function

Objects

coder.gpuConfigConfiguration parameters for CUDA code generation from MATLAB code by using GPU Coder
coder.CodeConfigConfiguration parameters for C/C++ code generation from MATLAB code
coder.EmbeddedCodeConfigConfiguration parameters for C/C++ code generation from MATLAB code with Embedded Coder
coder.gpuEnvConfigCreate configuration object containing the parameters passed to coder.checkGpuInstall for performing GPU code generation environment checks

Topics

Kernels from Element-Wise Loops

Create kernels from MATLAB functions containing scalarized, element-wise math operations.

Kernels from Scatter-Gather Type Operations

Create kernels from MATLAB functions containing reduction operations.

Kernels from Library Calls

Target GPU optimized math libraries such as cuBLAS, cuSOLVER, cuFFT, and Thrust.

Support for GPU Arrays

Generate CUDA code that uses GPU arrays.

Legacy Code Integration

Integrate custom GPU code with MATLAB code intended for code generation.

Design Patterns

Create kernels for MATLAB functions containing computational design patterns.

GPU Memory Allocation and Minimization

Memory allocation options and optimizations for GPU Coder.

Featured Examples