cs205-lecture-examples

Example codes used during Harvard CS205 lectures
git clone https://git.0xfab.ch/cs205-lecture-examples.git
Log | Files | Refs | README | LICENSE

run_benchmark.sh (641B)


      1 #!/usr/bin/env bash
      2 # threads=(1 2 4 8 16 32 64) # AMD Opteron
      3 threads=(1 2 4 8 16 32) # Intel Xeon
      4 
      5 run() {
      6     fname="${1}"; shift
      7     echo '# threads parallel for parallel_for barrier single critical lock_unlock ordered atomic reduction' >${fname}
      8     for t in "${threads[@]}"; do
      9         echo -n "${t}" >>${fname}
     10         OMP_NUM_THREADS=$t ./openmpbench_C_v31/syncbench | \
     11             awk '/overhead/ {print $0}' | \
     12             awk -F '[^0-9.]+' '{printf "\t%e %e", $2, $3}' >>${fname}
     13         echo '' >>${fname}
     14     done
     15 }
     16 
     17 export OMP_PROC_BIND='false'
     18 run 'proc_bind_false.dat'
     19 
     20 export OMP_PROC_BIND='true'
     21 run 'proc_bind_true.dat'