DriveWorks SDK Reference
3.5.78 Release
For Test and Development only

core/docs/usecase2.md
Go to the documentation of this file.
1 # Copyright (c) 2019-2020, NVIDIA CORPORATION. All rights reserved.
2 
3 @page core_usecase2 System and Platform Information
4 @tableofcontents
5 
6 @note SW Release Applicability: This tutorial is applicable to modules in both **NVIDIA DriveWorks** and **NVIDIA DRIVE Software** releases.
7 
8 @section core_platforminfo_gpu GPU Enumeration and Selection
9 
10 On NVIDIA DRIVE<sup>&trade;</sup> systems, multiple GPUs are present and available for the SDK.
11 - Integrated GPU (iGPU) is a GPU that shares the same die as the
12  ARM CPU.
13 - Descrete GPU (dGPU) is a separate unit connected over a PCIEX bus with
14  the main CPU.
15 
16 At runtime, user applications can enumerate and select
17 these GPUs. Most of the NVIDIA<sup>&reg;</sup> DriveWorks modules use the currently selected GPU.
18 
19 ```{.cpp}
20 #include <dw/core/Context.h>
21 
22 ...
23 
24 // enumerate all available GPUs in the system and select first available dGPU
25 int32_t numGPUs = 0;
26 dwContext_getGPUCount(&numGPUs, sdkContext);
27 for (int32_t i=0; i < numGPUsl; i++)
28 {
29  dwGPUDeviceType type;
30  dwContext_getGPUDeviceType(&type, i, sdkContext);
31  switch (type)
32  {
33  case DW_GPU_DEVICE_DISCRETE:
34  printf("GPU %d is a dGPU, set it as current GPU\n", i);
35 
36  dwContext_selectGPUDevice(i, sdkContext);
37 
38  break;
39 
40  case DW_GPU_DEVICE_INTEGRATED:
41  printf("GPU %d is an iGPU\n", i);
42  break;
43 
44  default:
45  }
46 }
47 
48 ```
49 
50 @note For applications that require access to GPU memory, ensure that such applications use the correct GPU.
51 
52 @section core_platforminfo_dla DLA Engine Selection (Xavier SoC)
53 
54 NVIDIA DRIVE<sup>&trade;</sup> platforms with the NVIDIA Xavier SoC provide
55 a hardware-accelerated deep learning accelerator (DLA). DLA
56 accelerates inferencing of the networks, which frees up
57 NVIDIA<sup>&reg;</sup> CUDA<sup>&reg;</sup> units to perform
58 other tasks.
59 
60 The following snippet shows how to activate a specific DLA engine for inferencing of DriveNet. For a full sample,
61 see @ref dwx_drivenet_sample.
62 
63 ```{.cpp}
64 
65 // check if current platform supports DLA engine
66 int32_t numDLAs = 0;
67 dwContext_getDLAEngineCount(&numDLAs, sdkContext);
68 if (numDLAs == 0)
69 {
70  printf("The platform does not support DLA engine\n");
71  return 0;
72 }
73 
74 // setup DriveNet to use DLA engine for inferencing
75 dwDriveNetParams driveNetParams = {};
76 ...
77 driveNetParams.processorType = DW_PROCESSOR_TYPE_DLA_0;
78 
79 // DLA supports only FP16 precision
80 driveNetParams.networkPrecision = DW_PRECISION_FP16;
81 
82 dwDriveNet_initialize(&driveNet, ..., &driveNetParams, sdkContext);
83 ```
84 
85