DriveWorks SDK Reference
3.0.4260 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-2019 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 
104  const char* dataPath;
105 
111 
112 #ifdef VIBRANTE
113 
118  bool enablePVA;
119 #endif
120 
126 
129 
134 {
135  void (*close)(dwCustomizedFileHandle);
136  size_t (*write)(dwCustomizedFileHandle, const void*, size_t);
137  size_t (*read)(dwCustomizedFileHandle, void*, size_t);
138  bool (*getString)(dwCustomizedFileHandle, char*, size_t);
139  size_t (*size)(dwCustomizedFileHandle);
140  size_t (*getPosition)(dwCustomizedFileHandle);
141  void (*setPosition)(dwCustomizedFileHandle, size_t);
143  bool (*error)(dwCustomizedFileHandle);
144  void (*flush)(dwCustomizedFileHandle);
145  dwCustomizedFileHandle (*open)(const char*, const char*);
146 
148 
160 dwStatus dwContext_setCustomFileFunctions(dwContextHandle_t context, dwCustomizedFileFunctions* fileFunctionPtr);
161 
177 dwStatus dwGetLastError(const char** errorMsg);
178 
196 dwStatus dwInitialize(dwContextHandle_t* context, dwVersion header_version, const dwContextParameters* params);
197 
211 dwStatus dwRelease(dwContextHandle_t context);
212 
226 dwStatus dwContext_getCurrentTime(dwTime_t* time, dwContextHandle_t context);
227 
250 dwStatus dwContext_isTimePTPSynchronized(bool* flag, dwContextHandle_t context);
251 
264 dwStatus dwContext_selectGPUDevice(int32_t deviceNumber, dwContextHandle_t context);
265 
276 dwStatus dwContext_getGPUDeviceCurrent(int32_t* deviceNumber, dwContextHandle_t context);
277 
288 dwStatus dwContext_getGPUCount(int32_t* count, dwContextHandle_t context);
289 
303 dwStatus dwContext_getGPUProperties(cudaDeviceProp* properties, int32_t deviceNum,
304  dwContextHandle_t context);
305 
321 dwStatus dwContext_getGPUAttribute(int32_t* value, cudaDeviceAttr attribute, int32_t deviceNum,
322  dwContextHandle_t context);
323 
334 dwStatus dwContext_getGPUArchitecture(const char** architecture, dwContextHandle_t context);
335 
348 dwStatus dwContext_getCUDAProperties(int32_t* driverVersion, int32_t* apiVersion, dwContextHandle_t context);
349 
361 dwStatus dwContext_getGPUDeviceType(dwGPUDeviceType* deviceType, int32_t deviceNum, dwContextHandle_t context);
362 
363 #ifdef DW_USE_EGL
364 
378 dwStatus dwContext_setEGLDisplay(EGLDisplay display, dwContextHandle_t context);
379 
393 dwStatus dwContext_getEGLDisplay(EGLDisplay* display, dwContextHandle_t context);
394 #endif
395 
406 dwStatus dwContext_getDLAEngineCount(int32_t* count, dwContextHandle_t context);
407 
418 dwStatus dwContext_getPVAEngineCount(uint32_t* count, dwContextHandle_t context);
419 
430 dwStatus dwContext_getDataPath(const char** dataPath, dwContextHandle_t context);
431 
432 #ifdef __cplusplus
433 }
434 #endif
435 
436 #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_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:166
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:124
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 dwGetLastError(const char **errorMsg)
Retrieves the last error encountered.
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_getGPUDeviceCurrent(int32_t *deviceNumber, dwContextHandle_t context)
Returns the currently selected GPU device.
void * dwCustomizedFileHandle
FileStream function pointers handle.
Definition: Context.h:128
DW_API_PUBLIC dwStatus dwContext_getGPUArchitecture(const char **architecture, dwContextHandle_t context)
Returns the architecture for the currently selected CUDA device.
const char * dataPath
Path where all DriveWorks related data required during runtime are stored.
Definition: Context.h:104
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
Data structure representing a customize FileStream that can be passed in.
Definition: Context.h:133
DW_API_PUBLIC dwStatus dwContext_getDataPath(const char **dataPath, dwContextHandle_t context)
Gets the data path of the library that contains the driveworks context.
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