Main Content

The GPU Environment Check and Setup App

The GPU Environment Check app is an interactive tool to verify and set up the GPU code generation environment on your development computer and embedded hardware platforms such as the NVIDIA® DRIVE and Jetson.

Before using this app, install and set up the required prerequisite third-party compilers, libraries, and tools. For more information, see Installing Prerequisite Products and Setting Up the Prerequisite Products.

To start the app, in the MATLAB® Command Window, enter:

gpucoderSetup
Using the GPU Environment Check app, you can:

  • Verify the host development computer environment for the NVIDIA compilers and libraries required for GPU code generation.

  • Perform basic code generation and test the execution of the generated code on the GPU device in the host computer. The tests validate code execution by comparing the results with MATLAB simulation.

  • Perform deep learning code generation and execution tests on the development computer. You can target the NVIDIA cuDNN or TensorRT libraries. Requires the GPU Coder™ Interface for Deep Learning support package.

  • Connect to embedded NVIDIA boards such as DRIVE and Jetson to perform code generation and execution tests. Requires the MATLAB Coder™ Support Package for NVIDIA Jetson and NVIDIA DRIVE Platforms.

  • Specify the location of the libraries and generate a MATLAB script that sets up the environment variables required by GPU Coder.

Note

The gpucoderSetup app generates a report file in the current folder. If you do not have write permissions in the current folder, before running the app, change the folder by using the MATLAB cd command.

Sample screen shot of the GPU environment check app

Hardware Setup

The Check/Setup panel of the app provides drop-down lists that enable you to select a GPU device on the host development computer or hardware platforms such as the NVIDIA DRIVE and Jetson.

OptionValuesDescription

Select Hardware

Host (for MEX)

Perform code generation, code execution, and environment checks on the host development computer. The app generates CUDA® MEX to perform tests.

If your development computer has multiple GPU devices, use the Select GPU option to select an appropriate GPU device.

Drive

Perform code generation and code execution checks on an NVIDIA DRIVE target platform.

After installing the MATLAB Coder Support Package for NVIDIA Jetson and NVIDIA DRIVE Platforms, use the Board Settings panel to specify connection parameters for the target.

Jetson

Perform code generation and code execution checks on an NVIDIA Jetson target platform.

After installing the MATLAB Coder Support Package for NVIDIA Jetson™ and NVIDIA DRIVE® Platforms, use the Board Settings panel to specify connection parameters for the target.

Select GPU

GPU<idx>-<device name>

Select the GPU device to run tests. When there are multiple devices, the first device is the default.

This option is visible only when the Select Hardware option is set to Host (for MEX). For DRIVE or Jetson hardware, use the GPU Device ID option available in the Board Settings panel to select a specific GPU device.

Board Settings

Specify the connection parameters for hardware platforms such as the NVIDIA DRIVE and Jetson. The app uses the jetson or drive functions of the MATLAB Coder Support Package for NVIDIA Jetson and NVIDIA DRIVE Platforms to create a live hardware connection object. The support package software uses an SSH connection over TCP/IP to execute commands while building and running the generated CUDA code on the DRIVE or Jetson platforms. The target platform must be on the same network as the host computer. Alternatively, you can use an Ethernet crossover cable to connect the board directly to the host computer. For more information on requirements, setup, and configuration steps for your NVIDIA boards, see Install and Setup Prerequisites for NVIDIA Boards.

OptionDescription

Device Address

IP address or host name of the hardware.

For example, 169.254.0.2 or gpucoder-tegratx2-name

To use the host name, you must connect an Ethernet cable to the Ethernet port of the board. Then, use Linux commands to configure the hardware IP address and associate the host name with the IP address.

Username

Valid Linux® user name for the operating system on the board.

Password

Valid password for the Linux user name specified.

Execution Timeout

Specify the time in seconds that the app waits for before validating the execution tests on the target. The default value is 10 seconds.

GPU Device ID

In a multi GPU environment such as NVIDIA Drive platforms, specify the CUDA GPU device to target.

Workflow Checks

There are two types of workflow checks that you can perform by using the app:

Basic code generation and execution tests on the development computer. These tests validate code execution by comparing the results with MATLAB simulation. Basic code generation and execution tests use the following entry-point function:

function [yout] = gpuSimpleTest(xin)

coder.allowpcode('plain');
yout = coder.nullcopy(zeros(size(xin)));
coder.gpu.kernelfun();

for idx=1:100
    yout(idx) = xin(idx) * 2;
end

yout = yout + 5;

end

OptionDescription

Generate Code

Test basic code generation and building. This test requires a valid CUDA code generation environment on the specified hardware.

Generate Code and Execute

Test basic code generation, building, and execution on the device in Specified Hardware. This test requires a valid CUDA code generation environment and GPU device on the specified hardware.

SIL Profiling

Perform basic SIL profiling tests on the host computer.

Deep learning code generation and execution tests on the development computer. You can target the cuDNN or TensorRT libraries. Deep learning code generation and execution tests use a pretrained network that can detect handwritten digit images. The network has been trained by using the Modified National Institute of Standards and Technology database (MNIST) data set. The following code shows the entry-point function for the deep learning code generation tests.

function out = dlEntryPointTest(in, ntwkfile)

    net = coder.loadDeepLearningNetwork(ntwkfile);
    out = net.predict(in);

end

OptionDescription

Generate Code

Test deep learning code generation and building. This test requires a valid CUDA code generation environment on the specified hardware.

Generate Code and Execute

Test deep learning code generation, building, and execution on the device in Specified Hardware. This test requires a valid CUDA code generation environment and GPU device on the specified hardware.

Target

Specify the deep learning library to generate code for. Valid options are cuDNN or TensorRT.

Data Type Check

Specify the precision of the inference computations in supported layers. To perform inference in 32-bit floats, use 'FP32'. For half-precision, use 'FP16'. For 8-bit integer, use 'INT8'. Default value is 'FP32'.

For compute capability requirements, see Third-Party Hardware.

Environment Checks

Specify the location of the libraries for checking the CUDA development environment on your host computer. Generate a MATLAB script gpuEnvSettings.m that sets up the environment variables required by GPU Coder. For more information, see Setting Up the Prerequisite Products.

OptionDescription

CUDA Installation Path

Path to the CUDA Toolkit installation.

For example:

/usr/local/cuda-10.1/bin

cuDNN

Path to the root folder of cuDNN library installation.

For example:

/usr/local/cuDNN/

TensorRT

Path to the root folder of TensorRT™ library installation.

For example:

/usr/local/TensorRT/

NVTX Library Path

Path to the nvtx libraries required for profiling. To enable this item, select SIL Profiling.

On a standard CUDA Toolkit installation, this path is usually the CUDA library folder.

For example:

/usr/local/cuda-10.1/lib64

GPU Code Generation Environment Check Report

When you select Run Checks, the gpucoderSetup app performs environment, code generation, and other checks based on the settings that you have selected. It then generates gpucoderSetupReport report that indicates if a test has passed and provides additional information for tests that have failed. A HTML version of the report of the same name is created in the current folder.

Sample environment check report

See Also

Apps

Functions

Objects

Related Topics