DriveWorks SDK Reference
4.0.0 Release
For Test and Development only

Context.h
Go to the documentation of this file.
1 // This code contains NVIDIA Confidential Information and is disclosed
3 // under the Mutual Non-Disclosure Agreement.
4 //
5 // Notice
6 // ALL NVIDIA DESIGN SPECIFICATIONS AND CODE ("MATERIALS") ARE PROVIDED "AS IS" NVIDIA MAKES
7 // NO REPRESENTATIONS, WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
8 // THE MATERIALS, AND EXPRESSLY DISCLAIMS ANY IMPLIED WARRANTIES OF NONINFRINGEMENT,
9 // MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
10 //
11 // NVIDIA Corporation assumes no responsibility for the consequences of use of such
12 // information or for any infringement of patents or other rights of third parties that may
13 // result from its use. No license is granted by implication or otherwise under any patent
14 // or patent rights of NVIDIA Corporation. No third party distribution is allowed unless
15 // expressly authorized by NVIDIA. Details are subject to change without notice.
16 // This code supersedes and replaces all information previously supplied.
17 // NVIDIA Corporation products are not authorized for use as critical
18 // components in life support devices or systems without express written approval of
19 // NVIDIA Corporation.
20 //
21 // Copyright (c) 2016-2021 NVIDIA Corporation. All rights reserved.
22 //
23 // NVIDIA Corporation and its licensors retain all intellectual property and proprietary
24 // rights in and to this software and related documentation and any modifications thereto.
25 // Any use, reproduction, disclosure or distribution of this software and related
26 // documentation without an express license agreement from NVIDIA Corporation is
27 // 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 
85 typedef struct dwContextParameters
86 {
87 
88 #ifdef DW_USE_EGL
89  EGLDisplay eglDisplay;
91 
96  bool skipEglInit;
97 #endif
98 
104 
110 
117  bool enablePVA;
118 
123 
130 
133 
138 {
139  void (*close)(dwCustomizedFileHandle hnd);
140  size_t (*write)(dwCustomizedFileHandle hnd, const void* ptr, size_t size);
141  size_t (*read)(dwCustomizedFileHandle hnd, void* ptr, size_t size);
142  bool (*getString)(dwCustomizedFileHandle hnd, char8_t* ptr, size_t size);
143  size_t (*size)(dwCustomizedFileHandle hnd);
144  size_t (*getPosition)(dwCustomizedFileHandle hnd);
145  void (*setPosition)(dwCustomizedFileHandle hnd, size_t size);
146  bool (*eof)(dwCustomizedFileHandle hnd);
147  bool (*error)(dwCustomizedFileHandle hnd);
148  void (*flush)(dwCustomizedFileHandle hnd);
149  dwCustomizedFileHandle (*open)(const char8_t* ptr1, const char8_t* ptr2);
150 
152 
165 dwStatus dwContext_setCustomFileFunctions(dwContextHandle_t context, dwCustomizedFileFunctions* fileFunctionPtr);
166 
182 dwStatus dwGetLastError(const char8_t** errorMsg);
183 
215 dwStatus dwInitialize(dwContextHandle_t* context, dwVersion header_version, const dwContextParameters* params);
216 
230 dwStatus dwRelease(dwContextHandle_t context);
231 
248 dwStatus dwContext_getCurrentTime(dwTime_t* time, dwContextHandle_t context);
249 
273 dwStatus dwContext_isTimePTPSynchronized(bool* flag, dwContextHandle_t context);
274 
283 dwStatus dwContext_advanceTime(dwTime_t newTime, dwContextHandle_t context);
284 
299 dwStatus dwContext_selectGPUDevice(int32_t deviceNumber, dwContextHandle_t context);
300 
312 dwStatus dwContext_getGPUDeviceCurrent(int32_t* deviceNumber, dwContextHandle_t context);
313 
325 dwStatus dwContext_getGPUCount(int32_t* count, dwContextHandle_t context);
326 
342 dwStatus dwContext_getGPUProperties(cudaDeviceProp* properties, int32_t deviceNum,
343  dwContextHandle_t context);
344 
362 dwStatus dwContext_getGPUAttribute(int32_t* value, cudaDeviceAttr attribute, int32_t deviceNum,
363  dwContextHandle_t context);
364 
376 dwStatus dwContext_getGPUArchitecture(const char8_t** architecture, dwContextHandle_t context);
377 
391 dwStatus dwContext_getCUDAProperties(int32_t* driverVersion, int32_t* apiVersion, dwContextHandle_t context);
392 
406 dwStatus dwContext_getGPUDeviceType(dwGPUDeviceType* deviceType, int32_t deviceNum, dwContextHandle_t context);
407 
408 #ifdef DW_USE_EGL
409 
426 dwStatus dwContext_setEGLDisplay(EGLDisplay display, dwContextHandle_t context);
427 
442 dwStatus dwContext_getEGLDisplay(EGLDisplay* display, dwContextHandle_t context);
443 #endif
444 
456 dwStatus dwContext_getDLAEngineCount(int32_t* count, dwContextHandle_t context);
457 
469 dwStatus dwContext_getPVAEngineCount(uint32_t* count, dwContextHandle_t context);
470 
482 dwStatus dwContext_getDataPath(const char8_t** dataPath, dwContextHandle_t context);
483 
495 dwStatus dwContext_getUseVirtualTime(bool* useVirtualTime, dwContextHandle_t context);
496 
497 #ifdef __cplusplus
498 }
499 #endif
500 
501 #endif // DW_CORE_CONTEXT_H_
struct cudaDeviceProp cudaDeviceProp
Definition: Context.h:59
NVIDIA DriveWorks API: Core Types
DW_API_PUBLIC dwStatus dwContext_getUseVirtualTime(bool *useVirtualTime, dwContextHandle_t context)
Check if in virtual time mode.
bool enablePVA
if true, PVA platform will be enabled.
Definition: Context.h:117
DW_API_PUBLIC dwStatus dwInitialize(dwContextHandle_t *context, dwVersion header_version, const dwContextParameters *params)
Creates and initializes an SDK context.
bool useVirtualTime
if true, the context&#39;s time source will be a virtual clock.
Definition: Context.h:128
enum cudaDeviceAttr cudaDeviceAttr
Definition: Context.h:60
DW_API_PUBLIC dwStatus dwContext_getPVAEngineCount(uint32_t *count, dwContextHandle_t context)
Get the available PVA engines count.
dwGPUDeviceType
GPU device type definitions.
Definition: Types.h:153
A set of parameters that is passed to the SDK to create the context.
Definition: Context.h:85
DW_API_PUBLIC dwStatus dwContext_getDLAEngineCount(int32_t *count, dwContextHandle_t context)
Get the available DLA engines count.
DW_API_PUBLIC dwStatus dwContext_getGPUDeviceType(dwGPUDeviceType *deviceType, int32_t deviceNum, dwContextHandle_t context)
Returns the device type of the input GPU number.
DW_API_PUBLIC dwStatus dwRelease(dwContextHandle_t context)
Releases the context.
DW_API_PUBLIC dwStatus dwContext_getCurrentTime(dwTime_t *time, dwContextHandle_t context)
Returns the current timestamp.
bool skipCudaInit
if true will skip CUDA initialization in the context
Definition: Context.h:109
DW_API_PUBLIC dwStatus dwContext_getDataPath(const char8_t **dataPath, dwContextHandle_t context)
Gets the data path of the library that contains the driveworks context.
DW_API_PUBLIC dwStatus dwContext_getGPUAttribute(int32_t *value, cudaDeviceAttr attribute, int32_t deviceNum, dwContextHandle_t context)
Returns the value of the selected CUDA attribute for the specific CUDA device.
enum cudaTextureAddressMode cudaTextureAddressMode
Definition: Context.h:61
DW_API_PUBLIC dwStatus dwContext_getCUDAProperties(int32_t *driverVersion, int32_t *apiVersion, dwContextHandle_t context)
Returns Driver and Runtime API version of CUDA on the current machine.
dwStatus
Status definition.
Definition: Status.h:180
DW_API_PUBLIC dwStatus dwGetLastError(const char8_t **errorMsg)
Retrieves the last error encountered.
NVIDIA DriveWorks API: Core Version Information
int64_t dwTime_t
Specifies a timestamp unit, in microseconds.
Definition: Types.h:82
DW_API_PUBLIC dwStatus dwContext_selectGPUDevice(int32_t deviceNumber, dwContextHandle_t context)
Selects a GPU device, if available.
bool enableCudaTaskGraph
if true, Cuda task-graph will be used where possible.
Definition: Context.h:122
DW_API_PUBLIC dwStatus dwContext_isTimePTPSynchronized(bool *flag, dwContextHandle_t context)
Check if the used time source inside the context is synchronized over PTP.
DW_API_PUBLIC dwStatus dwContext_setCustomFileFunctions(dwContextHandle_t context, dwCustomizedFileFunctions *fileFunctionPtr)
Set the customized fileStream function pointers in context.
DW_API_PUBLIC dwStatus dwContext_getGPUArchitecture(const char8_t **architecture, dwContextHandle_t context)
Returns the architecture for the currently selected CUDA device.
DW_API_PUBLIC dwStatus dwContext_getGPUDeviceCurrent(int32_t *deviceNumber, dwContextHandle_t context)
Returns the currently selected GPU device.
void * dwCustomizedFileHandle
FileStream function pointers handle.
Definition: Context.h:132
DW_API_PUBLIC dwStatus dwContext_advanceTime(dwTime_t newTime, dwContextHandle_t context)
Advances the virtual time to newTime.
DW_API_PUBLIC dwStatus dwContext_getGPUProperties(cudaDeviceProp *properties, int32_t deviceNum, dwContextHandle_t context)
Returns the properties for the specific CUDA device.
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:137
struct dwContextObject const * dwConstContextHandle_t
Definition: Context.h:80
DW_API_PUBLIC dwStatus dwContext_getGPUCount(int32_t *count, dwContextHandle_t context)
Get the available GPU devices count.
#define DW_API_PUBLIC
Definition: Exports.h:54
void * EGLDisplay
Definition: Context.h:64
NVIDIA DriveWorks API: Core Status Methods
NVIDIA DriveWorks API: Core Exports
const char8_t * dataPath
Path where all DriveWorks related data required during runtime are stored.
Definition: Context.h:103