Main Content

coder.gpuEnvConfig

Configuration object containing the parameters to check the GPU code generation environment

Description

The coder.gpuEnvConfig object contains the configuration parameters that coder.checkGpuInstall uses to verify the GPU code generation environment.

Creation

Description

gpuEnvObj = coder.gpuEnvConfig creates a gpuEnvConfig configuration object for the host development computer.

gpuEnvObj = coder.gpuEnvConfig(hw) creates a gpuEnvConfig configuration object for the hardware type specified in hw. hw can take the value of 'host', 'jetson', or 'drive'. The Jetson™ and DRIVE types require the MATLAB® Coder™ Support Package for NVIDIA® Jetson and NVIDIA DRIVE® Platforms.

example

Properties

expand all

This field is a read-only property set at the time of creating a gpuEnvConfig configuration object. This field can take the value of 'host', 'jetson', or 'drive'. The Jetson and DRIVE types require the MATLAB Coder Support Package for NVIDIA Jetson and NVIDIA DRIVE Platforms.

Example: gpuEnvObj.Hardware

Select the GPU Device ID that must be used when the environment is checked. By default, GpuId is set to 0.

Example: gpuEnvObj.GpuId = 1;

When this field is set to true, basic GPU code generation check is performed. The generated code is not executed.

Example: gpuEnvObj.BasicCodegen = true;

When this field is set to true, basic GPU code generation and execution checks are performed on the selected GPU device.

Example: gpuEnvObj.BasicCodeexec = true;

When this field is set to true, deep learning GPU code generation check is performed for the library target indicated by the DeepLibTarget property. The generated code is not executed.

Example: gpuEnvObj.DeepCodegen = true;

When this field is set to true, deep learning GPU code generation and execution checks are performed for the library target indicated by the DeepLibTarget property on the selected GPU device.

Example: gpuEnvObj.DeepCodeexec = true;

Deep learning library, specified as 'none', 'cudnn', or 'tensorrt'.This property indicates the library target for which to perform deep learning code generation and execution checks. Set this property to 'none' to generate CUDA® code for deep neural networks without using third-party libraries.

Example: gpuEnvObj.DeepLibTarget = 'cudnn';

This field checks if the compute capability of the selected GPU device meets the minimum compute capability required for the selected TensorRT data precision.

Example: gpuEnvObj.DataType = 'fp32';

When this field is set to true, an HTML report of the results is generated in the current working folder. The current working folder must be write-enabled.

Example: gpuEnvObj.GenReport = true;

When this field is set to true, the output printed on the command line is suppressed.

Example: gpuEnvObj.Quiet = true;

This field contains the path to the CUDA libraries on the host. The default value is based on the current nvcc location found on the Linux® OS and on the "CUDA_PATH" environment variable in Windows® OS. You can also modify this value to select a different location.

Example: gpuEnvObj.CudaPath = '/usr/local/cuda';

This field contains the path to the cuDNN libraries on the host. The default value is based on the "NVIDIA_CUDNN" environment variable if set. You can also modify this value to select a different location.

Example: gpuEnvObj.CudnnPath = '/usr/local/cuda/cudnn';

This field contains the path to the TensorRT libraries on the host. The default value is based on the "NVIDIA_TENSORRT" environment variable if set. You can also modify this value to select a different location.

Example: gpuEnvObj.TensorrtPath = '/usr/local/cuda/tensorrt';

This field accepts a "jetson" or a "drive" hardware object. This field needs (for jetson/drive) to be set before running environment checks on the board.

Example: gpuEnvObj.Hardware = jetsonHwObj;

Specify the time in seconds that the software waits before validating the execution tests on the target.

Example: gpuEnvObj.ExecTimeout = 25;

Examples

collapse all

This example shows you how to verify that your development computer has all the tools and configuration required for GPU code generation.

Create a coder.gpuEnvConfig object that you can pass to the coder.checkGpuInstall function.

In the MATLAB Command Window, enter:

gpuEnvObj = coder.gpuEnvConfig;
gpuEnvObj.BasicCodegen = 1;
gpuEnvObj.BasicCodeexec = 1;
gpuEnvObj.DeepLibTarget = 'tensorrt';
gpuEnvObj.DeepCodeexec = 1;
gpuEnvObj.DeepCodegen = 1;
results = coder.checkGpuInstall(gpuEnvObj)

The output shown here is representative. Your results might differ.

Compatible GPU           : PASSED 
CUDA Environment         : PASSED 
	Runtime   : PASSED 
	cuFFT     : PASSED 
	cuSOLVER  : PASSED 
	cuBLAS    : PASSED 
cuDNN Environment        : PASSED 
TensorRT Environment     : PASSED 
Basic Code Generation    : PASSED 
Basic Code Execution     : PASSED 
Deep Learning (TensorRT) Code Generation: PASSED 
Deep Learning (TensorRT) Code Execution: PASSED 

results = 

  struct with fields:

                 gpu: 1
                cuda: 1
               cudnn: 1
            tensorrt: 1
        basiccodegen: 1
       basiccodeexec: 1
         deepcodegen: 1
    tensorrtdatatype: 1
        deepcodeexec: 1

Version History

Introduced in R2019a

expand all