-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathapplications.py
More file actions
104 lines (88 loc) · 2.39 KB
/
Copy pathapplications.py
File metadata and controls
104 lines (88 loc) · 2.39 KB
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
import scipy.stats as stats
import pdb
# Applications
SPEECH_RECOGNITION = 1
NLP = 2
FACE_RECOGNITION = 3
SEARCH_REQ = 4
LANGUAGE_TRANSLATION = 5
PROC_3D_GAME = 6
VR = 7
AR = 8
# Data size scales
BYTE = 8
KB = 1024*BYTE
MB = 1024*KB
GB = 1024*MB
TB = 1024*GB
PB = 1024*TB
# CPU clock frequency scales
KHZ = 1e3
MHZ = KHZ*1e3
GHZ = MHZ*1e3
app_info={
SPEECH_RECOGNITION : {'workload':10435,
'popularity': 5,
'min_bits':40000*BYTE,
'max_bits':300000*BYTE
},NLP : {'workload':25346,
'popularity': 8,
'min_bits':4000*BYTE,
'max_bits':100000*BYTE
},FACE_RECOGNITION : {'workload':45043,
'popularity': 4,
'min_bits':10000*BYTE,
'max_bits':100000*BYTE
},SEARCH_REQ : {'workload':8405,
'popularity': 0.125,
'min_bits':800*BYTE,
'max_bits':8000*BYTE
},LANGUAGE_TRANSLATION : {'workload':34252,
'popularity': 0.125,
'min_bits':800*BYTE,
'max_bits':8000*BYTE
},PROC_3D_GAME : {'workload':54633,
'popularity': 0.125,
'min_bits':800*BYTE,
'max_bits':8000*BYTE
},VR : {'workload':40305,
'popularity': 0.125,
'min_bits':800*BYTE,
'max_bits':8000*BYTE
},AR : {'workload':34532,
'popularity': 0.125,
'min_bits':800*BYTE,
'max_bits':8000*BYTE
}
}
def app_type_list():
return app_info.keys()
def app_type_pop():
# result =[]
# for i in list(app_info.keys()):
# result.append([i, app_info[i]['popularity']])
# return result
return [(i, app_info[i]['popularity']) for i in list(app_info.keys())]
def arrival_bits(app_type, dist = 'deterministic'):
min_bits = app_info[app_type]['min_bits']
max_bits = app_info[app_type]['max_bits']
mu = (min_bits+max_bits)/2
sigma = (max_bits-min_bits)/4
if dist=='normal':
return int(stats.truncnorm.rvs((min_bits-mu)/sigma, (max_bits-mu)/sigma, loc=mu, scale=sigma))
elif dist=='deterministic':
return mu
else:
return 1
def main():
for j in range(5):
result =[]
for i in range(1,9):
result.append(arrival_bits(i, dist='normal'))
print(result)
# for i in range(1,9):
# result.append(app_info[i]['workload']*app_info[i]['popularity']*arrival_bits(i, dist='normal'))
# result = np.array(result)/GHZ
#pdb.set_trace()
if __name__=='__main__':
main()