Installing Prerequisite Products
To use GPU Coder™ for CUDA® code generation, you must install and setup the following products. For setup instructions, see Setting Up the Prerequisite Products.
MathWorks Products and Support Packages
MATLAB® (required).
MATLAB Coder™ (required).
Parallel Computing Toolbox™ (required).
Simulink® (required for generating code from Simulink models).
Simulink Coder (required for generating code from Simulink models).
Deep Learning Toolbox™ (required for deep learning).
GPU Coder Interface for Deep Learning support package (required for deep learning).
MATLAB Coder Support Package for NVIDIA® Jetson™ and NVIDIA DRIVE® Platforms (required for deployment to embedded targets such as NVIDIA Jetson and Drive).
Embedded Coder® (recommended).
Computer Vision Toolbox™ (recommended).
Image Processing Toolbox™ (recommended).
For instructions on installing MathWorks® products, see the MATLAB installation documentation for your platform. If you have installed
MATLAB and want to check which other MathWorks products are installed, enter ver
in the MATLAB Command Window.
To install the support packages, use the Add-On Explorer in MATLAB.
If MATLAB is installed on a path that contains non 7-bit ASCII characters, such as Japanese characters, GPU Coder does not work because it cannot locate code generation library functions.
Third-Party Hardware
NVIDIA GPU enabled for CUDA with a compatible graphics driver. For more information, see CUDA GPUs (NVIDIA).
To see the CUDA compute capability requirements for code generation, consult the following table.
Target Compute Capability CUDA MEX
Source code, static or dynamic library, and executables
3.2 or higher.
Deep learning applications in 8-bit integer precision
6.1, 7.0 or higher.
Deep learning applications in half-precision (16-bit floating point)
5.3, 6.0, 6.2 or higher.
ARM® Mali graphics processor.
For the Mali device, GPU Coder supports code generation for only deep learning networks.
Third-Party Software
GPU Coder requires third-party software to generate code. Generating standalone code requires additional software.
Install Required Software
To generate CUDA code with GPU Coder, you must install a compatible compiler and the NVIDIA Display Driver. All software must be compatible with both GPU Coder and the CUDA Toolkit.
To generate CUDA MEX functions and accelerate Simulink simulations on a GPU, GPU Coder uses the host compiler, NVIDIA software, and version 12.2 of the CUDA Toolkit, which is installed with MATLAB.
In R2025a: The NVIDIA TensorRTTM library is not installed by
default in MATLAB for generating MEX functions or accelerating Simulink simulations. To use TensorRT library, you must install it by using
gpucoder.installTensorRT
.
Required software for CUDA
This table lists the required software versions for version 12.2 of the CUDA Toolkit.
Software Name | Additional Information | Linux® | Windows® |
---|---|---|---|
C/C++ Compiler | N/A | GCC C/C++ compiler For supported versions, see Supported and Compatible Compilers. | Microsoft® Visual Studio® 2022 with Microsoft Visual C++® version 193x |
Microsoft Visual Studio 2019 with Microsoft Visual C++ version 192x | |||
Microsoft Visual Studio 2017 with Microsoft Visual C++ version 191x | |||
NVIDIA Display Driver | Minimum required driver version CUDA applications can run with a limited feature set on systems with the minimum required driver version. | Version 525.60.13 or later | Version 525.41 or later |
Driver version for full compatibility | Version 535.54.03 or later | Version 536.25 or later |
To find driver version requirements for different CUDA Toolkit versions, refer to the CUDA Toolkit release notes (NVIDIA). For supported Microsoft Visual C++ versions, see the CUDA Installation Guide for Microsoft Windows (NVIDIA).
Install Optional Software
Generating standalone source code, executables, and libraries requires additional software. To generate standalone code for deployment to NVIDIA GPUs, you must install the CUDA Toolkit. Additionally, to generate standalone code that uses third-party libraries, install the version of the library in the table below. To generate code for deep learning networks that does not use third-party libraries, see Code Generation for Deep Learning Networks.
Software Name | Version | Additional Information |
---|---|---|
CUDA Toolkit | 12.2 | You can generate standalone code with versions 9 and higher. GPU Coder does not support code generation with CUDA Toolkit version 8. To download the CUDA Toolkit, see CUDA Toolkit Archive (NVIDIA). |
NVIDIA CUDA Deep Neural Network Library (cuDNN) for NVIDIA GPUs | 8.9 | GPU Coder does not support cuDNN version 7 and earlier. (since R2025a) To download cuDNN, see cuDNN (NVIDIA). |
NVIDIA TensorRT™ high-performance inference optimizer and runtime library | 8.6.1 | GPU Coder does not support TensorRT version 7 and earlier. (since R2025a) To download TensorRT, see TensorRT (NVIDIA). |
ARM Compute Library for Mali GPUs | 19.05 | For more information, see Compute Library (ARM). |
Open Source Computer Vision Library (OpenCV) | For examples targeting NVIDIA GPUs on the host development computer, use OpenCV version 3.1.0. For examples targeting ARM GPUs, use OpenCV version 2.4.9 on the ARM target hardware. | This library is required for some deep learning examples. For more information, see OpenCV. |
Tips
See Also
Apps
Functions
Objects
Topics
- Setting Up the Prerequisite Products
- The GPU Environment Check and Setup App
- Generate Code by Using the GPU Coder App
- Generate Code Using the Command Line Interface
- Code Generation for Deep Learning Networks by Using cuDNN
- Code Generation for Deep Learning Networks by Using TensorRT
- Code Generation for Deep Learning Networks Targeting ARM Mali GPUs