主要内容

Performance

Troubleshoot code generation issues, improve code execution time, and reduce memory usage of generated code

Some of the most common reasons why GPU Coder™ generated code is not performing as expected are:

  • CUDA® kernels are not created.

  • Host to device and device to host memory transfers (cudaMemcpy) are throttling performance.

  • Not enough parallelism or device issues.

These topics elaborate on the common causes for these symptoms and describe how to utilize the built-in screener to detect these issues. You can find information on how to work around for these issues and generate more efficient CUDA code.

Apps

GPU CoderGenerate CUDA code from MATLAB code
GPU Environment CheckVerify and set up GPU code generation environment

Tools

GPU Performance AnalyzerAnalyze GPU profiling data and identify optimizations (Since R2023a)

Functions

expand all

coder.gpuConfigCreate GPU code generation configuration
codegenGenerate C or C++ code from MATLAB code
gpucoderOpen GPU Coder app
gpuPerformanceAnalyzerAnalyze and optimize performance of the generated code (Since R2023a)
gpuprofileProfile execution time for generated CUDA code (Since R2024a)
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

Objects

expand all

coder.GpuCodeConfigConfiguration parameters for CUDA code generation from MATLAB code
coder.MexCodeConfigConfiguration parameters for MEX function generation from MATLAB code
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.gpuEnvConfigConfiguration object for checking the GPU code generation environment

Topics

Featured Examples