-
Notifications
You must be signed in to change notification settings - Fork 0
/
bench.py
94 lines (80 loc) · 2.13 KB
/
bench.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
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
import traceback
import sys, os, subprocess, signal
import subprocess as sp
testConfig = [
{
"name" : "T1",
"entries" : 10 ** 6,
"chunks" : 2,
"speed" : 0,
"points" : 15
},
{
"name" : "T2",
"entries" : 2 * 10 ** 6,
"chunks" : 2,
"speed" : 20,
"points" : 15
},
{
"name" : "T3",
"entries" : 4 * 10 ** 6,
"chunks" : 4,
"speed" : 40,
"points" : 15
},
{
"name" : "T4",
"entries" : 8 * 10 ** 7,
"chunks" : 4,
"speed" : 50,
"points" : 15
},
{
"name" : "T5",
"entries" : 10 ** 8,
"chunks" : 2,
"speed" : 50,
"points" : 10
},
{
"name" : "T6",
"entries" : 10 ** 8,
"chunks" : 10,
"speed" : 50,
"points" : 10
},
]
outfile = open('output', 'w')
if len(sys.argv) > 1:
benchtypes = sys.argv[1:]
else:
benchtypes = ('0', '1')
hwMaxPoints = 0
hwPoints = 0
for testEntry in testConfig:
testName = testEntry["name"]
testEntries = str(testEntry["entries"])
testChunks = str(testEntry["chunks"])
testSpeed = str(testEntry["speed"])
testPoints = testEntry["points"]
hwMaxPoints += testPoints
print "\n\n\n------- Test", testName, "START\t----------\n"
try:
child = sp.Popen( ['./gpu_hashtable', testEntries, testChunks, testSpeed], stdout=sp.PIPE )
output = child.communicate()[0]
lines = str(output).split("\n")
print( output )
rc = child.poll()
if rc == 1:
print "------- Test", testName, "END\t---------- \t [ FAILED ]"
continue
except Exception:
print "------- Test", testName, "END\t---------- \t [ FAILED ]"
traceback.print_exc()
print "Error with", str(['./src/gpu_hashtable', testEntries, testChunks, testSpeed])
continue
print "------- Test ", testName, "END\t---------- \t [ OK RESULT: ", testPoints, " pts ]"
hwPoints = hwPoints + testPoints
print "\nTotal so far: ", hwPoints, "/", 80
print "\nTotal:", hwPoints, "/", 80