#!/bin/bash # a script which compiles and runs a test program with a variety of compilers and options # Fetch benchmark code wget http://charm.cs.uiuc.edu/subnormal/files/subnormal_timetest.c wget http://charm.cs.uiuc.edu/subnormal/files/Bench.java # set delimiter for lists to be a colon, will be used by the for loops IFS=: COMPILERS="cc:icc:icpc:gcc:xlc:/opt/ibmcmp/vac/6.0/bin/xlc:/opt/ibmcmp/vac/6.0/bin/xlc_r:/opt/ibmcmp/vac/6.0/bin/gxlc:/opt/ibmcmp/vacpp/6.0/bin/gxlc:/opt/ibmcmp/vacpp/6.0/bin/xlc:/opt/ibmcmp/vacpp/6.0/bin/xlc_r" SOURCE=subnormal_timetest.c OPTSLIST="-O:-ffast-math:-O3:-O2:-mieee:-mieee-with-inexact:-mfp-trap-mode=u:-mieee-conformant::" HOSTNAME=`hostname -s` EXE=executable-$HOSTNAME RESULTS=results-$HOSTNAME.txt #erase results file cat /dev/null > $RESULTS if [ -e "/proc/cpuinfo" ]; then cat /proc/cpuinfo >> $RESULTS fi # Add kernel version and date date >> $RESULTS uname -a >> $RESULTS hostname >> $RESULTS echo "=================================================================" >> $RESULTS for OPTS in $OPTSLIST do for COMPILER in $COMPILERS do if [ `which $COMPILER 2> /dev/null` ]; then COMPILERFULLPATH=`which $COMPILER` if [ -x $COMPILERFULLPATH ]; then echo "- - - - - - - - - - - - - - - - - - - - - - - - - - - - -" >> $RESULTS if [ ! `$COMPILERFULLPATH $SOURCE $OPTS -o $EXE` ]; then echo $COMPILERFULLPATH $SOURCE $OPTS -o $EXE echo $COMPILERFULLPATH $SOURCE $OPTS >> $RESULTS $COMPILERFULLPATH $SOURCE $OPTS -o $EXE ./$EXE >> $RESULTS rm $EXE fi fi fi done done echo "Running Java Version" echo "- - - - - - - - - - - - - - - - - - - - - - - - - - - - -" >> $RESULTS echo "JAVA Version: " >> $RESULTS javac Bench.java java Bench >> $RESULTS echo "Removing Temp files" rm subnormal_timetest.c rm Bench.java Bench.class echo "DONE"