Context#
APIs to create and manage cuPVA contexts.
Functions#
- cupvaError_t CupvaContextCreate(cupvaContext_t *const context, uint32_t const engineMask)
Create a new Context object.
- cupvaError_t CupvaContextDestroy(cupvaContext_t const context)
Destroy context.
- cupvaError_t CupvaContextGetCurrent(cupvaContext_t *const context)
Gets the pointer to the context instance used.
- cupvaError_t CupvaContextSetCurrent(cupvaContext_t const context)
Sets the context for the calling thread.
Typedefs#
- cupvaContext_t
Context holds all resources required by other CUPVA APIs.
Functions#
- cupvaError_t CupvaContextCreate(
- cupvaContext_t *const context,
- uint32_t const engineMask,
Create a new Context object.
The context automatically becomes current for the calling thread.
The context abstracts the PVA hardware. The current context is stored in thread-local storage. All CUPVA API calls are implicitly using the current context of the calling thread, and all CUPVA objects created are implicitly owned by the current context.
If a calling thread does not have a current context when an API call requiring a Context is made, a default context is used. The default Context is process-wide. The system has a limit on the number of Contexts created across all processes, which includes default Contexts. On currently supported platforms, this limit is 4. If the limit is exceeded, this API will fail with a DriverAPIError.
Usage considerations
Allowed context for the API call
Thread-safe: Yes
API group
Init: Yes
Runtime: No
De-Init: No
- Parameters:
context – [out] The pointer to return the newly allocated context object.
engineMask – [in] Bitmask indicating which engines to enable in the context.
- Returns:
cupvaError_t The completion status of the operation. Possible values are:
CUPVA_ERROR_NONE if the operation was successful.
CUPVA_INVALID_ARGUMENT if context is a NULL pointer.
CUPVA_DRIVER_API_ERROR if the PVA driver returned an unexpected error.
CUPVA_INTERNAL_ERROR if it failed to initialize internal state
CUPVA_NOT_ALLOWED_IN_OPERATIONAL_STATE if called when NVIDIA DRIVE OS VM state is “Operational”
-
cupvaError_t CupvaContextDestroy(cupvaContext_t const context)#
Destroy context.
Usage considerations
Allowed context for the API call
Thread-safe: No
API group
Init: No
Runtime: No
De-Init: Yes
- Parameters:
context – [in] The pointer to the Context object.
- Returns:
cupvaError_t The completion status of the operation. Possible values are:
CUPVA_ERROR_NONE if the operation was successful.
CUPVA_INVALID_ARGUMENT if context is a NULL pointer.
CUPVA_DRIVER_API_ERROR if The PVA driver returned an unexpected error.
CUPVA_NOT_ALLOWED_IN_OPERATIONAL_STATE if called when NVIDIA DRIVE OS VM state is “Operational”
-
cupvaError_t CupvaContextGetCurrent(cupvaContext_t *const context)#
Gets the pointer to the context instance used.
The context abstracts the PVA hardware. The current context is stored in thread-local storage. All CUPVA API calls are implicitly using the current context of the calling thread, and all CUPVA objects created are implicitly owned by the current context.
Usage considerations
Allowed context for the API call
Thread-safe: Yes
API group
Init: No
Runtime: Yes
De-Init: No
- Parameters:
context – [out] The pointer to return the context instance used by calling thread.
- Returns:
cupvaError_t The completion status of the operation. Possible values are:
CUPVA_ERROR_NONE if the operation was successful.
CUPVA_INVALID_ARGUMENT if context is a NULL pointer.
-
cupvaError_t CupvaContextSetCurrent(cupvaContext_t const context)#
Sets the context for the calling thread.
The context abstracts the PVA hardware. The current context is stored in thread-local storage. All CUPVA API calls are implicitly using the current context of the calling thread, and all CUPVA objects created are implicitly owned by the current context.
Usage considerations
Allowed context for the API call
Thread-safe: Yes
API group
Init: No
Runtime: Yes
De-Init: No
- Parameters:
context – [in] A pointer to the context instance which current for the calling thread. Passing null causes the thread to use the default application context.
Typedefs#
-
typedef struct cupvaContextRec *cupvaContext_t#
Context holds all resources required by other CUPVA APIs.