Main Content

Installing Prerequisite Products

To use GPU Coder™ for CUDA® C/C++ code generation, you must install the following products:

MathWorks Products and Support Packages

  • MATLAB® (required).

  • MATLAB Coder™ (required).

  • Parallel Computing Toolbox™ (required).

  • Simulink® (required for generating code from Simulink models).

  • Computer Vision Toolbox™ (recommended).

  • Deep Learning Toolbox™ (required for deep learning).

  • Embedded Coder® (recommended).

  • Image Processing Toolbox™ (recommended).

  • Simulink Coder (required for generating code from Simulink models).

  • GPU Coder Interface for Deep Learning Libraries support package (required for deep learning).

  • GPU Coder Support Package for NVIDIA® GPUs (required for deployment to embedded targets such as NVIDIA Jetson and Drive).

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 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 compute capability 3.2 or higher and a compatible graphics driver. For more information, see CUDA GPUs (NVIDIA).

    Deep learning applications in 8-bit integer precision requires a CUDA GPU with a compute capability of 6.1, 6.3 or higher. For half-precision (16-bit integer), a CUDA GPU with minimum compute capability of 7.0 is required.

  • ARM® Mali graphics processor.

    For the Mali device, GPU Coder supports C++ code generation for only deep learning networks.

Third-Party Software

Required

C/C++ Compiler:

Linux®

Windows®

GCC C/C++ compiler 6.3.x

Microsoft® Visual Studio® 2013

Microsoft Visual Studio 2015

Microsoft Visual Studio 2017

Microsoft Visual Studio 2019

Optional

Standalone code (static library, dynamically linked library, or executable program) generation has additional software requirements. For CUDA MEX, the code generator uses the NVIDIA compiler and libraries installed with MATLAB.

Software NameInformation

CUDA toolkit

GPU Coder has been tested with CUDA toolkit v9.x-v10.2.

To download the CUDA toolkit, see CUDA Toolkit Archive (NVIDIA).

It is recommended to select the default installation options that includes nvcc compiler, cuFFT, cuBLAS, cuSOLVER, Thrust libraries, and other tools.

The NVIDIA nvcc compiler relies on tight integration with the host development environment, including the host compiler and runtime libraries. It is recommended that you follow the CUDA toolkit documentation for detailed information on compiler, libraries, and other platform specific requirements. See, CUDA Toolkit Documentation (NVIDIA)

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 GCC 6.3.

NVIDIA CUDA deep neural network library (cuDNN) for NVIDIA GPUs

cuDNN is a GPU-accelerated library of primitives for deep neural networks. For more information, see cuDNN (NVIDIA).

GPU Coder has been tested with cuDNN v7.5.x.

NVIDIA TensorRT™

TensorRT is a high performance inference optimizer and runtime library for NVIDIA GPUs. For more information, see TensorRT (NVIDIA).

GPU Coder has been tested with TensorRT v7.0.x.

ARM Compute Library

The ARM Compute Library is a optimized computer vision and machine learning library for Mali GPUs. For more information, see Compute Library (ARM).

GPU Coder has been tested with v19.05.

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.

Open Source Computer Vision Library (OpenCV)

Required for deep learning examples. For more information, see OpenCV.

For examples targeting NVIDIA GPUs on the host development computer, use OpenCV v3.1.0. For examples targeting ARM GPUs, use OpenCV v2.4.9 on the ARM target hardware.

The examples require separate libs such as, opencv_core.lib and opencv_video.lib. You must download the OpenCV source and build the libraries. For more information, refer to the OpenCV documentation.

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 does 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 Analyze Execution Profiles of the Generated Code workflow depends on the nvprof tool from NVIDIA. From CUDA toolkit v10.1 onwards, NVIDIA restricts access to performance counters to only admin users. To enable GPU performance counters to be used by all users, see the instructions provided in https://developer.nvidia.com/nvidia-development-tools-solutions-ERR_NVGPUCTRPERM-permission-issue-performance-counters.

  • GPU Coder does not support generating CUDA code by using CUDA toolkit version 8.

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

  • On the target platforms, use the JetPack or the DriveInstall software appropriate for your board to install all the libraries. For more information, see Install and Setup Prerequisites for NVIDIA Boards (GPU Coder Support Package for NVIDIA GPUs).

See Also

Apps

Functions

Objects

Related Topics