-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbenchmarks.rb
executable file
·93 lines (82 loc) · 1.92 KB
/
benchmarks.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
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
#!/bin/env ruby
require 'optparse'
require 'date'
BENCHMARKS = [
"barrier",
"classes",
"colt",
"crypt",
"DacapoRR",
"forkjoin",
"jbb",
"jbb-fixed",
"jg-part3-concurrent",
"lufact",
"matrixmult",
"moldyn",
"montecarlo",
"mtrt",
"multiset",
"philo",
"queue-jg",
"queue-qs",
"queue-simple",
"raytracer",
"series",
"sor",
"sor-barrier",
"sor-barrier-new",
"sparsematmult",
"sync",
"tsp"
]
benchmarks = []
benchdir = ''
action = ''
OptionParser.new do |opts|
opts.banner = "Usage: benchmarks.rb [options]"
# e.g. /home/cs/Projects/sqt/proj/JavaWorkspace/Benchmarks
opts.on("-P", "--benchdir PATH", "Base path for benchmarks") do |path|
benchdir = path
end
opts.on("-B", "--benchmark BENCHMARK", BENCHMARKS + ["all"],
"Specify benchmark (use 'all' to run all)",
"Available: " + BENCHMARKS.join("\n" + (' ' * 48))) do |b|
if b == "all"
benchmarks = BENCHMARKS
else
benchmarks |= [b]
end
end
opts.on("-A", "--action ACTION", [:compile, :run, :test],
"Select the action to perform for each benchmark (compile, run or test)") do |a|
action = a
end
opts.on_tail("-h", "--help", "Show this message") do
puts opts
exit
end
end.parse!
if benchmarks.empty?
puts "No benchmarks specified!"
exit
end
rrdir = File.expand_path(File.dirname(__FILE__))
benchmarks.each do |benchmark|
case action
when :compile
system "cd #{benchdir}/#{benchmark} && ./COMPILE"
when :run
ENV["JAVA"] = `which java`
system "cd #{benchdir}/#{benchmark} && ./RUN"
when :test
ENV["PATH"] += ":#{rrdir}/build/bin"
ENV["JVM_ARGS"] = "-Xmx4g -Xms1g"
ENV["RR_HOME"] = rrdir
ENV["RR_TOOLPATH"] = "#{rrdir}/jars/java-cup-11a.jar"
ENV["TEST_ARGS"] = "-quiet -tool=S:ESO -logs=#{rrdir}/log/#{benchmark}/#{Date.today().to_s}"
system "cd #{benchdir}/#{benchmark} && ./TEST"
else
puts "Unsupported action"
end
end