-
Notifications
You must be signed in to change notification settings - Fork 0
/
csv_generate.py
56 lines (52 loc) · 1.32 KB
/
csv_generate.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
#!/usr/bin/python
import re
import sys
import csv
shakes = open("test.txt", "r")
title = ['The execution time of each benchmark in Figure 8']
title2 = ['Normalized Speedup = exec. time of implementation/ exec.time of CUDA Baseline']
benchmark = [' ', 'Mandelbrot', 'Convolution', 'DCT', 'FilterBank', 'BeamForming', 'MatrixMul', 'DES', 'MPE']
pagoda = []
fusion = []
baseline = []
pthread = []
pagoda.append("Pagoda")
baseline.append("CUDA Baseline")
fusion.append("CUDA Fusion")
pthread.append("pthread")
line = shakes.readlines()
cat_count = 0
total = 0
count = 0
for i in range(0,len(line)):
temp = line[i].split()
for k in range(0,len(temp)):
if(temp[k] == "Time:"):
total = total + float(temp[k + 1])
count = count + 1
if(count == 3):
cat_count = cat_count + 1
if(cat_count == 1):
s = '%.4f' % float(total/3)
pagoda.append(s)
if(cat_count == 2):
s = '%.4f' % float(total/3)
baseline.append(s)
if(cat_count == 3):
s = '%.4f' % float(total/3)
fusion.append(s)
if(cat_count == 4):
s = '%.4f' % float(total/3)
pthread.append(s)
cat_count = 0
count = 0
total = 0
resultFile = open("output.csv", "wb")
wr = csv.writer(resultFile, dialect='excel')
wr.writerow(title)
wr.writerow(title2)
wr.writerow(benchmark)
wr.writerow(pagoda)
wr.writerow(fusion)
wr.writerow(baseline)
wr.writerow(pthread)