DriveWorks SDK Reference
3.5.78 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-2020 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 
47 #ifndef DW_CORE_CONTEXT_H_
48 #define DW_CORE_CONTEXT_H_
49 
50 #include <dw/core/Config.h>
51 #include <dw/core/Exports.h>
52 #include <dw/core/Types.h>
53 #include <dw/core/Version.h>
54 #include <dw/core/Status.h>
55 #include <cuda_runtime_api.h>
56 
57 // typdefs for CUDA structs
61 
62 // Forward declares from EGL
63 typedef void* EGLDisplay;
64 
65 #ifdef __cplusplus
66 extern "C" {
67 #endif
68 
79 typedef struct dwContextObject* dwContextHandle_t;
81 typedef struct dwContextObject const* dwConstContextHandle_t;
82 
86 typedef struct dwContextParameters
87 {
88 
89 #ifdef DW_USE_EGL
90  EGLDisplay eglDisplay;
92 
97  bool skipEglInit;
98 #endif
99 
105 
111 
118  bool enablePVA;
119 
125 
128 
133 {
134  void (*close)(dwCustomizedFileHandle);
135  size_t (*write)(dwCustomizedFileHandle, const void*, size_t);
136  size_t (*read)(dwCustomizedFileHandle, void*, size_t);
137  bool (*getString)(dwCustomizedFileHandle, char8_t*, size_t);
138  size_t (*size)(dwCustomizedFileHandle);
139  size_t (*getPosition)(dwCustomizedFileHandle);
140  void (*setPosition)(dwCustomizedFileHandle, size_t);
142  bool (*error)(dwCustomizedFileHandle);
143  void (*flush)(dwCustomizedFileHandle);
144  dwCustomizedFileHandle (*open)(const char8_t*, const char8_t*);
145 
147 
159 dwStatus dwContext_setCustomFileFunctions(dwContextHandle_t context, dwCustomizedFileFunctions* fileFunctionPtr);
160 
176 dwStatus dwGetLastError(const char8_t** errorMsg);
177 
195 dwStatus dwInitialize(dwContextHandle_t* context, dwVersion header_version, const dwContextParameters* params);
196 
210 dwStatus dwRelease(dwContextHandle_t context);
211 
227 dwStatus dwContext_getCurrentTime(dwTime_t* time, dwContextHandle_t context);
228 
251 dwStatus dwContext_isTimePTPSynchronized(bool* flag, dwContextHandle_t context);
252 
265 dwStatus dwContext_selectGPUDevice(int32_t deviceNumber, dwContextHandle_t context);
266 
277 dwStatus dwContext_getGPUDeviceCurrent(int32_t* deviceNumber, dwContextHandle_t context);
278 
289 dwStatus dwContext_getGPUCount(int32_t* count, dwContextHandle_t context);
290 
304 dwStatus dwContext_getGPUProperties(cudaDeviceProp* properties, int32_t deviceNum,
305  dwContextHandle_t context);
306 
322 dwStatus dwContext_getGPUAttribute(int32_t* value, cudaDeviceAttr attribute, int32_t deviceNum,
323  dwContextHandle_t context);
324 
335 dwStatus dwContext_getGPUArchitecture(const char8_t** architecture, dwContextHandle_t context);
336 
349 dwStatus dwContext_getCUDAProperties(int32_t* driverVersion, int32_t* apiVersion, dwContextHandle_t context);
350 
362 dwStatus dwContext_getGPUDeviceType(dwGPUDeviceType* deviceType, int32_t deviceNum, dwContextHandle_t context);
363 
364 #ifdef DW_USE_EGL
365 
379 dwStatus dwContext_setEGLDisplay(EGLDisplay display, dwContextHandle_t context);
380 
394 dwStatus dwContext_getEGLDisplay(EGLDisplay* display, dwContextHandle_t context);
395 #endif
396 
407 dwStatus dwContext_getDLAEngineCount(int32_t* count, dwContextHandle_t context);
408 
419 dwStatus dwContext_getPVAEngineCount(uint32_t* count, dwContextHandle_t context);
420 
431 dwStatus dwContext_getDataPath(const char8_t** dataPath, dwContextHandle_t context);
432 
433 #ifdef __cplusplus
434 }
435 #endif
436 
437 #endif // DW_CORE_CONTEXT_H_
bool enablePVA
if true, PVA platform will be enabled.
Definition: Context.h:118
DW_API_PUBLIC dwStatus dwInitialize(dwContextHandle_t *context, dwVersion header_version, const dwContextParameters *params)
Creates and initializes an SDK context.
NVIDIA DriveWorks API: Core Types
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:86
DW_API_PUBLIC dwStatus dwContext_getDLAEngineCount(int32_t *count, dwContextHandle_t context)
Get the available DLA engines count.
enum cudaDeviceAttr cudaDeviceAttr
Definition: Context.h:59
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:110
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.
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:178
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:123
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.
enum cudaTextureAddressMode cudaTextureAddressMode
Definition: Context.h:60
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:127
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:80
char char8_t
Definition: Types.h:72
Data structure representing a customize FileStream that can be passed in.
Definition: Context.h:132
NVIDIA DriveWorks API: Core Exports
void * EGLDisplay
Definition: Context.h:63
struct dwContextObject const * dwConstContextHandle_t
Definition: Context.h:81
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:56
NVIDIA DriveWorks API: Core Status Methods
struct cudaDeviceProp cudaDeviceProp
Definition: Context.h:58
const char8_t * dataPath
Path where all DriveWorks related data required during runtime are stored.
Definition: Context.h:104