query_available_dl_devices
— Get list of deep-learning-capable hardware devices.
query_available_dl_devices( : : GenParamName, GenParamValue : DLDeviceHandles)
query_available_dl_devices
returns a list of handles. Each
handle refers to a deep-learning-capable hardware device
(hereafter referred to as device) that can be
used for inference or training of a deep learning model.
A deep-learning-capable device is either supported directly through HALCON or through an inference engine.
The support of inference engines in HALCON is currently not available but planned for the future.
The devices that are supported directly through HALCON are equivalent to
those that can be set to a deep learning model via set_dl_model_param
using 'runtime' = 'cpu' or 'runtime' = 'gpu' .
HALCON provides an internal implementation for the inference or training of
a deep learning model for those devices.
See Deep Learning for more details.
Devices that are supported through an inference engine
can also be set to a deep learning model using set_dl_model_param
.
In this case the inference is not executed by HALCON but by the inference engine.
query_available_dl_devices
returns a handle for each deep-learning-capable device
supported through HALCON and through an inference engine.
If a device is supported through HALCON and one or several inference engines,
query_available_dl_devices
returns a handle for HALCON and for each inference
engine.
GenParamName
can be used to filters for the devices.
Supported values are:
Devices with this ID.
Possible values: 0, 1, ....
Devices contained in an inference engine with this name.
Possible values: 'none' .
The devices, which are directly supported by HALCON for this device type.
Possible values: 'cpu' , 'gpu' .
Devices of this type.
Possible values: 'cpu' , 'gpu' .
GenParamName
can have multiple entries for the same value.
In this case filter combines the entries with a logical 'or'.
Please see the example code below for some examples how to use the filter.
This operator returns a handle. Note that the state of an instance of this handle type may be changed by specific operators even though the handle is used as an input parameter by those operators.
GenParamName
(input_control) attribute.name(-array) →
(string)
Name of the generic parameter.
Default value: []
List of values: 'id' , 'inference_engine' , 'runtime' , 'type'
GenParamValue
(input_control) attribute.value(-array) →
(string / integer / real)
Value of the generic parameter.
Default value: []
Suggested values:
DLDeviceHandles
(output_control) dl_device(-array) →
(handle)
Tuple of DLDevice handles
* Query all deep-learning-capable hardware devices query_available_dl_devices ([], [], DLDeviceHandles) * Query all GPUs with ID 0 or 2 query_available_dl_devices (['type', 'id', 'id'], ['gpu', 0, 2], DLDeviceHandles) * Query the unique GPU with ID 1 supported by HALCON query_available_dl_devices (['runtime', 'id'], ['gpu', 1], DLDeviceHandles)
If the parameters are valid, the operator query_available_dl_devices
returns the value 2 (H_MSG_TRUE). If necessary, an exception is raised.
Foundation