How to measure the power and temp of Hailo-8 async

There is a simple Python API to read-out the data from the temperature and power sensors. This can be executed async from any other activity on the device.

#!/usr/bin/env python3

import time
from hailo_platform import Device

def _run_periodic(delay=1):
    device_infos = Device.scan()
    targets = [Device(di) for di in device_infos]
    for i, target in enumerate(targets):
        target.control.stop_power_measurement()
        target.control.set_power_measurement()
        target.control.start_power_measurement()
    try:
        while True:
            for i, target in enumerate(targets):
                time.sleep(delay)
                power = target.control.get_power_measurement().average_value
                temp = target.control.get_chip_temperature().ts0_temperature
                print('[{}] {:.3f}W {:.3f}C'.format(device_infos[i], power, temp), end='\r')
    except KeyboardInterrupt:
        print('-I- Received keyboard intterupt, exiting')

    for i, target in enumerate(targets):
        target.control.stop_power_measurement()

if __name__ == "__main__":
    _run_periodic()
1 Like

Thanks Nadav, that is very helpful. I would also be interested in querying which temperature zone HAILO is in as well as the current clock frequency through the python interface. Is that possible?

You can use the device control:

from hailo_platform import Device

dev = Device()
dev.control.get_extended_device_information()

This would output like this:
image

Temperature zones are preset, you can read the values in the hailort user guide in this chapter: “9.1. Temperature Monitoring”

1 Like