Skip to content

Automatic parallelizationđź”—

If HALCON is used on multi-processor or multi-core hardware, it automatically parallelizes image processing operators. This feature is called automatic operator parallelization (AOP).
Initializing HALCON describes how to use this mechanism.
Methods of automatic parallelization explains the different methods used by HALCON operators for their automatic parallelization.

Initializing HALCONđź”—

To adapt the parallelization mechanism optimally to the actual hardware, HALCON needs to examine this hardware once. Afterwards, HALCON programs will be parallelized automatically without needing any further action on your part. Even existing HALCON programs will run and be parallelized without needing to be changed.

To trigger this initial examination, call the operator optimize_aop.

Note

  • The examination can take some hours, depending on your computer and the optimization parameters.
  • This operator only works correctly if called on a multi-core or multi-processor hardware. If you call the operator on a single-processor or single-core computer, it returns an error message.
  • On some operating systems, you need special privileges to initialize HALCON successfully. Otherwise, optimize_aop is not able to store the extracted information.

As a shortcut, you can call the executable hcheck_parallel from the directory %HALCONROOT%\bin\%HALCONARCH%.

Upon calling optimize_aop, HALCON examines every operator that potentially can be sped up by an automatic parallelization. Each examined operator is processed several times – both sequentially and in parallel – with a changing set of input parameter values, for example, images. The latter helps to evaluate dependencies between an operator’s input parameter characteristics (for example, the size of an input image) and the efficiency of its parallel processing.

The extracted information is stored in the file .aop_info in the common application data folder.

Note

To execute command-line tools with administrator privileges, you need to select “Run as Administrator” (even if you are already logged in as administrator).

More Info

See the examples in the directory %HALCONEXAMPLES%\hdevelop\System\Parallelization for more information about optimize_aop and about other operators that allow you to query and modify the parallelization information.

The extracted information is stored in the file .aop_info in the HALCON installation directory $HALCONROOT.

More Info

See the examples in the directory %HALCONEXAMPLES%/hdevelop/System/Parallelization for more information about optimize_aop and about other operators that allow you to query and modify the parallelization information.

Methods of automatic parallelizationđź”—

For the automatic parallelization of operators, HALCON exploits data parallelism, meaning: Parts of the input data of an operator can be processed independently of each other.

Data parallelism can be found at four levels:

  1. Tuple level
    If an operator is called with iconic input parameters containing tuples, that is, arrays of images, regions, or XLDs, it can be parallelized by distributing the tuple elements, that is, the individual images, regions, or XLDs, on parallel threads.
    This method requires that all input parameters contain the same number of tuple elements (or contain a single iconic object or value).

  2. Channel level
    If an operator is called with input images containing multiple channels, it can be parallelized by distributing the channels on parallel threads.
    This method requires that all input image objects contain the same number of channels or a single channel image.

  3. Domain level
    An operator supporting this level can be parallelized by dividing its domain and distributing its parts on parallel threads.

  4. Internal data level
    Only parts of the operator are parallelized. The actual degree of parallelization depends on the implementation of the operator. As a result, the potential speedup on multi-core systems varies among operators utilizing this parallelization method.

The description of a HALCON operator in the operator reference contains an entry called “Execution Information”, which specifies its behavior when using HALCON on a multi-core or multi-processor hardware. This entry indicates whether the operator will be automatically parallelized by HALCON and by which method (tuple, channel, domain, or internal data).

The parallelization method of an arbitrary operator opname can also be determined by using get_operator_info:

get_operator_info('opname', 'parallel_method', Information)