-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrunner.rb
executable file
·47 lines (39 loc) · 1.3 KB
/
runner.rb
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
#!/usr/bin/ruby -W0
DEBUG = false
def cases
[
#[topk, dimension, query]
[2, 8, 2],
[4, 16, 8],
[8, 32, 32],
[16, 64, 128],
[32, 64, 128],
[64, 128, 128],
[128, 128, 256],
[128, 256, 1028],
]
end
def release
"Release/Genie-and-Lamp-GPU"
end
def debug
"Debug/Genie-and-Lamp-GPU"
end
# MAIN func starts
class String
def red; "\033[31m#{self}\033[0m" end
end
script = DEBUG ? debug : release
for arg in cases do
runner = "#{script} -k #{arg[0]} -d #{arg[1]} -q #{arg[2]}"
puts "==> running #{runner}".red
result = `#{runner}`
gpu_time = /finished\s+with\s+total\s+time\s+\:\s+\d+\.\d+\s+with\s+\d+\s+iterations/.match(result) || /finished\s+with\s+total\s+time\s+\:\s+\d+\s+with\s+\d+\s+iterations/.match(result)
cpu_scan_time = /the\s+time\s+of\s+top\-\d+\s+in\s+CPU\s+version\s+is\:\d+\.\d+/.match(result) || /the\s+time\s+of\s+top\-\d+\s+in\s+CPU\s+version\s+is\:\d+/.match(result)
gpu_scan_time = /GPU\s+SCAN\s+Time\s+used\:\s+\d+.\d+/.match(result) || /GPU\s+SCAN\s+Time\s+used\:\s+\d+/.match(result)
puts "TOPK = #{arg[0]} DIMENSIONNUM = #{arg[1]} QUERYNUM = #{arg[2]}"
puts "GPU : " + gpu_time[0]
puts "CPU_SCAN: " + cpu_scan_time[0]
puts "GPU_SCAN: " + gpu_scan_time[0]
puts
end