Installing Prerequisite Products

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

MathWorks Products

  • MATLAB® (required).

  • MATLAB Coder™ (required).

  • Parallel Computing Toolbox™ (required).

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

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

  • Image Processing Toolbox™ (recommended).

  • Computer Vision Toolbox™ (recommended).

  • Embedded Coder® (recommended).

  • Simulink® (recommended).

Note

If MATLAB is installed on a path that contains non 7-bit ASCII characters, such as Japanese characters, MATLAB Coder does not work because it cannot locate code generation library functions.

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.

Third-party Products

GPU Code Generation from MATLAB

  • NVIDIA® GPU enabled for CUDA with compute capability 3.2 or higher (Is my GPU supported?).

  • CUDA toolkit and driver. It is recommended to select the default installation options that includes nvcc compiler, cuFFT, cuBLAS, cuSOLVER, Thrust libraries, and other tools. GPU Coder has been tested with CUDA toolkit v10.1 (Get the CUDA toolkit).

  • 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

    Note

    • 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 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.

    • 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.

    • The Analyze Execution Profiles of the Generated Code workflow depends on the nvprof tool from NVIDIA. In CUDA toolkit v10.1, 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.

Code Generation for Deep Learning Networks

The code generation requirements for deep learning networks depends on the platform you are targeting.

 NVIDIA GPUsARM® Mali GPU
Hardware Requirements

CUDA enabled GPU with compute capability 3.2 or higher.

Targeting NVIDIA TensorRT™ libraries with INT8 precision requires a CUDA GPU with minimum compute capability of 6.1.

Targeting NVIDIA TensorRT libraries with FP16 precision requires a CUDA GPU with minimum compute capability of 7.0.

ARM Mali graphics processor.
Software Libraries

On the host development computer, GPU Coder has been tested with:

  • CUDA Deep Neural Network library (cuDNN) v7.5.x.

  • NVIDIA TensorRT – high performance deep learning inference optimizer and runtime library, v5.1.x.

Other versions of these deep learning libraries may have compatibility issues with all the features GPU Coder supports this release. For example, generating code for LSTM networks with the TensorRT library requires version 5.1.x.

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).

ARM Compute Library for computer vision and machine learning, 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.

Operating System Support

Windows and Linux.

Windows and Linux.

Other

Open Source Computer Vision Library (OpenCV), v3.1.0 is required for deep learning examples.

Note: The examples require separate libs such as, opencv_core.lib and opencv_video.lib. The OpenCV library that ships with Computer Vision Toolbox does not have all the required libraries and the OpenCV installer does not install them. Therefore, you must download the OpenCV source and build the libraries.

For more information, refer to the OpenCV documentation.

Open Source Computer Vision Library (OpenCV), v2.4.9 is required on the target hardware for deep learning examples.

See Also

| | | |

Related Topics