1 | # Read thesis-append-pbv.csv
|
---|
2 | # Output for string-graph-peq-sharing.dat
|
---|
3 |
|
---|
4 | # Project details
|
---|
5 | # Filter operation=peq
|
---|
6 | # Split "series" goups of sut; only those in the "pretty" list
|
---|
7 | # Assert one row per string-length
|
---|
8 | # output:
|
---|
9 | # string-len op-duration
|
---|
10 | # in chunks, each headed by pertty(sut)
|
---|
11 |
|
---|
12 | import pandas as pd
|
---|
13 | import numpy as np
|
---|
14 | import os
|
---|
15 | import sys
|
---|
16 |
|
---|
17 | sys.path.insert(0, os.path.dirname(__file__))
|
---|
18 | from common import *
|
---|
19 |
|
---|
20 | # re: apparent cherrypicking
|
---|
21 | # The system's response to the liveness threshold is not smooth.
|
---|
22 | # The system only uses the threshold to decide whether it will double the text heap again or not.
|
---|
23 | # The system's speed for a given string size in a given amount of memory is not affected by the specific value of the liveness threshold.
|
---|
24 | # Goals with this selection are
|
---|
25 | # - showing one speed result per <string size, memory usage amount>
|
---|
26 | # - cropping diminishing or negative returns for large memory sizes
|
---|
27 | # - diminishing is obvious, already shown past chosen sweet spot in this selection
|
---|
28 | # - negative caused by overflowing llc, not relevant to sting impl
|
---|
29 | favSizes = {20:[-1.0, 0.05, 0.1, 0.2, 0.5, 0.9],
|
---|
30 | 50:[-1.0, 0.05, 0.1, 0.2, 0.5, 0.9],
|
---|
31 | 100:[-1.0, 0.1, 0.2, 0.5, 0.9],
|
---|
32 | 200:[-1.0, 0.1, 0.2, 0.5, 0.9],
|
---|
33 | 500:[-1.0, 0.2, 0.4, 0.9, 0.98]}
|
---|
34 |
|
---|
35 | defaultExpansions = [-1, 0.2]
|
---|
36 |
|
---|
37 | cfatimings = loadParseTimingData('result-allocate-speed-cfa.csv',
|
---|
38 | xClasNames=['expansion'], xClasDtypes={'expansion':'Float64'},
|
---|
39 | xFactNames=['topIters'], xFactDtypes={'topIters':np.int64})
|
---|
40 |
|
---|
41 | cfasizings = loadParseSizingData('result-allocate-space-cfa.ssv', xClasNames=['expansion'], xClasDtypes={'expansion':'Float64'})
|
---|
42 |
|
---|
43 | stltimings = loadParseTimingData('result-allocate-speed-stl.csv',
|
---|
44 | xClasNames=['expansion'], xClasDtypes={'expansion':'Float64'},
|
---|
45 | xFactNames=['topIters'], xFactDtypes={'topIters':np.int64})
|
---|
46 |
|
---|
47 | stlsizings = loadParseSizingData('result-allocate-space-stl.ssv', xClasNames=['expansion'], xClasDtypes={'expansion':'Float64'})
|
---|
48 |
|
---|
49 | timings = pd.concat([cfatimings, stltimings])
|
---|
50 | sizings = pd.concat([cfasizings, stlsizings])
|
---|
51 |
|
---|
52 | combined = pd.merge(
|
---|
53 | left=timings,
|
---|
54 | right=sizings[['sut', 'corpus','expansion','hw_cur_req_mem(B)']],
|
---|
55 | on=['sut', 'corpus','expansion']
|
---|
56 | )
|
---|
57 |
|
---|
58 | combined = combined.pivot_table( values=['op-duration-ns','hw_cur_req_mem(B)'], index=['corpus-meanlen-tgt', 'sut-platform', 'expansion'], aggfunc=['mean', 'min', 'max'] )
|
---|
59 | combined = combined.reset_index()
|
---|
60 | combined.columns = combined.columns.to_flat_index()
|
---|
61 |
|
---|
62 | # text = combined.to_csv(header=True, index=True, sep='\t')
|
---|
63 | # print(text)
|
---|
64 |
|
---|
65 |
|
---|
66 | combined['is-default'] = np.isin(combined[('expansion','')], defaultExpansions).astype(int)
|
---|
67 |
|
---|
68 |
|
---|
69 |
|
---|
70 | # print ('!!')
|
---|
71 | # print(combined)
|
---|
72 |
|
---|
73 |
|
---|
74 | # Emit
|
---|
75 |
|
---|
76 | # First, for the CFA curves
|
---|
77 | sut = "cfa"
|
---|
78 | sutGroup = combined.groupby(('sut-platform','')).get_group(sut)
|
---|
79 |
|
---|
80 | groupedSize = sutGroup.groupby(('corpus-meanlen-tgt',''))
|
---|
81 |
|
---|
82 | for sz, szgroup in groupedSize:
|
---|
83 |
|
---|
84 | if sz in favSizes.keys():
|
---|
85 | szgroup_sorted = szgroup.sort_values(by=('expansion',''))
|
---|
86 |
|
---|
87 | print('"{sut}, len={len}"'.format(sut=sut, len=sz))
|
---|
88 | # print(szgroup_sorted) ##
|
---|
89 | # print(szgroup_sorted['expansion'], 'isin', favSizes[sz]) ##
|
---|
90 | favoured = szgroup_sorted.loc[szgroup_sorted[('expansion','')].isin(favSizes[sz])]
|
---|
91 | # print('!') ##
|
---|
92 | # print(favoured) ##
|
---|
93 | text = favoured[[('expansion',''),
|
---|
94 | ('mean','op-duration-ns'),
|
---|
95 | ('min','op-duration-ns'),
|
---|
96 | ('max','op-duration-ns'),
|
---|
97 | ('mean', 'hw_cur_req_mem(B)'),
|
---|
98 | ('min', 'hw_cur_req_mem(B)'),
|
---|
99 | ('max', 'hw_cur_req_mem(B)'),
|
---|
100 | 'is-default']].to_csv(header=False, index=False, sep='\t')
|
---|
101 | print(text)
|
---|
102 | print()
|
---|
103 |
|
---|
104 | # Again, for the STL-comparisons, default expansion only
|
---|
105 |
|
---|
106 | atDefaults = combined.groupby('is-default').get_group(1)
|
---|
107 |
|
---|
108 | for sz, szgroup in atDefaults.groupby(('corpus-meanlen-tgt','')):
|
---|
109 |
|
---|
110 | if sz in favSizes.keys():
|
---|
111 | print(sz)
|
---|
112 | text = szgroup[[('expansion',''),
|
---|
113 | ('mean','op-duration-ns'),
|
---|
114 | ('min','op-duration-ns'),
|
---|
115 | ('max','op-duration-ns'),
|
---|
116 | ('mean', 'hw_cur_req_mem(B)'),
|
---|
117 | ('min', 'hw_cur_req_mem(B)'),
|
---|
118 | ('max', 'hw_cur_req_mem(B)'),
|
---|
119 | ('sut-platform','')]].to_csv(header=False, index=False, sep='\t')
|
---|
120 | print(text)
|
---|
121 | print()
|
---|