Main Content

Installing Prerequisite Products

R2026b

To use GPU Coder™ for CUDA® code generation, you must install and set up 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 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 you install MATLAB 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 GPU Compute Capability on the NVIDIA website.

    This table lists the CUDA compute capability requirements for code generation.

    TargetCompute Capability

    CUDA MEX

    See GPU Computing Requirements.

    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 build and execute generated code. For desktop GPUs, you must install a compatible host compiler and NVIDIA display driver. You can install additional software to compile standalone code or generate code that uses deep learning libraries.

For NVIDIA Jetson or NVIDIA DRIVE hardware, install the NVIDIA JetPack™ or NVIDIA DriveOS™ software, respectively. Additionally, you must set up the board by using the Hardware Setup tool. For more information, see Prerequisites for Generating Code for NVIDIA Boards.

Host Compiler

To build CUDA code, install a host compiler that is compatible with NVIDIA CUDA Toolkit version 13.1. This table lists compatible compilers. On Windows®, install the Microsoft® Visual Studio® IDE with the Microsoft Visual C++® compiler.

Linux® Compiler

Windows IDE

Windows Compiler

GCC C/C++ compiler

For supported versions, see Supported and Compatible Compilers.

Microsoft Visual Studio 2022 versions 17.0 through 17.9

Microsoft Visual C++ compiler version 19.3x

Microsoft Visual Studio 2019 version 16.x

Microsoft Visual C++ compiler version 19.2x

Note

The Microsoft Visual C++ 2026 compiler is not compatible with CUDA Toolkit version 13.1 and is not supported.

NVIDIA Display Driver

To run compiled CUDA code, install the latest NVIDIA display driver for your system. Download drivers for your GPU from Drivers on the NVIDIA website.

Optional Software

Building standalone source code, executables, and libraries requires additional software. To build standalone code for deployment to NVIDIA GPUs, you must install the NVIDIA CUDA Toolkit. To generate standalone code that uses third-party libraries, install the version of the library in this table. To generate code for deep learning networks that does not use third-party libraries, see Code Generation for Deep Learning Networks.

Software NameVersionAdditional Information

CUDA Toolkit

13.1 (since R2026b)

Install the latest update of CUDA Toolkit version 13.1. To download the CUDA Toolkit, see CUDA Toolkit Archive on the NVIDIA website.

NVIDIA CUDA Deep Neural Network library (cuDNN) for NVIDIA GPUs

9.20 (since R2026b)

GPU Coder does not support cuDNN version 7 and earlier.

To download cuDNN, see NVIDIA cuDNN on the NVIDIA website.

NVIDIA TensorRT™ high-performance inference optimizer and runtime library

10.15 (since R2026b)

GPU Coder does not support TensorRT version 7 and earlier.

To use the TensorRT library to build MEX functions or accelerate Simulink simulations, you must install it by using gpucoder.installTensorRT. (since R2025a)

To use TensorRT in standalone code, download it from NVIDIA TensorRT on the NVIDIA website.

ARM Compute Library for Mali GPUs

19.05

For more information, see Arm Compute Library on the ARM website.

Tips

On Windows, a space or special character in the path to the tools, compilers, and libraries can create issues during the build process. You must install third-party software in locations that do not contain spaces or change Windows settings to enable creation of short names for files, folders, and paths. For more information, see Using Windows short names solution in MATLAB Answers.

  • The nvcc compiler supports multiple versions of GCC and therefore you can generate CUDA code with other versions of GCC. However, there may be compatibility issues when executing the generated code from MATLAB as the C/C++ run-time libraries that are included with the MATLAB installation are compiled for only the supported version of GCC.

  • When you install the CUDA Toolkit, install the nvcc compiler, cuFFT, cuBLAS, cuSOLVER, Thrust libraries, and other tools.

Other versions of these deep learning libraries may have compatibility issues with the features GPU Coder supports this release.

  • This library must be installed on the ARM target hardware. Do not use a prebuilt library because it might be incompatible with the compiler on the ARM hardware. Instead, build the library from the source code. Build the library on either your host machine or directly on the target hardware. See instructions for building the library on GitHub®. You can also find information on building the library for CPUs in this post on MATLAB answers.

  • When building the Compute Library, enable OpenCL support in the build options. See the ARM Compute Library documentation for instructions. OpenCL library (v1.2 or higher) on the ARM target hardware. See the ARM Compute Library documentation for version requirements. After the build is complete, rename the build folder containing the libraries as lib. Additionally, copy the OpenCL libraries present in the build/opencl-1.2-stubs folder into the lib folder. These steps are required so that the generated makefile can locate the libraries when building the generated code on the target hardware.

See Also

Apps

Functions

Objects

Topics