Hi, i use hailo8L with orangepi5, Os Ubuntu 22.04 hailort version 4.17.0, unfortunately i can’t find work way to get temperature of chip, may be someone know how i can do this?
Welcome to the Hailo Community!
When you use the HailoRT CLI some commands allow you to measure the temperature e.g.,
hailortcli run model.hef --measure-temp
In your own code you can use the HailoRT APIs. Have a look at the HailoRT User guide. You can download that from the Developer Zone. Look for
hailort::Device::get_chip_temperature()
You can use the following Python script:
#!/usr/bin/env python3
import time
import argparse as ap
from hailo_platform import PcieDevice
from hailo_platform import PowerMeasurementTypes, DvmTypes, MeasurementBufferIndex
from hailo_platform.pyhailort.control_object import PcieHcpControl
device_infos = PcieDevice.scan_devices()
targets = [PcieDevice(device_info=di) for di in device_infos]
temps_t = [PcieHcpControl(device_info=di) for di in device_infos]
def _run_periodic(filename, delay):
for i, target in enumerate(targets):
target.control.stop_power_measurement()
target.control.set_power_measurement(MeasurementBufferIndex.MEASUREMENT_BUFFER_INDEX_0, DvmTypes.AUTO, PowerMeasurementTypes.POWER)
target.control.start_power_measurement()
try:
with open(filename, 'w') as FH:
while True:
for i, target in enumerate(targets):
time.sleep(delay)
power = target.control.get_power_measurement(MeasurementBufferIndex.MEASUREMENT_BUFFER_INDEX_0, should_clear=True).average_value
temp = temps_t[i].get_chip_temperature().ts0_temperature
print('[{}:{}] {:.3f}W {:.3f}C'.format(device_infos[i].bus,device_infos[i].device, power, temp), end='\r')
FH.write('[{}:{}] {:.3f}W {:.3f}C\n'.format(device_infos[i].bus,device_infos[i].device, power, temp))
except KeyboardInterrupt:
print('-I- Received keyboard intterupt, exiting')
for i, target in enumerate(targets):
target.control.stop_power_measurement()
def _run_single(filename):
try:
with open(filename, 'w') as FH:
while True:
for i, target in enumerate(targets):
current = target.control.power_measurement(DvmTypes.AUTO, PowerMeasurementTypes.POWER)
temp = temps_t[i].get_chip_temperature().ts0_temperature
print('[{}:{}] {:.3f}W {:.3f}C'.format(device_infos[i].bus_id,device_infos[i].dev_id, current, temp), end='\r')
FH.write('[{}:{}] {:.3f}W {:.3f}C\n'.format(device_infos[i].bus_id,device_infos[i].dev_id, current, temp))
time.sleep(0.1)
except KeyboardInterrupt:
print('-I- Received keyboard intterupt, exiting')
if __name__ == "__main__":
parser = ap.ArgumentParser()
parser.add_argument('--mode', help='Choose the measurement mode [periodic|single]', type=str, default='periodic')
parser.add_argument('--delay', help='Choose the measurement delay for the periodic mode', type=int, default='1')
parser.add_argument('--out', help='Output file', type=str, default='current_temp_readouts.txt')
args = parser.parse_args()
if args.mode == 'periodic':
_run_periodic(args.out, args.delay)
else:
_run_single(args.out)
1 Like
Hi there,
I get the following output:
PcieDevice scan_devices method is deprecated! Please use Device object.
HailoHWObject is deprecated! Please use VDevice/Device object.
PcieDevice is deprecated! Please use VDevice/Device object.
PcieHcpControl is deprecated! Please Use Control object
PcieHcpControl is deprecated! Please Use Control object
[HailoRT] [error] Firmware control has failed. Major status: 0x400300b4, Minor status: 0x400300b4
[HailoRT] [error] Firmware major status: CONTROL_PROTOCOL_STATUS_UNSUPPORTED_DEVICE
[HailoRT] [error] Firmware minor status: CONTROL_PROTOCOL_STATUS_UNSUPPORTED_DEVICE
[HailoRT] [error] Opcode HAILO_CONTROL_OPCODE_SET_POWER_MEASUEMENT is not supported on the current board.
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/hailo_platform/pyhailort/pyhailort.py", line 2024, in set_power_measurement
return self._device.set_power_measurement(buffer_index, dvm, measurement_type)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
hailo_platform.pyhailort._pyhailort.HailoRTStatusException: 48
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/data/hailo_temp.py", line 51, in <module>
_run_periodic(args.out, args.delay)
File "/data/hailo_temp.py", line 14, in _run_periodic
target.control.set_power_measurement(MeasurementBufferIndex.MEASUREMENT_BUFFER_INDEX_0, DvmTypes.AUTO, PowerMeasurementTypes.POWER)
File "/usr/lib/python3/dist-packages/hailo_platform/pyhailort/pyhailort.py", line 2023, in set_power_measurement
with ExceptionWrapper():
File "/usr/lib/python3/dist-packages/hailo_platform/pyhailort/pyhailort.py", line 118, in __exit__
self._raise_indicative_status_exception(value)
File "/usr/lib/python3/dist-packages/hailo_platform/pyhailort/pyhailort.py", line 166, in _raise_indicative_status_exception
raise self.create_exception_from_status(error_code) from libhailort_exception
hailo_platform.pyhailort.pyhailort.HailoRTUnsupportedOpcodeException: HailoRT has failed because an unsupported opcode was sent to device
Where should I look into to get the latest docs?
I also tried running
from hailo_platform import Device, DvmTypes, PowerMeasurementTypes, SamplingPeriod, AveragingFactor, MeasurementBufferIndex
target = Device()
target.control.power_measurement()
In a RPi5, with 8L, fw 4.20.0, and got
[HailoRT] [error] Firmware control has failed. Major status: 0x40030032, Minor status: 0x40030081
[HailoRT] [error] Firmware major status: CONTROL_PROTOCOL_STATUS_FAILED_SINGLE_POWER_MEASUREMENT
[HailoRT] [error] Firmware minor status: CONTROL_PROTOCOL_STATUS_GOT_INVALID_DVM_FOR_THAT_PLATFORM
[HailoRT] [error] CHECK_SUCCESS failed with status=HAILO_FW_CONTROL_FAILURE(18)
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/hailo_platform/pyhailort/pyhailort.py", line 1973, in power_measurement
return self._device.power_measurement(dvm, measurement_type)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
hailo_platform.pyhailort._pyhailort.HailoRTStatusException: 18
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python3/dist-packages/hailo_platform/pyhailort/pyhailort.py", line 1972, in power_measurement
with ExceptionWrapper():
File "/usr/lib/python3/dist-packages/hailo_platform/pyhailort/pyhailort.py", line 118, in __exit__
self._raise_indicative_status_exception(value)
File "/usr/lib/python3/dist-packages/hailo_platform/pyhailort/pyhailort.py", line 166, in _raise_indicative_status_exception
raise self.create_exception_from_status(error_code) from libhailort_exception
Found the following: How to measure the power and temp of Hailo-8 M.2 async - #8 by Nadav
Which solves my problem.
1 Like