DriveWorks SDK Reference
5.4.5418 Release
For Test and Development only

Context.h
Go to the documentation of this file.
1 //
3 // Notice
4 // ALL NVIDIA DESIGN SPECIFICATIONS AND CODE ("MATERIALS") ARE PROVIDED "AS IS" NVIDIA MAKES
5 // NO REPRESENTATIONS, WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
6 // THE MATERIALS, AND EXPRESSLY DISCLAIMS ANY IMPLIED WARRANTIES OF NONINFRINGEMENT,
7 // MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
8 //
9 // NVIDIA CORPORATION & AFFILIATES assumes no responsibility for the consequences of use of such
10 // information or for any infringement of patents or other rights of third parties that may
11 // result from its use. No license is granted by implication or otherwise under any patent
12 // or patent rights of NVIDIA CORPORATION & AFFILIATES. No third party distribution is allowed unless
13 // expressly authorized by NVIDIA. Details are subject to change without notice.
14 // This code supersedes and replaces all information previously supplied.
15 // NVIDIA CORPORATION & AFFILIATES products are not authorized for use as critical
16 // components in life support devices or systems without express written approval of
17 // NVIDIA CORPORATION & AFFILIATES.
18 //
19 // SPDX-FileCopyrightText: Copyright (c) 2016-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
20 // SPDX-License-Identifier: LicenseRef-NvidiaProprietary
21 //
22 // NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
23 // property and proprietary rights in and to this material, related
24 // documentation and any modifications thereto. Any use, reproduction,
25 // disclosure or distribution of this material and related documentation
26 // without an express license agreement from NVIDIA CORPORATION or
27 // its affiliates is strictly prohibited.
28 //
30 
48 #ifndef DW_CORE_CONTEXT_H_
49 #define DW_CORE_CONTEXT_H_
50 
51 #include <dw/core/Config.h>
52 #include <dw/core/base/Exports.h>
53 #include <dw/core/base/Types.h>
54 #include <dw/core/Version.h>
55 #include <dw/core/base/Status.h>
56 #include <cuda_runtime_api.h>
57 
58 // type definitions for CUDA structs
62 
63 // Forward declares from EGL
64 typedef void* EGLDisplay;
65 
66 #ifdef __cplusplus
67 extern "C" {
68 #endif
69 
78 typedef struct dwContextObject* dwContextHandle_t;
80 typedef struct dwContextObject const* dwConstContextHandle_t;
81 
82 typedef struct dwModuleObject* dwModuleHandle_t;
83 typedef struct dwModuleObject const* dwConstModuleHandle_t;
84 
88 typedef struct dwContextParameters
89 {
90 
91 #ifdef DW_USE_EGL
92  EGLDisplay eglDisplay;
94 
99  bool skipEglInit;
100 #endif
101 
107 
113 
120  bool enablePVA;
121 
126 
133 
136 
141 {
142  void (*close)(dwCustomizedFileHandle hnd);
143  size_t (*write)(dwCustomizedFileHandle hnd, const void* ptr, size_t size);
144  size_t (*read)(dwCustomizedFileHandle hnd, void* ptr, size_t size);
145  bool (*getString)(dwCustomizedFileHandle hnd, char8_t* ptr, size_t size);
146  size_t (*size)(dwCustomizedFileHandle hnd);
147  size_t (*getPosition)(dwCustomizedFileHandle hnd);
148  void (*setPosition)(dwCustomizedFileHandle hnd, size_t size);
149  bool (*eof)(dwCustomizedFileHandle hnd);
150  bool (*error)(dwCustomizedFileHandle hnd);
151  void (*flush)(dwCustomizedFileHandle hnd);
152  dwCustomizedFileHandle (*open)(const char8_t* ptr1, const char8_t* ptr2);
153 
155 
168 dwStatus dwContext_setCustomFileFunctions(dwContextHandle_t const context, dwCustomizedFileFunctions* const fileFunctionPtr);
169 
185 dwStatus dwGetLastError(char8_t const** const errorMsg);
186 
218 dwStatus dwInitialize(dwContextHandle_t* const context, dwVersion const headerVersion, dwContextParameters const* const params);
219 
233 dwStatus dwRelease(dwContextHandle_t const context);
234 
251 dwStatus dwContext_getCurrentTime(dwTime_t* const time, dwContextHandle_t const context);
252 
276 dwStatus dwContext_isTimePTPSynchronized(bool* const flag, dwContextHandle_t const context); // clang-tidy NOLINT(readability-non-const-parameter);
277 
286 dwStatus dwContext_advanceTime(dwTime_t const newTime, dwContextHandle_t const context);
287 
302 dwStatus dwContext_selectGPUDevice(int32_t const deviceNumber, dwContextHandle_t const context);
303 
315 dwStatus dwContext_getGPUDeviceCurrent(int32_t* const deviceNumber, dwContextHandle_t const context);
316 
328 dwStatus dwContext_getGPUCount(int32_t* const count, dwContextHandle_t const context);
329 
345 dwStatus dwContext_getGPUProperties(cudaDeviceProp* const properties, int32_t const deviceNum,
346  dwContextHandle_t const context);
347 
365 dwStatus dwContext_getGPUAttribute(int32_t* const value, cudaDeviceAttr const attribute, int32_t const deviceNum,
366  dwContextHandle_t const context);
367 
379 dwStatus dwContext_getGPUArchitecture(char8_t const** const architecture, dwContextHandle_t const context);
380 
394 dwStatus dwContext_getCUDAProperties(int32_t* const driverVersion, int32_t* const apiVersion, dwContextHandle_t const context);
395 
409 dwStatus dwContext_getGPUDeviceType(dwGPUDeviceType* const deviceType, int32_t const deviceNum, dwContextHandle_t const context);
410 
411 #ifdef DW_USE_EGL
412 
429 dwStatus dwContext_setEGLDisplay(EGLDisplay display, dwContextHandle_t context);
430 
445 dwStatus dwContext_getEGLDisplay(EGLDisplay* display, dwContextHandle_t context);
446 #endif
447 
459 dwStatus dwContext_getDLAEngineCount(int32_t* const count, dwContextHandle_t const context);
460 
474 dwStatus dwContext_getDataPath(char8_t const** const dataPath, dwContextHandle_t const context);
475 
487 dwStatus dwContext_getUseVirtualTime(bool* const useVirtualTime, dwContextHandle_t const ctx);
488 
489 #ifdef __cplusplus
490 }
491 #endif
492 
493 #endif // DW_CORE_CONTEXT_H_
struct cudaDeviceProp cudaDeviceProp
Definition: Context.h:59
NVIDIA DriveWorks API: Core Types
DW_API_PUBLIC dwStatus dwContext_setCustomFileFunctions(dwContextHandle_t const context, dwCustomizedFileFunctions *const fileFunctionPtr)
Set the customized fileStream function pointers in context.
bool enablePVA
if true, PVA platform will be enabled.
Definition: Context.h:120
bool useVirtualTime
if true, the context&#39;s time source will be a virtual clock.
Definition: Context.h:131
DW_API_PUBLIC dwStatus dwContext_advanceTime(dwTime_t const newTime, dwContextHandle_t const context)
Advances the virtual time to newTime.
DW_API_PUBLIC dwStatus dwContext_getGPUCount(int32_t *const count, dwContextHandle_t const context)
Get the available GPU devices count.
enum cudaDeviceAttr cudaDeviceAttr
Definition: Context.h:60
struct dwModuleObject const * dwConstModuleHandle_t
Definition: Context.h:83
DW_API_PUBLIC dwStatus dwContext_getGPUProperties(cudaDeviceProp *const properties, int32_t const deviceNum, dwContextHandle_t const context)
Returns the properties for the specific CUDA device.
dwGPUDeviceType
GPU device type definitions.
Definition: Types.h:155
A set of parameters that is passed to the SDK to create the context.
Definition: Context.h:88
DW_API_PUBLIC dwStatus dwContext_getCUDAProperties(int32_t *const driverVersion, int32_t *const apiVersion, dwContextHandle_t const context)
Returns Driver and Runtime API version of CUDA on the current machine.
DW_API_PUBLIC dwStatus dwRelease(dwContextHandle_t const context)
Releases the context.
DW_API_PUBLIC dwStatus dwContext_getGPUDeviceCurrent(int32_t *const deviceNumber, dwContextHandle_t const context)
Returns the currently selected GPU device.
bool skipCudaInit
if true will skip CUDA initialization in the context
Definition: Context.h:112
DW_API_PUBLIC dwStatus dwContext_getUseVirtualTime(bool *const useVirtualTime, dwContextHandle_t const ctx)
Check if in virtual time mode.
struct dwModuleObject * dwModuleHandle_t
Definition: Context.h:82
enum cudaTextureAddressMode cudaTextureAddressMode
Definition: Context.h:61
DW_API_PUBLIC dwStatus dwContext_getDataPath(char8_t const **const dataPath, dwContextHandle_t const context)
Gets the initial data path of the library that contains the driveworks context.
dwStatus
Status definition.
Definition: Status.h:180
DW_API_PUBLIC dwStatus dwGetLastError(char8_t const **const errorMsg)
Retrieves the last error encountered.
DW_API_PUBLIC dwStatus dwContext_getCurrentTime(dwTime_t *const time, dwContextHandle_t const context)
Returns the current timestamp.
NVIDIA DriveWorks API: Core Version Information
int64_t dwTime_t
Specifies a timestamp unit, in microseconds.
Definition: Types.h:82
bool enableCudaTaskGraph
if true, Cuda task-graph will be used where possible.
Definition: Context.h:125
DW_API_PUBLIC dwStatus dwInitialize(dwContextHandle_t *const context, dwVersion const headerVersion, dwContextParameters const *const params)
Creates and initializes an SDK context.
DW_API_PUBLIC dwStatus dwContext_getGPUArchitecture(char8_t const **const architecture, dwContextHandle_t const context)
Returns the architecture for the currently selected CUDA device.
DW_API_PUBLIC dwStatus dwContext_selectGPUDevice(int32_t const deviceNumber, dwContextHandle_t const context)
Selects a GPU device, if available.
void * dwCustomizedFileHandle
FileStream function pointers handle.
Definition: Context.h:135
DW_API_PUBLIC dwStatus dwContext_isTimePTPSynchronized(bool *const flag, dwContextHandle_t const context)
Check if the used time source inside the context is synchronized over PTP.
DW_API_PUBLIC dwStatus dwContext_getDLAEngineCount(int32_t *const count, dwContextHandle_t const context)
Get the available DLA engines count.
struct dwContextObject * dwContextHandle_t
Context handle.
Definition: Context.h:79
char char8_t
Definition: Types.h:72
Data structure representing a customize FileStream that can be passed in.
Definition: Context.h:140
DW_API_PUBLIC dwStatus dwContext_getGPUAttribute(int32_t *const value, cudaDeviceAttr const attribute, int32_t const deviceNum, dwContextHandle_t const context)
Returns the value of the selected CUDA attribute for the specific CUDA device.
struct dwContextObject const * dwConstContextHandle_t
Definition: Context.h:80
void * EGLDisplay
Definition: EGL.h:58
#define DW_API_PUBLIC
Definition: Exports.h:54
void * EGLDisplay
Definition: Context.h:64
NVIDIA DriveWorks API: Core Status Methods
DW_API_PUBLIC dwStatus dwContext_getGPUDeviceType(dwGPUDeviceType *const deviceType, int32_t const deviceNum, dwContextHandle_t const context)
Returns the device type of the input GPU number.
NVIDIA DriveWorks API: Core Exports
const char8_t * dataPath
Path where all DriveWorks related data required during runtime are stored.
Definition: Context.h:106