Skip to content

Commit

Permalink
Showing 3 changed files with 99 additions and 10 deletions.
24 changes: 23 additions & 1 deletion ci.hocon
Original file line number Diff line number Diff line change
@@ -183,6 +183,18 @@ psd-benchmarks: {
] ${post-process-and-upload-results}
}

synthetic-benchmarks: {
run: ${setup-benchmarks} [
[mx, benchmark, synthetic]
] ${post-process-and-upload-results}
}

micro-benchmarks: {
run: ${setup-benchmarks} [
[mx, benchmark, micro]
] ${post-process-and-upload-results}
}

builds: [
{name: ruby-test-fast} ${common} ${gate-caps} {run: [${jt} [test, fast]]},
{name: ruby-test-specs-command-line} ${common} ${gate-caps} {run: [${jt} [test, specs, ":command_line"]]},
@@ -220,5 +232,15 @@ builds: [
//{name: ruby-benchmarks-psd-noindy} ${common} ${no-graal} ${daily-bench-caps} ${jruby-noindy-benchmark} ${psd-benchmarks},
//{name: ruby-benchmarks-psd-indy} ${common} ${no-graal} ${daily-bench-caps} ${jruby-indy-benchmark} ${psd-benchmarks},
{name: ruby-benchmarks-psd-graal-core} ${common} ${graal-core} ${bench-caps} ${jruby-truffle} ${psd-benchmarks},
{name: ruby-benchmarks-psd-graalvm} ${common} ${graalvm} ${bench-caps} ${jruby-truffle} ${psd-benchmarks}
{name: ruby-benchmarks-psd-graalvm} ${common} ${graalvm} ${bench-caps} ${jruby-truffle} ${psd-benchmarks},

//{name: ruby-benchmarks-synthetic-noindy} ${common} ${no-graal} ${daily-bench-caps} ${jruby-noindy-benchmark} ${synthetic-benchmarks},
//{name: ruby-benchmarks-synthetic-indy} ${common} ${no-graal} ${daily-bench-caps} ${jruby-indy-benchmark} ${synthetic-benchmarks},
{name: ruby-benchmarks-synthetic-graal-core} ${common} ${graal-core} ${bench-caps} ${jruby-truffle} ${synthetic-benchmarks},
{name: ruby-benchmarks-synthetic-graalvm} ${common} ${graalvm} ${bench-caps} ${jruby-truffle} ${synthetic-benchmarks},

//{name: ruby-benchmarks-micro-noindy} ${common} ${no-graal} ${daily-bench-caps} ${jruby-noindy-benchmark} ${micro-benchmarks},
//{name: ruby-benchmarks-micro-indy} ${common} ${no-graal} ${daily-bench-caps} ${jruby-indy-benchmark} ${micro-benchmarks},
{name: ruby-benchmarks-micro-graal-core} ${common} ${graal-core} ${bench-caps} ${jruby-truffle} ${micro-benchmarks},
{name: ruby-benchmarks-micro-graalvm} ${common} ${graalvm} ${bench-caps} ${jruby-truffle} ${micro-benchmarks}
]
58 changes: 55 additions & 3 deletions mx.jruby/mx_jruby.py
Original file line number Diff line number Diff line change
@@ -198,7 +198,7 @@ def runBenchmark(self, benchmark, bmSuiteArgs):
'benchmark': benchmark,
'metric.name': 'memory',
'metric.value': data['min'],
'metric.unit': 'MB',
'metric.unit': 'MiB',
'metric.better': 'lower',
'extra.metric.human': data['human']
}]
@@ -236,15 +236,25 @@ def time(self):
raise NotImplementedError()

def directory(self):
raise NotImplementedError()
return self.name()

def runBenchmark(self, benchmark, bmSuiteArgs):
arguments = ['benchmark']
if 'MX_BENCHMARK_OPTS' in os.environ:
arguments.extend(os.environ['MX_BENCHMARK_OPTS'].split(' '))
arguments.extend(['--simple'])
arguments.extend(['--time', str(self.time())])
arguments.extend([self.directory() + '/' + benchmark + '.rb'])
if ':' in benchmark:
benchmark_file, benchmark_name = benchmark.split(':')
benchmark_names = [benchmark_name]
else:
benchmark_file = benchmark
benchmark_names = []
if '.rb' in benchmark_file:
arguments.extend([benchmark_file])
else:
arguments.extend([self.directory() + '/' + benchmark_file + '.rb'])
arguments.extend(benchmark_names)
arguments.extend(bmSuiteArgs)
out = mx.OutputCapture()
jt(arguments, out=out)
@@ -272,6 +282,7 @@ def runBenchmark(self, benchmark, bmSuiteArgs):
'mandelbrot',
'matrix-multiply',
'n-body',
'neural-net',
'pidigits',
'red-black',
'richards',
@@ -372,9 +383,50 @@ def benchmarks(self):
def time(self):
return psd_benchmark_time

synthetic_benchmarks = [
'acid'
]

synthetic_benchmark_time = 120

class SyntheticBenchmarkSuite(AllBenchmarksBenchmarkSuite):
def name(self):
return 'synthetic'

def benchmarks(self):
return synthetic_benchmarks

def time(self):
return synthetic_benchmark_time

micro_benchmark_time = 30

class MicroBenchmarkSuite(AllBenchmarksBenchmarkSuite):
def name(self):
return 'micro'

def benchmarks(self):
out = mx.OutputCapture()
jt(['where', 'repos', 'all-ruby-benchmarks'], out=out)
all_ruby_benchmarks = out.data.strip()
benchmarks = []
for root, dirs, files in os.walk(os.path.join(all_ruby_benchmarks, 'micro')):
for name in files:
if name.endswith('.rb'):
benchmark_file = os.path.join(root, name)[len(all_ruby_benchmarks)+1:]
out = mx.OutputCapture()
jt(['benchmark', 'list', benchmark_file], out=out)
benchmarks.extend([benchmark_file + ':' + b.strip() for b in out.data.split('\n') if len(b.strip()) > 0])
return benchmarks

def time(self):
return micro_benchmark_time

mx_benchmark.add_bm_suite(AllocationBenchmarkSuite())
mx_benchmark.add_bm_suite(MinHeapBenchmarkSuite())
mx_benchmark.add_bm_suite(TimeBenchmarkSuite())
mx_benchmark.add_bm_suite(ClassicBenchmarkSuite())
mx_benchmark.add_bm_suite(ChunkyBenchmarkSuite())
mx_benchmark.add_bm_suite(PSDBenchmarkSuite())
mx_benchmark.add_bm_suite(SyntheticBenchmarkSuite())
mx_benchmark.add_bm_suite(MicroBenchmarkSuite())
27 changes: 21 additions & 6 deletions tool/jt.rb
Original file line number Diff line number Diff line change
@@ -376,6 +376,7 @@ def help
puts ' note that to run most MRI benchmarks, you should translate them first with normal Ruby and cache the result, such as'
puts ' benchmark bench/mri/bm_vm1_not.rb --cache'
puts ' jt benchmark bench/mri/bm_vm1_not.rb --use-cache'
puts 'jt where repos ... find these repositories'
puts
puts 'you can also put build or rebuild in front of any command'
puts
@@ -945,19 +946,33 @@ def tarball(*options)
end

def benchmark(*args)
benchmark = args.pop
raise 'no benchmark given' unless benchmark
benchmark = Utilities.find_benchmark(benchmark)
raise 'benchmark not found' unless File.exist?(benchmark)
args.map! do |a|
if a.include?('.rb')
benchmark = Utilities.find_benchmark(a)
raise 'benchmark not found' unless File.exist?(benchmark)
benchmark
else
a
end
end

run_args = []
run_args.push '--graal' unless args.delete('--no-graal')
run_args.push '--graal' unless args.delete('--no-graal') || args.include?('list')
run_args.push '-I', "#{Utilities.find_gem('deep-bench')}/lib" rescue nil
run_args.push '-I', "#{Utilities.find_gem('benchmark-ips')}/lib" rescue nil
run_args.push "#{Utilities.find_gem('benchmark-interface')}/bin/benchmark"
run_args.push benchmark
run_args.push *args
run *run_args
end

def where(*args)
case args.shift
when 'repos'
args.each do |a|
puts Utilities.find_repo(a)
end
end
end

def check_ambiguous_arguments
ENV.delete "JRUBY_ECLIPSE" # never run from the Eclipse launcher here

0 comments on commit dafb740

Please sign in to comment.