DriveWorks SDK Reference
4.0.0 Release
For Test and Development only

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