-
Notifications
You must be signed in to change notification settings - Fork 12
/
example_run.sh
executable file
·183 lines (139 loc) · 5.14 KB
/
example_run.sh
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
#!/bin/sh
echo "PERF OPTIMIZE EXAMPLE"
echo "======================="
echo "ORIGINAL METHOD"
echo "======================="
bin_name="example1_original"
echo "No compiler optimize:"
gcc -g example1.c -D ORIGINAL_METHOD -o "$bin_name"
./"$bin_name"
echo "Data aligned:"
gcc -g example1.c -D ORIGINAL_METHOD -D ALIGN_DATA_TO_16_BYTE -o example
./example
echo "-O2 optimize:"
gcc -g -O2 example1.c -D ORIGINAL_METHOD -o example
./example
echo "-O2 optimize AND data aligned:"
gcc -g -O2 example1.c -D ORIGINAL_METHOD -D ALIGN_DATA_TO_16_BYTE -o example
./example
echo "-O3 optimize:"
gcc -g -O3 example1.c -D ORIGINAL_METHOD -o example
./example
echo "-O3 optimize AND data aligned:"
gcc -g -O3 example1.c -D ORIGINAL_METHOD -D ALIGN_DATA_TO_16_BYTE -o example
./example
echo "======================="
echo "FIXED_POINT_METHOD"
echo "======================="
echo "No compiler optimize:"
gcc -g example1.c -D FIXED_POINT_METHOD -o example
./example
echo "Data aligned:"
gcc -g example1.c -D FIXED_POINT_METHOD -D ALIGN_DATA_TO_16_BYTE -o example
./example
echo "-O2 optimize:"
gcc -g -O2 example1.c -D FIXED_POINT_METHOD -o example
./example
echo "-O2 optimize AND data aligned:"
gcc -g -O2 example1.c -D FIXED_POINT_METHOD -D ALIGN_DATA_TO_16_BYTE -o example
./example
echo "-O3 optimize:"
gcc -g -O3 example1.c -D FIXED_POINT_METHOD -o example
./example
echo "-O3 optimize AND data aligned:"
gcc -g -O3 example1.c -D FIXED_POINT_METHOD -D ALIGN_DATA_TO_16_BYTE -o example
./example
echo "======================="
echo "LOOP_UNROLLING_METHOD"
echo "======================="
echo "No compiler optimize:"
gcc -g example1.c -D LOOP_UNROLLING_METHOD -o example
./example
echo "Data aligned:"
gcc -g example1.c -D LOOP_UNROLLING_METHOD -D ALIGN_DATA_TO_16_BYTE -o example
./example
echo "-O2 optimize:"
gcc -g -O2 example1.c -D LOOP_UNROLLING_METHOD -o example
./example
echo "-O2 optimize AND data aligned:"
gcc -g -O2 example1.c -D LOOP_UNROLLING_METHOD -D ALIGN_DATA_TO_16_BYTE -o example
./example
echo "-O3 optimize:"
gcc -g -O3 example1.c -D LOOP_UNROLLING_METHOD -o example
./example
echo "-O3 optimize AND data aligned:"
gcc -g -O3 example1.c -D LOOP_UNROLLING_METHOD -D ALIGN_DATA_TO_16_BYTE -o example
./example
echo "======================="
echo "OPTIMIZED_STRUCT_METHOD_NO_INDEPENDENT_LOOP"
echo "======================="
echo "No compiler optimize:"
gcc -g example1.c -D OPTIMIZED_STRUCT_METHOD -D NO_INDEPENDENT_LOOP -o example
./example
echo "Data aligned:"
gcc -g example1.c -D OPTIMIZED_STRUCT_METHOD -D ALIGN_DATA_TO_16_BYTE -D NO_INDEPENDENT_LOOP -o example
./example
bin_name="example1_opt_no_idpdt_loop_O2"
echo "-O2 optimize:"
gcc -g -O2 -ftree-vectorize -msse2 example1.c -D OPTIMIZED_STRUCT_METHOD -D NO_INDEPENDENT_LOOP -o $bin_name
./$bin_name
gcc -g -S -O2 example1.c -D OPTIMIZED_STRUCT_METHOD -D NO_INDEPENDENT_LOOP -o "$bin_name.s"
echo "-O2 optimize AND data aligned:"
gcc -g -O2 example1.c -ftree-vectorize -msse2 -D OPTIMIZED_STRUCT_METHOD -D ALIGN_DATA_TO_16_BYTE -D NO_INDEPENDENT_LOOP -o example
./example
bin_name="example1_opt_no_idpdt_loop_O3"
echo "-O3 optimize:"
gcc -g -O3 example1.c -D OPTIMIZED_STRUCT_METHOD -D NO_INDEPENDENT_LOOP -o $bin_name
./$bin_name
gcc -g -S -O3 example1.c -D OPTIMIZED_STRUCT_METHOD -D NO_INDEPENDENT_LOOP -o "$bin_name.s"
echo "-O3 optimize AND data aligned:"
gcc -g -O3 example1.c -D OPTIMIZED_STRUCT_METHOD -D ALIGN_DATA_TO_16_BYTE -D NO_INDEPENDENT_LOOP -o example
./example
echo "======================="
echo "OPTIMIZED_STRUCT_METHOD_WITH_INDEPENDENT_LOOP"
echo "======================="
echo "No compiler optimize:"
gcc -g example1.c -D OPTIMIZED_STRUCT_METHOD -o example
./example
echo "Data aligned:"
gcc -g example1.c -D ALIGN_DATA_TO_16_BYTE -D OPTIMIZED_STRUCT_METHOD -o example
./example
bin_name="example1_opt_idpdt_loop_O2"
echo "-O2 optimize:"
gcc -g -O2 -ftree-vectorize -msse2 example1.c -D OPTIMIZED_STRUCT_METHOD -o $bin_name
./$bin_name
gcc -g -S -O2 example1.c -D OPTIMIZED_STRUCT_METHOD -o "bin_name.s"
bin_name="example1_opt_idpdt_loop_O2_aligned"
echo "-O2 optimize AND data aligned:"
gcc -g -O2 -ftree-vectorize -msse2 example1.c -D ALIGN_DATA_TO_16_BYTE -D OPTIMIZED_STRUCT_METHOD -o $bin_name
./$bin_name
bin_name="example1_opt_idpdt_loop_O3"
echo "-O3 optimize:"
gcc -g -O3 example1.c -D OPTIMIZED_STRUCT_METHOD -o $bin_name
./$bin_name
gcc -g -S -O3 example1.c -D OPTIMIZED_STRUCT_METHOD -o $bin_name.s
echo "-O3 optimize AND data aligned:"
gcc -g -O3 example1.c -D ALIGN_DATA_TO_16_BYTE -D OPTIMIZED_STRUCT_METHOD -o example
./example
echo "======================="
echo "SIMD_METHOD"
echo "======================="
echo "No compiler optimize:"
gcc -g example1.c -D SIMD_METHOD -o example
./example
echo "Data aligned:"
gcc -g example1.c -D ALIGN_DATA_TO_16_BYTE -D SIMD_METHOD -o example
./example
bin_name="example1_simd"
echo "-O2 optimize:"
gcc -g -O2 example1.c -D SIMD_METHOD -o $bin_name
./$bin_name
echo "-O2 optimize AND data aligned:"
gcc -g -O2 example1.c -D ALIGN_DATA_TO_16_BYTE -D SIMD_METHOD -o example
./example
echo "-O3 optimize:"
gcc -g -O3 example1.c -D SIMD_METHOD -o example
./example
echo "-O3 optimize AND data aligned:"
gcc -g -O3 example1.c -D ALIGN_DATA_TO_16_BYTE -D SIMD_METHOD -o example
./example