scripts/calculate_multiprocess_overhead.rb
# Runs a single instance of the benchmark and returns the overhead of
# multiprocess vs. multithread.
Runs a single instance of the benchmark and returns the overhead of
multiprocess vs. multithread.
Runs a single instance of the benchmark and returns the overhead of multiprocess vs . multithread .
def run_single_instance()
  `rm results/*.json`
  time_ratio = nil
  while true
    if time_ratio != nil
      puts "Retrying run to get better GPU globaltimer rate."
      puts "Last rate was #{time_ratio.to_s}"
    end
    stdout_process = `./bin/runner configs/multiprocess_two_randomwalk.json`
    time_ratio = get_time_ratio(stdout_process)
    next if (time_ratio <= 0.99) || (time_ratio >= 1.01)
    stdout_thread = `./bin/runner configs/multithread_two_randomwalk.json`
    time_ratio = get_time_ratio(stdout_thread)
    next if (time_ratio <= 0.99) || (time_ratio >= 1.01)
    break
  end
  process_time = 0.0
  thread_time = 0.0
  files = Dir["results/*.json"]
  files.each do |f|
    kernel_time = get_kernel_time(f)
    if f =~ /multiprocess_/
      process_time += kernel_time
    elsif f =~ /multithread_/
      thread_time += kernel_time
    end
  end
  process_time / thread_time
end
def run_single_instance ( ) ` rm results/*.json ` time_ratio = nil while true if time_ratio != nil puts "Retrying run to get better GPU globaltimer rate." puts "Last rate was #{time_ratio.to_s}" end stdout_process = ` ./bin/runner configs/multiprocess_two_randomwalk.json ` time_ratio = get_time_ratio ( stdout_process ) next if ( time_ratio <= 0.99 ) || ( time_ratio >= 1.01 ) stdout_thread = ` ./bin/runner configs/multithread_two_randomwalk.json ` time_ratio = get_time_ratio ( stdout_thread ) next if ( time_ratio <= 0.99 ) || ( time_ratio >= 1.01 ) break end process_time = 0.0 thread_time = 0.0 files = Dir [ "results/*.json" ] files . each do | f | kernel_time = get_kernel_time ( f ) if f =~ / multiprocess_ / process_time += kernel_time elsif f =~ / multithread_ / thread_time += kernel_time end end process_time / thread_time end
Runs a single instance of the benchmark and returns the overhead of
multiprocess vs. multithread.
Runs a single instance of the benchmark and returns the overhead of multiprocess vs . multithread .
# Throw away runs in which either multiprocesses or threads don't have a # reasonable ratio of GPU time to real time from the globaltimer register. # Now, process all result files to determine the process vs. thread time.