Main Content

setupCodegenContext

Select the target hardware to build code for from multiple live connection objects

Add-On Required: This feature requires the MATLAB Coder Support Package for NVIDIA Jetson and NVIDIA DRIVE Platforms add-on.

Description

setupCodegenContext(hwObj) selects the NVIDIA® target hardware to generate code for. When there are multiple live connection objects for different targets, the code generator performs remote build on the target for which a recent live object was created. To choose a hardware board for performing remote build, use the setupCodegenContext() method of the respective live hardware object. If only one live connection object was created, you need not call this method.

example

Examples

collapse all

This example shows how to use the setupCodegenContext() method and select the NVIDIA Jetson™ board for code generation when the MATLAB® session has multiple live connection objects.

Create a connection, hwJetson, from the MATLAB software to NVIDIA Jetson hardware.

hwJetson = jetson
Checking for CUDA availability on the Target...
Checking for 'nvcc' in the target system path...
Checking for cuDNN library availability on the Target...
Checking for TensorRT library availability on the Target...
Checking for prerequisite libraries is complete.
Gathering hardware details...
Checking for third-party library availability on the Target...
Gathering hardware details is complete.
 Board name         : NVIDIA Jetson TX2
 CUDA Version       : 10.0
 cuDNN Version      : 7.5
 TensorRT Version   : 5.1
 GStreamer Version  : 1.14.5
 V4L2 Version       : 1.14.2-1
 SDL Version        : 1.2
 Available Webcams  : Microsoft® LifeCam Cinema(TM)
 Available GPUs     : NVIDIA Tegra X2

hwJetson = 

  jetson with properties:

       DeviceAddress: 'jetson-board-name'
                Port: 22
           BoardName: 'NVIDIA Jetson TX2'
         CUDAVersion: '10.0'
        cuDNNVersion: '7.5'
     TensorRTVersion: '5.1'
          SDLVersion: '1.2'
         V4L2Version: '1.14.2-1'
    GStreamerVersion: '1.14.5'
             GPUInfo: [1×1 struct]
          WebcamList: {'Microsoft® LifeCam Cinema(TM)'}

Create a connection, hwDRIVE, from the MATLAB software to NVIDIA DRIVE® hardware.

hwDrive = drive('drive-board-name','nvidia','nvidia');
Checking for CUDA availability on the Target...
Checking for 'nvcc' in the target system path...
Checking for cuDNN library availability on the Target...
Checking for TensorRT library availability on the Target...
Checking for prerequisite libraries is complete.
Gathering hardware details...
Checking for third-party library availability on the Target...
Gathering hardware details is complete.
 Board name         : NVIDIA Drive
 CUDA Version       : 9.2
 cuDNN Version      : 7.1
 TensorRT Version   : 4.0
 GStreamer Version  : 1.8.2
 V4L2 Version       : 1.10.0-1
 SDL Version        : 1.2
 Available Webcams  : Microsoft® LifeCam Cinema(TM)
 Available GPUs     : DRIVE PX 2 AutoChauffeur,NVIDIA Tegra X2

hwDrive = 

  jetson with properties:

       DeviceAddress: 'drive-board-name'
                Port: 22
           BoardName: 'NVIDIA Drive'
         CUDAVersion: '9.2'
        cuDNNVersion: '7.1'
     TensorRTVersion: '4.0'
          SDLVersion: '1.2'
         V4L2Version: '1.10.0-1'
    GStreamerVersion: '1.8.2'
             GPUInfo: [1×2 struct]
          WebcamList: {'Microsoft® LifeCam Cinema(TM)'}

To choose a hardware board for performing remote build, use the setupCodegenContext() method of the respective live hardware object.

setupCodegenContext(hwJetson);

The code generator now performs code generation for the Jetson hardware target.

Input Arguments

collapse all

Connection to a specific NVIDIA hardware board, specified as a jetson or drive object.

Version History

Introduced in R2018b