The key is using Hailo’s Virtual Device (VDevice) API to work with multiple physical chips without modifying pyhailort.py. Here’s how to implement it:
Main Steps:
Scan for available Hailo devices using Device.scan()
Configure VDevice with multiple device IDs
Use VDevice.create_params() for advanced control (optional)
Example Implementation:
from hailo_platform import Device, VDevice, ConfigureParams, HailoStreamInterface
# Scan and select devices
devices = Device.scan()
selected_devices = [devices[0], devices[1]] # Use first two devices
# Create virtual device and run inference
with VDevice(device_ids=selected_devices) as target:
hef = HEF("your_model.hef")
configure_params = ConfigureParams.create_from_hef(hef, interface=HailoStreamInterface.PCIe)
network_group = target.configure(hef, configure_params)[0]
with network_group.activate():
# Your inference code here
This approach allows for efficient workload distribution across multiple Hailo chips while maintaining a simple interface for inference operations.