bench_multi_compilers.sh 618 B

12345678910111213141516171819202122232425262728
  1. #!/bin/bash
  2. if (($# < 2)); then
  3. echo "Usage: $0 compilerlist.txt benchfile.cpp"
  4. else
  5. compilerlist=$1
  6. benchfile=$2
  7. g=0
  8. source $compilerlist
  9. # for each compiler, compile benchfile and run the benchmark
  10. for (( i=0 ; i<g ; ++i )) ; do
  11. # check the compiler exists
  12. compiler=`echo ${CLIST[$i]} | cut -d " " -f 1`
  13. if [ -e `which $compiler` ]; then
  14. echo "${CLIST[$i]}"
  15. # echo "${CLIST[$i]} $benchfile -I.. -o bench~"
  16. # if [ -e ./.bench ] ; then rm .bench; fi
  17. ${CLIST[$i]} $benchfile -I.. -o .bench && ./.bench 2> /dev/null
  18. echo ""
  19. else
  20. echo "compiler not found: $compiler"
  21. fi
  22. done
  23. fi