-
Notifications
You must be signed in to change notification settings - Fork 5
/
run.sh
executable file
·32 lines (25 loc) · 853 Bytes
/
run.sh
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
#!/bin/bash
###
### Benchmark CUDA and OpenMP code performance
###
echo "GPUkernelcalls,time" > GPU_performance.csv
echo "EquivalentGPUkernelcalls,time" > OpenMP_performance.csv
export OMP_NUM_THREADS=24
echo "Running with $OMP_NUM_THREADS OpenMP threads"
# Run codes with varying numbers of Monte Carlo insertions, $n
for n in `seq 1 10 500` ; do
echo "Running with $n GPU kernel calls"
###
# GPU code
###
t=$({ time ./henry_gpu $n >/dev/null; } |& grep real | awk '{print $2}')
echo -e "\tCUDA run time: $t"
echo "$n,$t" >> GPU_performance.csv # write results to .csv
###
# OpenMP code
###
t=$({ time ./henry_cpu $n >/dev/null; } |& grep real | awk '{print $2}')
echo -e "\tOpenMP run time: $t"
echo "$n,$t" >> OpenMP_performance.csv # write results to .csv
done
python plot_performance.py