set_compute_device_paramT_set_compute_device_paramSetComputeDeviceParamSetComputeDeviceParamset_compute_device_param (算子)

名称

set_compute_device_paramT_set_compute_device_paramSetComputeDeviceParamSetComputeDeviceParamset_compute_device_param — 设置计算设备的参数。

签名

set_compute_device_param( : : DeviceHandle, GenParamName, GenParamValue : )

Herror T_set_compute_device_param(const Htuple DeviceHandle, const Htuple GenParamName, const Htuple GenParamValue)

void SetComputeDeviceParam(const HTuple& DeviceHandle, const HTuple& GenParamName, const HTuple& GenParamValue)

void HComputeDevice::SetComputeDeviceParam(const HString& GenParamName, const HTuple& GenParamValue) const

void HComputeDevice::SetComputeDeviceParam(const HString& GenParamName, const HString& GenParamValue) const

void HComputeDevice::SetComputeDeviceParam(const char* GenParamName, const char* GenParamValue) const

void HComputeDevice::SetComputeDeviceParam(const wchar_t* GenParamName, const wchar_t* GenParamValue) const   ( Windows only)

static void HOperatorSet.SetComputeDeviceParam(HTuple deviceHandle, HTuple genParamName, HTuple genParamValue)

void HComputeDevice.SetComputeDeviceParam(string genParamName, HTuple genParamValue)

void HComputeDevice.SetComputeDeviceParam(string genParamName, string genParamValue)

def set_compute_device_param(device_handle: HHandle, gen_param_name: str, gen_param_value: MaybeSequence[Union[str, int, float]]) -> None

描述

set_compute_device_paramset_compute_device_paramSetComputeDeviceParamSetComputeDeviceParamSetComputeDeviceParamset_compute_device_param sets parameters of the compute device DeviceHandleDeviceHandleDeviceHandleDeviceHandledeviceHandledevice_handle for the current HALCON thread.

The following parameters can be set:

'alloc_pinned'"alloc_pinned""alloc_pinned""alloc_pinned""alloc_pinned""alloc_pinned"

If 'true'"true""true""true""true""true", the output image matrices of all operators (executed on the compute device or not) called in the current HALCON thread are created in page locked (so called 'pinned') memory. This accelerates the transfer between host and device memory. However, too excessive usage of page locked memory may have a negative impact on overall system performance. You should activate page locked memory allocation if the output image of of the next operator call is to be transferred to the device. Page locked memory allocation should be deactivated for all operator calls whose output images are not required on the compute device (see example).

值列表: 'true'"true""true""true""true""true", 'false'"false""false""false""false""false".

默认值: 'true'"true""true""true""true""true".

'asynchronous_execution'"asynchronous_execution""asynchronous_execution""asynchronous_execution""asynchronous_execution""asynchronous_execution"

If 'true'"true""true""true""true""true", operators executed on the compute device do not wait for the device computations to finish but return after initiating the computations. All device computations are synchronized as soon as the output of a compute device operation is used on the CPU (e.g., by disp_imagedisp_imageDispImageDispImageDispImagedisp_image).

值列表: 'true'"true""true""true""true""true", 'false'"false""false""false""false""false".

默认值: 'true'"true""true""true""true""true".

'buffer_cache_capacity'"buffer_cache_capacity""buffer_cache_capacity""buffer_cache_capacity""buffer_cache_capacity""buffer_cache_capacity"

Maximum size (in bytes) of the compute device buffer cache.

默认值: 1/3 of the available device memory

'image_cache_capacity'"image_cache_capacity""image_cache_capacity""image_cache_capacity""image_cache_capacity""image_cache_capacity"

Maximum size (in bytes) of the compute device image cache.

默认值: 1/3 of the available device memory

'pinned_mem_cache_capacity'"pinned_mem_cache_capacity""pinned_mem_cache_capacity""pinned_mem_cache_capacity""pinned_mem_cache_capacity""pinned_mem_cache_capacity"

Maximum size (in bytes) of the page locked (pinned) memory cache.

默认值: 32000000 (32MByte)

执行信息

参数

DeviceHandleDeviceHandleDeviceHandleDeviceHandledeviceHandledevice_handle (输入控制)  compute_device HComputeDevice, HTupleHHandleHTupleHtuple (handle) (IntPtr) (HHandle) (handle)

计算设备句柄。

GenParamNameGenParamNameGenParamNameGenParamNamegenParamNamegen_param_name (输入控制)  string HTuplestrHTupleHtuple (string) (string) (HString) (char*)

Name of the parameter to set.

默认值: 'buffer_cache_capacity' "buffer_cache_capacity" "buffer_cache_capacity" "buffer_cache_capacity" "buffer_cache_capacity" "buffer_cache_capacity"

值列表: 'alloc_pinned'"alloc_pinned""alloc_pinned""alloc_pinned""alloc_pinned""alloc_pinned", 'asynchronous_execution'"asynchronous_execution""asynchronous_execution""asynchronous_execution""asynchronous_execution""asynchronous_execution", 'buffer_cache_capacity'"buffer_cache_capacity""buffer_cache_capacity""buffer_cache_capacity""buffer_cache_capacity""buffer_cache_capacity", 'image_cache_capacity'"image_cache_capacity""image_cache_capacity""image_cache_capacity""image_cache_capacity""image_cache_capacity", 'pinned_mem_cache_capacity'"pinned_mem_cache_capacity""pinned_mem_cache_capacity""pinned_mem_cache_capacity""pinned_mem_cache_capacity""pinned_mem_cache_capacity"

GenParamValueGenParamValueGenParamValueGenParamValuegenParamValuegen_param_value (输入控制)  string(-array) HTupleMaybeSequence[Union[str, int, float]]HTupleHtuple (string / integer / real) (string / int / long / double) (HString / Hlong / double) (char* / Hlong / double)

New parameter value.

示例(HDevelop)

activate_compute_device (DeviceHandle)
read_image (Image, 'fuse')
set_compute_device_param (DeviceHandle, 'alloc_pinned', 'true')
* filter on compute device, output image is page locked
derivate_gauss (Image, DerivGauss, 3, 'gradient')
* filter result on the CPU, output image should not be page locked
set_compute_device_param (DeviceHandle, 'alloc_pinned', 'false')
median_image (DerivGauss, ImageMedian, 'circle', 1, 'mirrored')

结果

算子 set_compute_device_paramset_compute_device_paramSetComputeDeviceParamSetComputeDeviceParamSetComputeDeviceParamset_compute_device_param 在参数正确时返回值 2 ( H_MSG_TRUE )。否则将抛出异常。

可能的前趋

activate_compute_deviceactivate_compute_deviceActivateComputeDeviceActivateComputeDeviceActivateComputeDeviceactivate_compute_device

另见

get_compute_device_paramget_compute_device_paramGetComputeDeviceParamGetComputeDeviceParamGetComputeDeviceParamget_compute_device_param

模块

基础