VisionWorks Toolkit Reference

December 18, 2015 | 1.2 Release

 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Resource Control

Detailed Description

Gives more control to the application of resources usage.

Compute Resource Used by Primitives

The application can control the target device type that will be used to execute primitives in the different execution modes:

Graph Mode Example Code
vx_graph graph = vxCreateGraph(context);
// create images
vx_image images[] = {
vxCreateImage(context, width, height, VX_DF_IMAGE_U8), // 0: input
vxCreateImage(context, width, height, VX_DF_IMAGE_U8), // 1: input
vxCreateImage(context, width, height, VX_DF_IMAGE_U8), // 2: output
vxCreateImage(context, width, height, VX_DF_IMAGE_U8), // 3: output
};
// create graph
vx_node nodes[] = {
vxAddNode(graph, images[0], images[1], VX_CONVERT_POLICY_SATURATE, images[2]),
vxSubtractNode(graph, images[0], images[1], VX_CONVERT_POLICY_SATURATE, images[3])
};
// assign nodes
// run graph
Immediate Mode Example Code
// create images
vx_image images[] = {
vxCreateImage(context, width, height, VX_DF_IMAGE_U8), // 0: input
vxCreateImage(context, width, height, VX_DF_IMAGE_U8), // 1: input
vxCreateImage(context, width, height, VX_DF_IMAGE_U8), // 2: output
vxCreateImage(context, width, height, VX_DF_IMAGE_U8), // 3: output
};
// run immediate processing
vx_enum immediate_target = NVX_DEVICE_CPU;
vxSetContextAttribute(context, NVX_CONTEXT_ATTRIBUTE_IMMEDIATE_TARGET_DEVICE, &immediate_target, sizeof(immediate_target));
vxuAdd(context, images[0], images[1], VX_CONVERT_POLICY_SATURATE, images[2]);
immediate_target = NVX_DEVICE_GPU;
vxSetContextAttribute(context, NVX_CONTEXT_ATTRIBUTE_IMMEDIATE_TARGET_DEVICE, &immediate_target, sizeof(immediate_target));
vxuSubtract(context, images[0], images[1], VX_CONVERT_POLICY_SATURATE, images[2]);

Enumerations

enum  nvx_device_type_e {
  NVX_DEVICE_ANY = 0x0,
  NVX_DEVICE_CPU = 0x1,
  NVX_DEVICE_GPU = 0x2
}
 Defines types of devices that can execute vision functions. More...
 

Functions

vx_status nvxSetNodeTargetDevice (vx_node node, vx_enum device)
 Sets the target device type for the node. More...
 

Enumeration Type Documentation

Defines types of devices that can execute vision functions.

Enumerator
NVX_DEVICE_ANY 

Any device.

NVX_DEVICE_CPU 

CPU device.

NVX_DEVICE_GPU 

GPU device.

Definition at line 430 of file nvx.h.

Function Documentation

vx_status nvxSetNodeTargetDevice ( vx_node  node,
vx_enum  device 
)

Sets the target device type for the node.

With this function, the application can control on which device type the node is executed. In case the given device type is not supported by the node, the fuction returns an error and the function call has no effect on the node.

Parameters
[in]nodeThe node reference to which to assign affinity.
[in]deviceThe device type on which to execute the node.
Returns
A vx_status enumerator.
Return values
VX_SUCCESSNo errors.
VX_ERROR_INVALID_REFERENCEThe node was not a valid reference.
VX_ERROR_NOT_SUPPORTEDThe node cannot be executed on that device type.