-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathrun.sh
executable file
·334 lines (304 loc) · 8.28 KB
/
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
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
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
#!/bin/bash
host=`hostname`
declare -a ipps=("PThreads" "OpenMP" "MPI-1" "MPI-2" "Sequential" "Ready" "All")
pthreadsIpp=0
openmpIpp=0
mpi1Ipp=0
mpi2Ipp=0
sequentialIpp=0
clear
echo "Which PPI do you want to perform?"
select ipp in "${ipps[@]}"
do
case $ipp in
"PThreads")pthreadsIpp=1;;
"OpenMP")openmpIpp=1;;
"MPI-1")mpi1Ipp=1;;
"MPI-2")mpi2Ipp=1;;
"Sequential")sequentialIpp=1;;
"All")
pthreadsIpp=1
openmpIpp=1
mpi1Ipp=1
mpi2Ipp=1
sequentialIpp=1
break;;
"Ready")break;;
*) echo "Invalid Option!";;
esac
done
clear
declare -a apps=("DFT" "DJ" "DP" "GS" "HA" "JA" "MM" "NI" "OE" "PI" "TR" "Ready" "All")
#GL=0
GS=0
JA=0
OE=0
TR=0
DFT=0
DJ=0
DP=0
HA=0
MM=0
PI=0
NI=0
#SH=0
echo "Which applications do you want to run?"
select app in "${apps[@]}"
do
case $app in
"GL")GL=1;;
"GS")GS=1;;
"JA")JA=1;;
"OE")OE=1;;
"TR")TR=1;;
"DFT")DFT=1;;
"DJ")DJ=1;;
"DP")DP=1;;
"HA")HA=1;;
"MM")MM=1;;
"PI")PI=1;;
"NI")NI=1;;
"SH")SH=1;;
"All")
GL=1
GS=1
JA=1
OE=1
TR=1
DFT=1
DJ=1
DP=1
HA=1
MM=1
PI=1
NI=1
SH=1
break;;
"Ready")break;;
*) echo "Invalid Option!";;
esac
done
clear
if [[ $pthreadsIpp -eq 1 || $openmpIpp -eq 1 || $mpi1Ipp -eq 1 || $mpi2Ipp -eq 1 ]]
then
echo "Set the amount of parallel tasks to used (MINIMUM 2). You can set a list separating the values by space (e.g. 2 8 16 20)."
read -a TASKS
for task in "${TASKS[@]}"
do
if [[ $task -eq 1 ]]
then
printf "\n\nValue 1 for parallel tasks is not allowed.\nIt is required at least 2 tasks.\n\nStart again and choose only the sequential option for running with a single thread.\n\n"
exit 1
fi
done
fi
clear
echo "Set the number of executions."
read -e EXECNUMBER
clear
echo "Choose the size of the input set (small, medium, large, or test)."
read -e SIZE
re1='[Ss]mall|SMALL|[Mm]edium|MEDIUM|[Ll]arge|LARGE|[Tt]est|TEST'
if ! [[ $SIZE =~ $re1 ]] ; then
echo "Invalid Size!"
exit 1
fi
printf "Selected PPIs: "
for ipp in ${ipps[@]}
do
if [[ $ipp -eq 1 ]]
then
printf "$ipp "
fi
done
echo ""
printf "Selected Applications: "
for app in ${apps[@]}
do
if [[ $app -eq 1 ]]
then
printf "$app "
fi
done
echo ""
echo "Problem size: $SIZE"
echo "Number of executions: $EXECNUMBER"
printf "Tasks: "
for task in "${TASKS[@]}"
do
printf "$task "
done
printf "\n\n"
echo "Confirm? (yes/no)"
read CONFIRM
re2='[Yy]es|YES|[Yy]'
if ! [[ $CONFIRM =~ $re2 ]] ; then
exit 1
fi
clear
if [[ $SIZE = "small" || $SIZE = "Small" || $SIZE = "SMALL" ]]; then
#declare -a inputGL=("512")
declare -a inputGS=("512")
declare -a inputJA=("1024")
declare -a inputOE=("150000")
declare -a inputTR=("1024")
declare -a inputDFT=("16184")
declare -a inputDJ=("1024")
declare -a inputDP=("10000000000")
declare -a inputHA=("50000")
declare -a inputMM=("2048")
declare -a inputPI=("1000000000")
declare -a inputNI=("750000000")
elif [[ $SIZE = "medium" || $SIZE = "Medium" || $SIZE = "MEDIUM" ]]; then
#declare -a inputGL=("2048")
declare -a inputGS=("1024")
declare -a inputJA=("2048")
declare -a inputOE=("225000")
declare -a inputTR=("2048")
declare -a inputDFT=("32368")
declare -a inputDJ=("2048")
declare -a inputDP=("15000000000")
declare -a inputHA=("100000")
declare -a inputMM=("4096")
declare -a inputPI=("4000000000")
declare -a inputNI=("1000000000")
elif [[ $SIZE = "large" || $SIZE = "Large" || $SIZE = "LARGE" ]]; then
#declare -a inputGL=("4096")
declare -a inputGS=("4096")
declare -a inputJA=("4096")
declare -a inputOE=("300000")
declare -a inputTR=("4096")
declare -a inputDFT=("64736")
declare -a inputDJ=("4096")
declare -a inputDP=("20000000000")
declare -a inputHA=("150000")
declare -a inputMM=("8192")
declare -a inputPI=("6000000000")
declare -a inputNI=("1500000000")
elif [[ $SIZE = "test" || $SIZE = "Test" || $SIZE = "TEST" ]]; then
declare -a inputGL=("256")
declare -a inputGS=("256")
declare -a inputJA=("256")
declare -a inputOE=("1500")
declare -a inputTR=("256")
declare -a inputDFT=("256")
declare -a inputDJ=("256")
declare -a inputDP=("1000")
declare -a inputHA=("1000")
declare -a inputMM=("256")
declare -a inputPI=("4000")
declare -a inputNI=("1000")
#declare -a inputSHWidth=("1080")
#declare -a inputSHHeight=("1920")
else
echo "Invalid Option!"
fi
gcc -o ./Apps/DJ/geraGrafo ./Apps/DJ/geraGrafoDJ.c
./Apps/DJ/geraGrafo "$inputDJ" "./Apps/DJ/inputDJ/$inputDJ.txt"
rm ./Apps/DJ/geraGrafo
vseq=("$inputDFT"
"$inputDJ Apps/DJ/inputDJ/$inputDJ.txt"
"$inputDP"
"$inputGS"
"$inputHA $inputHA"
"$inputJA"
"$inputMM"
"$inputNI"
"$inputOE"
"$inputPI"
"$inputTR"
)
for step in `seq 1 $EXECNUMBER`; do
date +"%d/%m/%Y %H:%M:%S"
printf " Running on $host \n"
printf " Step: $step \n\n"
if [[ $sequentialIpp -eq 1 ]]
then
for app in ${apps[@]}; do
if [[ $app -eq 1 ]]
then
let "n=(`echo ${apps[@]} | tr -s " " "\n" | grep -n "$app" | cut -d":" -f 1`)-1" #get the app index
input=${vseq[$n]}
date +"%d/%m/%Y %H:%M:%S"
printf " Application: $app\n"
printf " IPP:\t Sequential\n"
printf " Input:\t $input\n"
time=`./Apps/$app/sequential $input|grep -i time | awk {'print $3'}`
printf " Time:\t $time\n\n"
fi
done
fi
for th in "${TASKS[@]}"; do
if [[ $pthreadsIpp -eq 1 ]]
then
for app in ${apps[@]}; do
if [[ $app -eq 1 ]]
then
let "n=(`echo ${apps[@]} | tr -s " " "\n" | grep -n "$app" | cut -d":" -f 1`)-1" #get the app index
input=${vseq[$n]}
date +"%d/%m/%Y %H:%M:%S"
printf " Application: $app\n"
printf " IPP:\t Pthread\n"
printf " Threads:\t $th\n"
printf " Input:\t $input\n"
time=`./Apps/$app/pthread $th $input|grep -i time | awk {'print $3'}`
printf " Time:\t $time\n\n"
fi
done
fi
if [[ $openmpIpp -eq 1 ]]
then
for app in ${apps[@]}; do
if [[ $app -eq 1 ]]
then
let "n=(`echo ${apps[@]} | tr -s " " "\n" | grep -n "$app" | cut -d":" -f 1`)-1" #get the app index
input=${vseq[$n]}
date +"%d/%m/%Y %H:%M:%S"
printf " Application: $app\n"
printf " IPP:\t OpenMP\n"
printf " Threads:\t $th\n"
printf " Input:\t $input\n"
time=`./Apps/$app/openmp $th $input|grep -i time | awk {'print $3'}`
printf " Time:\t $time\n\n"
fi
done
fi
if [[ $mpi1Ipp -eq 1 ]]
then
for app in ${apps[@]}; do
if [[ $app -eq 1 ]]
then
let "n=(`echo ${apps[@]} | tr -s " " "\n" | grep -n "$app" | cut -d":" -f 1`)-1" #get the app index
input=${vseq[$n]}
date +"%d/%m/%Y %H:%M:%S"
printf " Application: $app\n"
printf " IPP:\t MPI-1\n"
printf " Threads:\t $th\n"
printf " Input:\t $input\n"
time=`mpirun -np $th ./Apps/$app/mpi1 $input|grep -i time | awk {'print $3'}`
printf " Time:\t $time\n\n"
fi
done
fi
if [[ $mpi2Ipp -eq 1 ]]
then
for app in ${apps[@]}; do
if [[ $app -eq 1 ]]
then
let "n=(`echo ${apps[@]} | tr -s " " "\n" | grep -n "$app" | cut -d":" -f 1`)-1" #get the app index
input=${vseq[$n]}
date +"%d/%m/%Y %H:%M:%S"
printf " Application: $app\n"
printf " IPP:\t MPI-2\n"
printf " Threads:\t $th\n"
printf " Input:\t $input\n"
time=`mpirun -np 1 ./Apps/$app/pai $(($th-1)) $input ./Apps/$app/filho |grep -i time | awk {'print $3'}`
printf " Time:\t $time\n\n"
fi
done
fi
done
done
date +"%d/%m/%Y %H:%M:%S"
echo "DONE!"
exit