# common functions for doing experiments $cuda_device = 3; $cuda_device_max_connections = 24; # init experiment sub init_exp { #inputs $input_hits = "../../data/stt-hits.csv"; $max_nhits = int(`cat $input_hits | wc -l`); #compile system "make -C ../.. -j"; #or die "cannot compile triplets application"; $exe_dir = "../.."; $exe = "bin/triplets"; } # init_exp # init experiment sub init_exp_k10 { #inputs $input_hits = "../../data/stt-hits.csv"; $max_nhits = `cat $input_hits | wc -l`; #compile system "make WITH_DYN_PAR=0 -C ../.. -j"; #or die "cannot compile triplets application"; $exe_dir = "../.."; $exe = "bin/triplets.nodyn"; } # init_exp # runs the test with the specified parameters (in command line) $ntries number # of times; # sets variables $avg_time and $perf to average running time (in s) and # performance (in Mhits/s), respectively sub run_test { #TODO: prevent adding -n$nhits argument if already specified $run_args = (join " ", @_) . " -n$nhits"; $sum_time = 0; # print "$run_args\n"; for($itry = 0; $itry < $ntries; $itry++) { $time_ms = `cd $exe_dir; CUDA_VISIBLE_DEVICES=$cuda_device CUDA_DEVICE_MAX_CONNECTIONS=$cuda_device_max_connections $exe $run_args | grep 'total reconstruction' | awk '{print \$4}'`; $sum_time += $time_ms * 0.001; } $avg_time = $sum_time / $ntries; $perf = $nhits / $avg_time * 1e-6; } sub run_test_k10 { #TODO: prevent adding -n$nhits argument if already specified $run_args = (join " ", @_) . " -n$nhits"; $sum_time = 0; for($itry = 0; $itry < $ntries; $itry++) { $time_ms = `cd $exe_dir; CUDA_VISIBLE_DEVICES=$cuda_device OMP_NUM_THREADS=$cuda_device_max_connections $exe $run_args | grep 'total reconstruction' | awk '{print \$4}'`; $sum_time += $time_ms * 0.001; } $avg_time = $sum_time / $ntries; $perf = $nhits / $avg_time * 1e-6; }