forked from bondhugula/pluto
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.sh.in
executable file
·211 lines (195 loc) · 6.89 KB
/
test.sh.in
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
#!/bin/bash
#
# Tests based on LLVM FileCheck.
#
PLUTO=tool/pluto
FILECHECK=FileCheck
num_succ=0
num_fail=0
# Test helper.
check_ret_val_emit_status() {
if [ $? -ne 0 ]; then
echo -e "[\e[31mFailed\e[0m]" " $file"!
num_fail=$(($num_fail + 1))
else
echo -e "[\e[32mPassed\e[0m]"
num_succ=$(($num_succ + 1))
fi
}
TESTS="\
@top_srcdir@/test/1dloop-invar.c \
@top_srcdir@/test/costfunc.c \
@top_srcdir@/test/doitgen.c \
@top_srcdir@/test/fdtd-2d.c \
@top_srcdir@/test/fusion1.c \
@top_srcdir@/test/fusion2.c \
@top_srcdir@/test/fusion3.c \
@top_srcdir@/test/fusion4.c \
@top_srcdir@/test/fusion5.c \
@top_srcdir@/test/fusion6.c \
@top_srcdir@/test/fusion7.c \
@top_srcdir@/test/fusion8.c \
@top_srcdir@/test/fusion9.c \
@top_srcdir@/test/fusion10.c \
@top_srcdir@/test/gemver.c \
@top_srcdir@/test/jacobi-1d-imper.c \
@top_srcdir@/test/jacobi-2d-imper.c \
@top_srcdir@/test/intratileopt1.c \
@top_srcdir@/test/intratileopt2.c \
@top_srcdir@/test/intratileopt3.c \
@top_srcdir@/test/intratileopt4.c \
@top_srcdir@/test/matmul.c \
@top_srcdir@/test/matmul-seq.c \
@top_srcdir@/test/matmul-seq3.c \
@top_srcdir@/test/multi-loop-param.c \
@top_srcdir@/test/multi-stmt-stencil-seq.c \
@top_srcdir@/test/mvt.c \
@top_srcdir@/test/mxv.c \
@top_srcdir@/test/mxv-seq.c \
@top_srcdir@/test/mxv-seq3.c \
@top_srcdir@/test/negparam.c \
@top_srcdir@/test/nodep.c \
@top_srcdir@/test/noloop.c \
@top_srcdir@/test/polynomial.c \
@top_srcdir@/test/seidel.c \
@top_srcdir@/test/seq.c \
@top_srcdir@/test/shift.c \
@top_srcdir@/test/spatial.c \
@top_srcdir@/test/tce-4index-transform.c \
@top_srcdir@/test/tricky1.c \
@top_srcdir@/test/tricky2.c \
@top_srcdir@/test/tricky3.c \
@top_srcdir@/test/tricky4.c \
@top_srcdir@/test/wavefront.c \
"
# Tests without --pet and without any tiling and parallelization.
for file in $TESTS; do
printf '%-50s ' $file
$PLUTO --notile --noparallel $file $* -o test_temp_out.pluto.c | $FILECHECK $file
check_ret_val_emit_status
done
# Test per cc objective
printf '%-50s ' @top_srcdir@/test/test-per-cc-obj.c
$PLUTO --notile --noparallel --per-cc-obj @top_srcdir@/test/test-per-cc-obj.c -o test_tmp_out.pluto.c | $FILECHECK --check-prefix CC-OBJ-CHECK @top_srcdir@/test/test-per-cc-obj.c
check_ret_val_emit_status
# Test typed fusion with dfp. These cases are executed only when glpk or gurobi
# is enabled. Either of these solvers is required by the dfp framework.
if grep -q -e "#define GLPK 1" -e "#define GUROBI 1" config.h; then
TESTS="@top_srcdir@/test/dfp/typed-fuse-1.c\
@top_srcdir@/test/dfp/typed-fuse-2.c\
@top_srcdir@/test/dfp/typed-fuse-3.c\
"
for file in $TESTS; do
printf '%-50s ' $file
$PLUTO --typedfuse $file $* -o test_tmp_out.pluto.c | $FILECHECK --check-prefix TYPED-FUSE-CHECK $file
check_ret_val_emit_status
done
# Test loop distribution with dfp
TESTS="@top_srcdir@/test/dfp/scalar-distribute.c\
"
for file in $TESTS; do
printf '%-50s ' "$file with --dfp"
$PLUTO --dfp $file $* -o test_tmp_out.pluto.c | $FILECHECK $file
check_ret_val_emit_status
done
# Test greedy greedy coloring heuristic and stencil check in Pluto-lp-dfp
TESTS="test/dfp/fdtd-2d.c\
"
for file in $TESTS; do
printf '%-50s ' "$file with --dfp --clusterscc --lpcolor"
$PLUTO --typedfuse --lpcolor $file -o test_tmp_out.pluto.c | $FILECHECK $file
check_ret_val_emit_status
done
fi
TESTS_TILE_PARALLEL="\
@top_srcdir@/test/dep-1,1.c \
@top_srcdir@/test/diamond-tile-example.c
"
echo -e "\nTest without pet frontend but with tiling / parallelization"
echo "============================================================"
for file in $TESTS_TILE_PARALLEL; do
printf '%-50s ' "$file with --tile --parallel"
$PLUTO $file -o test_temp_out.pluto.c | $FILECHECK --check-prefix TILE-PARALLEL $file
check_ret_val_emit_status
done
TEST_MORE_INTRA_TILE_OPT="\
@top_srcdir@/test/intratileopt5.c
"
for file in $TEST_MORE_INTRA_TILE_OPT; do
printf '%-50s ' "$file"
$PLUTO $file -o test_temp_out.pluto.c | $FILECHECK --check-prefix TILE-PARALLEL $file
check_ret_val_emit_status
printf '%-50s ' "$file with --notile"
$PLUTO --notile $file -o test_temp_out.pluto.c | $FILECHECK $file
check_ret_val_emit_status
done
TESTS_PET="\
@top_srcdir@/test/heat-2d.c \
@top_srcdir@/test/heat-3d.c \
@top_srcdir@/test/jacobi-3d-25pt.c \
@top_srcdir@/test/matmul.c \
"
# Tests with pet frontend with tiling and parallelization disabled.
echo -e "\nTest with pet frontend with no tiling / parallelization"
echo "============================================================"
for file in $TESTS_PET; do
printf '%-50s ' $file
$PLUTO $file --pet --notile --noparallel -o test_temp_out.pluto.c | $FILECHECK $file
check_ret_val_emit_status
done
# Tests with pet frontend with tiling and parallelization enabled.
echo -e "\nTest with pet frontend with tiling / parallelization"
echo "============================================================"
for file in $TESTS_PET; do
printf '%-50s ' "$file with --tile --parallel"
$PLUTO $file --pet -o test_temp_out.pluto.c | $FILECHECK --check-prefix TILE-PARALLEL $file
check_ret_val_emit_status
done
# Test with ISS
echo -e "\nTest ISS"
echo "========"
TESTS_ISS="\
@top_srcdir@/test/jacobi-2d-periodic.c \
@top_srcdir@/test/multi-stmt-periodic.c \
@top_srcdir@/test/heat-2dp.c \
"
for file in $TESTS_ISS; do
printf '%-50s ' $file
$PLUTO --pet --iss --notile --noparallel $file $* -o test_temp_out.pluto.c | $FILECHECK $file
check_ret_val_emit_status
done
# Test libpluto interface.
echo -e "\nTest libpluto interface"
file=@top_srcdir@/test/test_libpluto.c
echo "============================="
printf '%-50s ' test_libpluto
./test_libpluto | $FILECHECK @top_srcdir@/test/test_libpluto.c
check_ret_val_emit_status
# Unit tests
echo -e "\nUnit tests"
echo "==============="
printf '%-50s ' unit_tests
# Filter out all "// " comments from unit_tests.in when sending input to
# 'unit_tests'.
cat @top_srcdir@/test/unit_tests.in | grep -v "^// " | ./unit_tests | $FILECHECK @top_srcdir@/test/unit_tests.in
check_ret_val_emit_status
# TODO: add tests that check the generated code for certain things (like stmt
# body source esp. while using --pet).
# Unroll jam tests. These tests check the generated code.
echo -e "\nTest Unroll jam"
echo "===================="
TESTS_UNROLL_JAM="@top_srcdir@/test/unrolljam.c"
for file in $TESTS_UNROLL_JAM; do
printf '%-50s ' $file
$PLUTO --unrolljam --silent --ufactor=2 $file -o test_temp_out.pluto.c && cat test_temp_out.pluto.c | $FILECHECK $file
check_ret_val_emit_status
done
cleanup()
{
rm -f test_temp_out.pluto.c
rm -f test_temp_out.pluto.pluto.cloog
}
echo ===========================
echo -e "$num_succ / $(($num_succ + $num_fail)) tests \e[32mPASSED\e[0m"
echo ===========================
trap cleanup SIGINT exit