Skip to content

activate_compute_deviceActivateComputeDeviceActivateComputeDeviceactivate_compute_deviceT_activate_compute_device🔗

Short description🔗

activate_compute_deviceActivateComputeDeviceActivateComputeDeviceactivate_compute_deviceT_activate_compute_device — Activate a compute device.

Signature🔗

activate_compute_device( compute_device DeviceHandle )void ActivateComputeDevice( const HTuple& DeviceHandle )static void HOperatorSet.ActivateComputeDevice( HTuple deviceHandle )def activate_compute_device( device_handle: HHandle ) -> None

Herror T_activate_compute_device( const Htuple DeviceHandle )

void HComputeDevice::ActivateComputeDevice( ) const

void HComputeDevice.ActivateComputeDevice( )

Description🔗

activate_compute_deviceActivateComputeDevice activates the compute device DeviceHandledeviceHandledevice_handle for the current HALCON thread. All subsequent HALCON operators called in this thread are executed on DeviceHandledeviceHandledevice_handle if they provide an implementation (see get_operator_infoGetOperatorInfo) for this device. Use deactivate_compute_deviceDeactivateComputeDevice to deactivate DeviceHandledeviceHandledevice_handle.

Currently, only one compute device can be active for a HALCON thread. If a different device is active before activate_compute_deviceActivateComputeDevice is called, this device is deactivated automatically.

Execution information🔗

Execution information
  • Multithreading type: reentrant (runs in parallel with non-exclusive operators).

  • Multithreading scope: local (may only be called from the same thread in which the window, model, or tool instance was created).

  • Processed without parallelization.

Parameters🔗

DeviceHandledeviceHandledevice_handle (input_control) compute_device → (handle)HTuple (HHandle)HComputeDevice, HTuple (IntPtr)HHandleHtuple (handle)

Compute device handle.

Example🔗

(HDevelop)

open_compute_device (DeviceIdentifier, DeviceHandle)
read_image (Image, 'rings_and_nuts')
*
* Gaussian convolution on a compute device
activate_compute_device (DeviceHandle)
derivate_gauss (Image, DerivGauss, 5, 'none')
*
* Gaussian convolution on the CPU
deactivate_compute_device (DeviceHandle)
derivate_gauss (Image, DerivGauss, 5, 'none')

Result🔗

activate_compute_deviceActivateComputeDevice returns the value 2 (H_MSG_TRUE) if DeviceHandledeviceHandledevice_handle is valid. Otherwise an exception will be raised.

Combinations with other operators🔗

Combinations

Possible predecessors

open_compute_deviceOpenComputeDevice

See also

deactivate_compute_deviceDeactivateComputeDevice, deactivate_all_compute_devicesDeactivateAllComputeDevices

Module🔗

Foundation