-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathmake_table_threads.py
executable file
·50 lines (35 loc) · 1.9 KB
/
make_table_threads.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
#!/usr/bin/env python
import csv
from collections import namedtuple
import sys
import math
import table_utils
place = {'SIMPLE_HASH' : 1, 'GAUSS_SIMPLE_HASH' : 2, 'BLOOM_FILTER' : 3, 'POLYNOMIALS' : 4, 'POLYNOMIALS_SIMPLE_HASH' : 5, 'TWO_PARTY' : 6}
NUM_THREADS = [1,2,4,None]
KEY_SIZE = 80
SET_SIZE = 2**16
dir_name = sys.argv[1]
with open("{0}/experiment1_avg.csv".format(dir_name), 'rb') as csvfile:
results = table_utils.readRows(csvfile)
results = filter(lambda x: x.key_size==str(KEY_SIZE) and x.set_size==str(SET_SIZE),results)
res = {'SIMPLE_HASH' : {}, 'GAUSS_SIMPLE_HASH' : {}, 'BLOOM_FILTER' : {}, 'POLYNOMIALS' : {}, 'POLYNOMIALS_SIMPLE_HASH' : {}, 'TWO_PARTY' : {}}
params = []
for num_threads in NUM_THREADS:
row = filter(lambda x: x.num_threads == str(num_threads),results)
time_vals = dict(map(lambda x: (x.strategy, "%.2f" % eval(x.result1.split('|')[0])), row))
for strategy in res.keys():
res[strategy][num_threads] = time_vals[strategy]
with open("{0}/experiment_threads.txt".format(dir_name), 'wb') as f:
f.write('\\begin{table*}[t]\n')
f.write('\\centering\n')
f.write('\\begin{tabular}{| l | l | l | l | l | l |}\n')
f.write('\\hline\n')
f.write('Number of threads & ' + ' & '.join(["{0}".format(num_threads) for num_threads in NUM_THREADS]) + " \\\\\n")
f.write('\\hline\n')
f.write('\\hline\n')
for strategy in res.keys():
f.write(" & ".join([strategy.replace('_',' ')]+[res[strategy][num_threads] for num_threads in NUM_THREADS]) + " \\\\\\hline\n")
f.write('\\end{tabular}\n')
f.write('\\caption{Runtimes in seconds for PSI protocols for $\sigma=64$, $\symsec=80$, set size $2^{16}$ and 5 parties with different number of threads}\n')
f.write('\\label{tab:results_threads}\n')
f.write('\\end{table*}\n')