-
Notifications
You must be signed in to change notification settings - Fork 0
/
benchmark_intel_energy_sync.py
61 lines (49 loc) · 1.96 KB
/
benchmark_intel_energy_sync.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
import gc
from datetime import datetime
import numpy as np
from openvino.inference_engine import IECore
import os.path
from os import system
import common_benchmark_definitions as common
infCore=IECore()
measurements_openvino="OpenVINO-Measurements"
if not os.path.isdir(measurements_openvino): os.mkdir(measurements_openvino)
iterations=common.iterations
#350-> python braucht 10 GB RAm
global_iterations=common.global_iterations
nets_to_run=common.tf_net_names #[:12] #memory problems in many_conv2d, at least at the CPU
#openvino_nets=[startNet(x) for x in nets_to_run]
target="MYRIAD"
measurements=dict()
for name in nets_to_run:
measurements["start("+name+")"]=[]
measurements["end("+name+")"]=[]
for l in range(global_iterations):
print(l)
for i in range(len(nets_to_run)):
loaded_net=common.startOpenvinoNet(nets_to_run[i],infCore,target,1)
#network_input="input_1"
network_input=next(iter(loaded_net.input_info))
data_format=[iterations]
data_format.extend(loaded_net.input_info[network_input].tensor_desc.dims)
#res2=[]
data=common.getOpenvinoExampelData(data_format)
#input("start")
#encl=common.EnergyMeasurementEnclosure(nets_to_run[i])
#encl.start()
print("\a")
start=datetime.now()
for j in range(iterations):
loaded_net.infer({network_input:data[j]})
# get the request, measure time https://github.com/openvinotoolkit/openvino/blob/master/tools/benchmark_tool/openvino/tools/benchmark/benchmark.py
#encl.end()
end=datetime.now()
print("\a")
print(nets_to_run[i])
measurements["start("+nets_to_run[i]+")"].append(common.getDStr(start))
measurements["end("+nets_to_run[i]+")"].append(common.getDStr(end))
#input("end")
data=None
gc.collect()
print(measurements)
common.writeResults("MYRIAD",measurements,"energy-times","openvino","sync")