Mercurial > hg > Members > innparusu > Gears_log
view benchmark.rb @ 12:8abcef12fad7
Add benchmark.rb
author | Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 06 Feb 2018 03:10:20 +0900 |
parents | |
children |
line wrap: on
line source
require 'optparse' require 'pry' params = ARGV.getopts('', 'path:', 'length:1024', 'split:8', 'gpu', 'logDirPath:.') cpus = (0..4).map {|i| 2**i } Dir.chdir(params['logDirPath']) unless params['path'] puts 'Usage: ruby benchmark.rb --path gears_example_binary_path [options]' puts ' --length length array length [default: 1024]' puts ' --split split array split num [default: 8]' puts ' --logDirPath logdir log directory [default: current directory]' puts ' --gpu run gpu' puts ' -h show help' exit(1) end file = File.new("cpu_result", 'w') cpus.each do |i| result = `#{params['path']} -cpu #{i} -l #{params['length']} -s #{params['split']}` file.write(result) end file.close exit(0) unless params['gpu'] file = File.new("gpu_result", 'w') result = `#{params['path']} -cpu #{i} -l #{params['length']} -s #{params['split']}` file.write(result) file.close