root/guts_io/guts_io.sh

Revision 172 (checked in by apokayi, 10 months ago)

remove blinking from the final statiscal output

  • Property svn:executable set to *
Line 
1 #!/bin/sh
2
3 # GWU-HPCL Unified Testing Suite for UPC/IO implementation
4 # Script by Abdullah Kayi
5
6 if test -z "$1"; then
7         echo "Usage: ./guts.sh [number of threads] "
8         exit
9 fi
10
11 #go to the src directory
12 cd src
13
14 # Initial cleanup
15 if test -f units.passed; then
16         rm -f units.passed
17 fi
18
19 if test -f units.notpassed; then
20         rm -f units.notpassed
21 fi
22
23 printf "\n\n"
24 printf "_______________      Script for compiling and running GUTS      _______________\n\n"
25
26 umask 0002
27 NP=$1
28 UNITS=units
29 UNITS_SHARED=units_shared
30 echo "Running the testing suite for ${NP} threads"
31 printf "\n"
32 passed=0
33 failed=0
34 cmp_failed=0
35
36 UPCC=upcc
37
38 for UNIT in `cat ${UNITS}`; do
39         printf ">-------------->      Working on unit $UNIT\n"
40        
41         BUILD=`upcio-config -build`
42         build_output=`$UPCC -D__restrict="" -I../include $BUILD $UNIT.upc -o $UNIT >>$UNIT.out 2>$UNIT.errout`
43
44         if test $? -eq 0; then
45                 echo $build_output     
46                 echo "Compilation was SUCCESSFUL for the unit [${UNIT}]"
47                 echo "Now the unit [${UNIT}] will be run for ${NP} threads ..."
48                 RUN=`eval echo "upcrun -qn ${NP} ${UNIT}"`
49                 echo $RUN
50                 exe_output=`$RUN`
51                 if test $? -eq 0; then
52                         printf "TEST \033[34m\033[1mPASSED\033[0m for the unit [$UNIT]"
53                         echo $exe_output
54                         echo "$UNIT" >>units.passed
55                         passed=`expr $passed + 1`
56                 else
57                         printf "TEST \033[31m\033[1mFAILED\033[0m for the unit [$UNIT]"
58                         echo $exe_output
59                         echo "$UNIT" >>units.notpassed
60                         failed=`expr $failed + 1`
61                 fi
62                
63         else
64                 echo "COMPILER ERROR: The unit [$UNIT] cannot be compiled"
65                 echo "The unit will not be run!!!"
66                 cat $UNIT.errout
67                 echo "$UNIT" >>units.notpassed
68                 failed=`expr $failed + 1`
69                 cmp_failed=`expr $cmp_failed + 1`
70         fi     
71        
72         `rm -f *.o ${UNIT} ${UNIT}.*out`
73        
74         printf "\n"
75         printf "===============================================================================\n\n"
76 done
77
78 # necessary files to run the units
79
80 FILE=read.test
81 FILE_INT=read_int.test
82 touch write_test.txt
83
84 # check whether the MEMVEC size is enabled or not
85
86 upcio-config -build | grep "DMEMVEC"
87 e_memvec=$?
88
89 # compile and run the UNITS including shared functionality
90
91 for SUNIT in `cat ${UNITS_SHARED}`; do
92         printf ">-------------->      Working on unit -- $SUNIT\n"
93
94         SBUILD=`upcio-config -build`
95
96         `$UPCC -D__restrict="" -DMEMVEC_SIZE=1 -DTYPE=char -DBLOCKSIZE=0 -I../include \
97                                 $SBUILD $SUNIT.upc -o $SUNIT.char0 >>$SUNIT.char0.out 2>>$SUNIT.errout`
98        
99         `$UPCC -D__restrict="" -DMEMVEC_SIZE=1 -DTYPE=char -DBLOCKSIZE=1 -I../include \
100                                 $SBUILD $SUNIT.upc -o $SUNIT.char1  >>$SUNIT.char1.out 2>>$SUNIT.errout`
101
102         `$UPCC -D__restrict="" -DMEMVEC_SIZE=1 -DTYPE=char -DBLOCKSIZE=4 -I../include \
103                                 $SBUILD $SUNIT.upc -o $SUNIT.char4 >>$SUNIT.char4.out 2>>$SUNIT.errout`
104         if test $e_memvec -eq 0; then
105
106                 `$UPCC -D__restrict="" -DMEMVEC_SIZE=1 -DTYPE=int -DBLOCKSIZE=0 -I../include \
107                                         $SBUILD $SUNIT.upc -o $SUNIT.int0 >>$SUNIT.int0.out 2>>$SUNIT.errout`
108
109                 `$UPCC -D__restrict="" -DMEMVEC_SIZE=1 -DTYPE=int -DBLOCKSIZE=1 -I../include \
110                                         $SBUILD $SUNIT.upc -o $SUNIT.int1 >>$SUNIT.int1.out 2>>$SUNIT.errout`
111
112                 `$UPCC -D__restrict="" -DMEMVEC_SIZE=1 -DTYPE=int -DBLOCKSIZE=4 -I../include \
113                                         $SBUILD $SUNIT.upc -o $SUNIT.int4 >>$SUNIT.int4.out 2>>$SUNIT.errout`
114         fi
115
116         if test $? -eq 0; then
117                 echo "Compilation was SUCCESSFUL for the unit [${SUNIT}]"
118                
119                 echo "Now the unit [${SUNIT}] will be run for ${NP} threads by executing 6 sub-units ..."
120                 RUN_char0=`eval echo "upcrun -qn ${NP} ${SUNIT}.char0 ${FILE}"`
121                 echo ${RUN_char0}
122                 exe_output=`${RUN_char0}`
123                 if test $? -eq 0 ; then
124                         printf "TEST \033[34m\033[1mPASSED\033[0m for the unit [$SUNIT.char0]\n"
125                         echo $exe_output
126                         echo "${SUNIT}.char0" >>units.passed
127                         passed=`expr $passed + 1`
128                 else
129                         printf "TEST \033[31m\033[1mFAILED\033[0m for the unit [$SUNIT.char0]\n"
130                         echo $exe_output
131                         echo "${SUNIT}.char0" >>units.notpassed
132                         failed=`expr $failed + 1`
133                 fi
134
135                 RUN_char1=`eval echo "upcrun -qn ${NP} ${SUNIT}.char1 ${FILE}"`
136                 echo ${RUN_char1}
137                 exe_output=`${RUN_char1}`
138                 if test $? -eq 0; then
139                         printf "TEST \033[34m\033[1mPASSED\033[0m for the unit [$SUNIT.char1]\n"
140                         echo $exe_output
141                         echo "${SUNIT}.char1" >>units.passed
142                         passed=`expr $passed + 1`
143                 else
144                         printf "TEST \033[31m\033[1mFAILED\033[0m for the unit [$SUNIT.char1]\n"
145                         echo $exe_output
146                         echo "${SUNIT}.char1" >>units.notpassed
147                         failed=`expr $failed + 1`
148                 fi
149                
150                 RUN_char4=`eval echo "upcrun -qn ${NP} ${SUNIT}.char4 ${FILE}"`
151                 echo ${RUN_char4}
152                 exe_output=`${RUN_char4}`
153                 if test $? -eq 0; then
154                         printf "TEST \033[34m\033[1mPASSED\033[0m for the unit [$SUNIT.char4]\n"
155                         echo $exe_output
156                         echo "${SUNIT}.char4" >>units.passed
157                         passed=$((passed+1))
158                 else
159                         printf "TEST \033[31m\033[1mFAILED\033[0m for the unit [$SUNIT.char4]\n"
160                         echo $exe_output
161                         echo "${SUNIT}.char4" >>units.notpassed
162                         failed=`expr $failed + 1`
163                 fi
164
165                 if test $e_memvec -eq  0; then
166                         RUN_int0=`eval echo "upcrun -qn ${NP} ${SUNIT}.int0 ${FILE_INT}"`
167                         echo ${RUN_int0}
168                         exe_output=`${RUN_int0}`
169                         if test $? -eq 0; then
170                                 printf "TEST \033[34m\033[1mPASSED\033[0m for the unit [$SUNIT.int0]\n"
171                                 echo $exe_output
172                                 echo "${SUNIT}.int0" >>units.passed
173                                 passed=`expr $passed + 1`
174                         else
175                                 printf "TEST \033[31m\033[1mFAILED\033[0m for the unit [$SUNIT.int0]\n"
176                                 echo $exe_output
177                                 echo "${SUNIT}.int0" >>units.notpassed
178                                 failed=`expr $failed + 1`
179                         fi
180
181                         RUN_int1=`eval echo "upcrun -qn ${NP} ${SUNIT}.int1 ${FILE_INT}"`
182                         echo ${RUN_int1}
183                         exe_output=`${RUN_int1}`
184                         if test $? -eq 0; then
185                                 printf "TEST \033[34m\033[1mPASSED\033[0m for the unit [$SUNIT.int1]\n"
186                                 echo $exe_output
187                                 echo "${SUNIT}.int1" >>units.passed
188                                 passed=`expr $passed + 1`
189                         else
190                                 printf "TEST \033[31m\033[1mFAILED\033[0m for the unit [$SUNIT.int1]\n"
191                                 echo $exe_output
192                                 echo "${SUNIT}.int1" >>units.notpassed
193                                 failed=`expr $failed+1`
194                         fi
195
196                         RUN_int4=`eval echo "upcrun -qn ${NP} ${SUNIT}.int4 ${FILE_INT}"`
197                         echo ${RUN_int4}
198                         exe_output=`${RUN_int4}`
199                         if test $? -eq 0; then
200                                 printf "TEST \033[34m\033[1mPASSED\033[0m for the unit [$SUNIT.int4]\n"
201                                 echo $exe_output
202                                 echo "${SUNIT}.int4" >>units.passed
203                                 passed=`expr $passed + 1`
204                         else
205                                 printf "TEST \033[31m\033[1mFAILED\033[0m for the unit [$SUNIT.int4]\n"
206                                 echo $exe_output
207                                 echo "${SUNIT}.int4" >>units.notpassed
208                                 failed=`expr $failed + 1`
209                         fi
210                 fi
211
212         else
213                 echo "COMPILER ERROR: The unit [$SUNIT] cannot be compiled"
214                 echo "The unit will not be run!!!"
215                 cat $SUNIT.errout
216                 echo "$SUNIT" >>units.notpassed
217                 failed=`expr $failed + 1`
218                 cmp_failed=`expr $cmp_failed + 1`
219         fi
220
221         rm -f *.o ${SUNIT}.char[0,1,4] ${SUNIT}.int[0,1,4] ${SUNIT}.*out
222        
223         printf "\n"
224         printf "===============================================================================\n"
225        
226 done
227
228 rm -f *.test *.txt
229
230 # STATISTICAL OUTPUT
231
232 printf "________________       GWU-HPCL UPC/IO Testing Summary         ________________\n"
233 echo "SUCCESSFUL UNITS --> (units.passed)"
234 printf "\033[34m\033[1m"
235 if test -f units.passed; then
236         cat units.passed|sort|uniq
237 fi
238 printf "\033[0m"
239
240 echo "    FAILED UNITS --> (units.notpassed)"
241 printf "\033[31m\033[1m"
242 if test -f units.notpassed; then
243         cat units.notpassed|sort|uniq
244 fi
245 printf "\033[0m"
246
247 printf "\033[1m\033[1m\033[35m"
248 echo "                 -->      Number of units PASSED : $passed"
249 echo "                 -->      Number of units FAILED : $failed"
250 total=`expr $passed + $failed`
251 percentage=`expr $passed * 100 / $total`
252
253 printf "                 -->    $percentage % of the units have PASSED\n"
254 printf "\033[0m"
255 printf "===========================     TEST END    ====================================\n"
Note: See TracBrowser for help on using the browser.