coder.gpuEnvConfig - Configuration object for checking the GPU code generation environment - MATLAB (original) (raw)
Configuration object for checking 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 agpuEnvConfig
configuration object for the host development computer.
gpuEnvObj = coder.gpuEnvConfig(hw)
creates a configuration object for the type of hardware specified by hw
. To specify the hardware type as NVIDIA® Jetson™ or NVIDIA DRIVE®, you must install the MATLAB® Coder™ Support Package for NVIDIA Jetson and NVIDIA DRIVE Platforms.
Properties
This field is a read-only property set at the time of creating agpuEnvConfig
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 theDeepLibTarget
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;
Path to the CUDA libraries on the host, specified as a character vector. The default value depends on the operating system.
- On Linux®, the default value is based on the path to the
nvcc
compiler. If MATLAB cannot findnvcc
, the default value is an empty character vector. - On Windows®, the default value is the value of the
CUDA_PATH
environment variable.
Example: gpuEnvObj.CudaPath = '/usr/local/cuda';
Path to the cuDNN libraries on the host, specified as a character vector. The default value is based on the NVIDIA_CUDNN
environment variable, if set.
Example: gpuEnvObj.CudnnPath = '/usr/local/cuda/cudnn';
Path to the TensorRT libraries on the host, specified as a character vector. The default value is based on the NVIDIA_TENSORRT
environment variable, if set.
Example: gpuEnvObj.TensorrtPath = '/usr/local/cuda/tensorrt';
NVIDIA hardware, specified as a jetson
or adrive
object. For NVIDIA Jetson or NVIDIA DRIVE, set this field 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
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
The default value of the DeepLibTarget
property is nownone
, which specifies that the configuration object will not use third-party deep learning libraries. In previous releases, the default value ofDeepLibTarget
was an empty character array, and you set it tonone
, cudnn
, or tensorrt
before deep learning code generation.
The Profiling
and NvtxPath
properties have been removed. Setting these properties generates an error.
In previous releases, you set the NvtxPath
andProfiling
properties to check the installation of the NVTX libraries requires for profiling. The NVTX libraries are no longer required for profiling, and you do not need to check profiling. Delete code that sets theProfiling
or NvtxPath
properties of acoder.gpuEnvConfig
object.
Setting the Profiling
property of acoder.gpuEnvConfig
object to true
generates a warning and does not check profiling.
See Also
Apps
Functions
Objects
Topics
- GPU Programming Paradigm
- Installing Prerequisite Products
- Setting Up the Prerequisite Products
- The GPU Environment Check and Setup App
- Verify Setup
- Generate Code by Using the GPU Coder App
- Generate Code Using the Command Line Interface
- Code Generation for Deep Learning Networks by Using cuDNN
- Code Generation for Deep Learning Networks by Using TensorRT