source: trunk/examples/nardi/shallow_performanceMeasurement/scriptPerformance.sh @ 415

Last change on this file since 415 was 415, checked in by lnalod, 14 years ago

Script matlab for the bruit.

  • Property svn:eol-style set to native
  • Property svn:executable set to *
File size: 16.6 KB
Line 
1#!/bin/bash
2############################## Script which provides the results for the performances on the Shallow water example ######################
3
4#svn checkout svn+ssh://lnalod@forge.ipsl.jussieu.fr/ipsl/forge/projets/yao/svn/trunk/examples/nardi/shallow_performanceMeasurement /tmp/shallow_perfomanceMeasurement
5#cd /tmp/shallow_perfomanceMeasurement
6
7
8##################################### Result for space dimension 50x50 ############################################################
9YaoI +O3 shalw_50x50
10# Copy the file which allows to make the average of the elapsed times of forward and backward.
11cp -f 2shalw_50x50.h Yworkdir/Y2shalw_50x50.h
12YaoI +O3 shalw_50x50
13# Serial execution
14echo num threads: serial...
15time ./shalw_50x50 > resultNotParallelFile_50x50.txt
16
17YaoI -p +O3 shalw_50x50
18# 1 thread execution
19echo num threads: 1
20OMP_NUM_THREADS=1 time ./shalw_50x50 > resultParallelFile_1thread_50x50.txt
21
22# 2 thread execution
23echo num threads: 2
24OMP_NUM_THREADS=2 time ./shalw_50x50 > resultParallelFile_2thread_50x50.txt
25
26# 4 thread execution
27echo num threads: 4
28OMP_NUM_THREADS=4 time ./shalw_50x50 > resultParallelFile_4thread_50x50.txt
29
30# 8 thread execution
31echo num threads: 8
32OMP_NUM_THREADS=8 time ./shalw_50x50 > resultParallelFile_8thread_50x50.txt
33
34
35##################################### Result for space dimension 100x100 ############################################################
36YaoI +O3 shalw_100x100
37# Copy the file which allows to make the average of the elapsed times of forward and backward.
38cp -f 2shalw_100x100.h Yworkdir/Y2shalw_100x100.h
39YaoI +O3 shalw_100x100
40# Serial execution
41echo num threads: serial...
42time ./shalw_100x100 > resultNotParallelFile_100x100.txt
43
44YaoI -p +O3 shalw_100x100
45# 1 thread execution
46echo num threads: 1
47OMP_NUM_THREADS=1 time ./shalw_100x100 > resultParallelFile_1thread_100x100.txt
48
49# 2 thread execution
50echo num threads: 2
51OMP_NUM_THREADS=2 time ./shalw_100x100 > resultParallelFile_2thread_100x100.txt
52
53# 4 thread execution
54echo num threads: 4
55OMP_NUM_THREADS=4 time ./shalw_100x100 > resultParallelFile_4thread_100x100.txt
56
57# 8 thread execution
58echo num threads: 8
59OMP_NUM_THREADS=8 time ./shalw_100x100 > resultParallelFile_8thread_100x100.txt
60
61
62##################################### Result for space dimension 200x200 ############################################################
63YaoI +O3 shalw_200x200
64# Copy the file which allows to make the average of the elapsed times of forward and backward.
65cp -f 2shalw_200x200.h Yworkdir/Y2shalw_200x200.h
66YaoI +O3 shalw_200x200
67# Serial execution
68echo num threads: serial...
69time ./shalw_200x200 > resultNotParallelFile_200x200.txt
70
71YaoI -p +O3 shalw_200x200
72# 1 thread execution
73echo num threads: 1
74OMP_NUM_THREADS=1 time ./shalw_200x200 > resultParallelFile_1thread_200x200.txt
75
76# 2 thread execution
77echo num threads: 2
78OMP_NUM_THREADS=2 time ./shalw_200x200 > resultParallelFile_2thread_200x200.txt
79
80# 4 thread execution
81echo num threads: 4
82OMP_NUM_THREADS=4 time ./shalw_200x200 > resultParallelFile_4thread_200x200.txt
83
84# 8 thread execution
85echo num threads: 8
86OMP_NUM_THREADS=8 time ./shalw_200x200 > resultParallelFile_8thread_200x200.txt
87
88
89
90###################################################################################################################################
91###################################################################################################################################
92
93##### Speedups
94# In the Shallow all the code is parallel (we are measuring only the nested loops). We do not need to compute de Amdahl speedup.
95
96# P is the number of cores. P is serial. P4 is 4 cores.
97P=1
98P1=1
99P2=2
100P4=4
101P8=8
102
103# E elapsed time of the serial version. E1 for the 1 thread version. E2 for the 2 threads version.
104##################################### space 50x50 ############################################################
105E_50x50=`awk '/counter 2300/ {print $4}' resultNotParallelFile_50x50.txt`
106E1_50x50=`awk '/counter 2300/ {print $4}' resultParallelFile_1thread_50x50.txt`
107E2_50x50=`awk '/counter 2300/ {print $4}' resultParallelFile_2thread_50x50.txt`
108E4_50x50=`awk '/counter 2300/ {print $4}' resultParallelFile_4thread_50x50.txt`
109E8_50x50=`awk '/counter 2300/ {print $4}' resultParallelFile_8thread_50x50.txt`
110echo Elapsed time 50x50 serial version
111echo $E_50x50
112echo Elapsed time 1 thread
113echo $E1_50x50
114echo Elapsed time 2 threads
115echo $E2_50x50
116echo Elapsed time 4 threads
117echo $E4_50x50
118echo Elapsed time 8 threads
119echo $E8_50x50
120echo 
121
122##################################### space 100x100 ############################################################
123E_100x100=`awk '/counter 2100/ {print $4}' resultNotParallelFile_100x100.txt`
124E1_100x100=`awk '/counter 2100/ {print $4}' resultParallelFile_1thread_100x100.txt`
125E2_100x100=`awk '/counter 2100/ {print $4}' resultParallelFile_2thread_100x100.txt`
126E4_100x100=`awk '/counter 2100/ {print $4}' resultParallelFile_4thread_100x100.txt`
127E8_100x100=`awk '/counter 2100/ {print $4}' resultParallelFile_8thread_100x100.txt`
128echo Elapsed time 100x100 serial version
129echo $E_100x100
130echo Elapsed time 1 thread
131echo $E1_100x100
132echo Elapsed time 2 threads
133echo $E2_100x100
134echo Elapsed time 4 threads
135echo $E4_100x100
136echo Elapsed time 8 threads
137echo $E8_100x100
138echo 
139
140##################################### space 200x200 ############################################################
141E_200x200=`awk '/counter 2100/ {print $4}' resultNotParallelFile_200x200.txt`
142E1_200x200=`awk '/counter 2100/ {print $4}' resultParallelFile_1thread_200x200.txt`
143E2_200x200=`awk '/counter 2100/ {print $4}' resultParallelFile_2thread_200x200.txt`
144E4_200x200=`awk '/counter 2100/ {print $4}' resultParallelFile_4thread_200x200.txt`
145E8_200x200=`awk '/counter 2100/ {print $4}' resultParallelFile_8thread_200x200.txt`
146echo Elapsed time 200x200 serial version
147echo $E_200x200
148echo Elapsed time 1 thread
149echo $E1_200x200
150echo Elapsed time 2 threads
151echo $E2_200x200
152echo Elapsed time 4 threads
153echo $E4_200x200
154echo Elapsed time 8 threads
155echo $E8_200x200
156echo 
157
158
159###################################################################################################################################
160###################################################################################################################################
161
162# Computation of the real speedup. R is the real speedup of the serial version (is always 1). R2 for the 2 threads version
163##################################### space 50x50 ############################################################
164R_50x50=1
165R1_50x50=`echo "scale=6;  $E_50x50/$E1_50x50" | bc`
166R2_50x50=`echo "scale=6;  $E_50x50/$E2_50x50" | bc`
167R4_50x50=`echo "scale=6;  $E_50x50/$E4_50x50" | bc`
168R8_50x50=`echo "scale=6;  $E_50x50/$E8_50x50" | bc`
169echo Real speedup 50x50 serial version
170echo $R_50x50
171echo Real speedup 1 thread
172echo $R1_50x50
173echo Real speedup 2 threads
174echo $R2_50x50
175echo Real speedup 4 threads
176echo $R4_50x50
177echo Real speedup 8 threads
178echo $R8_50x50
179echo 
180
181
182##################################### space 100x100 ############################################################
183R_100x100=1
184R1_100x100=`echo "scale=6;  $E_100x100/$E1_100x100" | bc`
185R2_100x100=`echo "scale=6;  $E_100x100/$E2_100x100" | bc`
186R4_100x100=`echo "scale=6;  $E_100x100/$E4_100x100" | bc`
187R8_100x100=`echo "scale=6;  $E_100x100/$E8_100x100" | bc`
188echo Real speedup 100x100 serial version
189echo $R_100x100
190echo Real speedup 1 thread
191echo $R1_100x100
192echo Real speedup 2 threads
193echo $R2_100x100
194echo Real speedup 4 threads
195echo $R4_100x100
196echo Real speedup 8 threads
197echo $R8_100x100
198echo 
199
200
201##################################### space 200x200 ############################################################
202R_200x200=1
203R1_200x200=`echo "scale=6;  $E_200x200/$E1_200x200" | bc`
204R2_200x200=`echo "scale=6;  $E_200x200/$E2_200x200" | bc`
205R4_200x200=`echo "scale=6;  $E_200x200/$E4_200x200" | bc`
206R8_200x200=`echo "scale=6;  $E_200x200/$E8_200x200" | bc`
207echo Real speedup 200x200 serial version
208echo $R_200x200
209echo Real speedup 1 thread
210echo $R1_200x200
211echo Real speedup 2 threads
212echo $R2_200x200
213echo Real speedup 4 threads
214echo $R4_200x200
215echo Real speedup 8 threads
216echo $R8_200x200
217echo 
218
219###################################################################################################################################
220###################################################################################################################################
221
222
223# Computation of the efficency. EFF is the efficency of the serial version (is always 100). EFF2 for the 2 threads version
224# (Formule Speedup / number of cores) * 100
225##################################### space 50x50 ############################################################
226EFF_50x50=100
227EFF1_50x50=`echo "scale=6;  ($R1_50x50/$P1)*100" | bc`
228EFF2_50x50=`echo "scale=6;  ($R2_50x50/$P2)*100" | bc`
229EFF4_50x50=`echo "scale=6;  ($R4_50x50/$P4)*100" | bc`
230EFF8_50x50=`echo "scale=6;  ($R8_50x50/$P8)*100" | bc`
231echo Efficency 50x50 serial version
232echo $EFF_50x50
233echo Efficency 1 thread
234echo $EFF1_50x50
235echo Efficency 2 threads
236echo $EFF2_50x50
237echo Efficency 4 threads
238echo $EFF4_50x50
239echo Efficency 8 threads
240echo $EFF8_50x50
241echo 
242
243
244##################################### space 100x100 ############################################################
245EFF_100x100=100
246EFF1_100x100=`echo "scale=6;  ($R1_100x100/$P1)*100" | bc`
247EFF2_100x100=`echo "scale=6;  ($R2_100x100/$P2)*100" | bc`
248EFF4_100x100=`echo "scale=6;  ($R4_100x100/$P4)*100" | bc`
249EFF8_100x100=`echo "scale=6;  ($R8_100x100/$P8)*100" | bc`
250echo Efficency 100x100 serial version
251echo $EFF_100x100
252echo Efficency 1 thread
253echo $EFF1_100x100
254echo Efficency 2 threads
255echo $EFF2_100x100
256echo Efficency 4 threads
257echo $EFF4_100x100
258echo Efficency 8 threads
259echo $EFF8_100x100
260echo 
261
262
263##################################### space 200x200 ############################################################
264EFF_200x200=100
265EFF1_200x200=`echo "scale=6;  ($R1_200x200/$P1)*100" | bc`
266EFF2_200x200=`echo "scale=6;  ($R2_200x200/$P2)*100" | bc`
267EFF4_200x200=`echo "scale=6;  ($R4_200x200/$P4)*100" | bc`
268EFF8_200x200=`echo "scale=6;  ($R8_200x200/$P8)*100" | bc`
269echo Efficency 200x200 serial version
270echo $EFF_200x200
271echo Efficency 1 thread
272echo $EFF1_200x200
273echo Efficency 2 threads
274echo $EFF2_200x200
275echo Efficency 4 threads
276echo $EFF4_200x200
277echo Efficency 8 threads
278echo $EFF8_200x200
279echo 
280
281
282
283
284# Generate the matlab file for the elapsed time
285echo "A=[1, 1, 1; 2, 2, 2; 4, 4, 4; 8, 8, 8];" > shalw_matlabFile.m
286#echo "A=[1 1 1 1 1 1; 2 2 2 2 2 2; 4 4 4 4 4 4; 8 8 8 8 8 8];" >> shalw_matlabFile.m
287echo "B=[$E_50x50, $E_100x100, $E_200x200; $E2_50x50, $E2_100x100, $E2_200x200; $E4_50x50, $E4_100x100, $E4_200x200; $E8_50x50, $E8_100x100, $E8_200x200]; " >> shalw_matlabFile.m
288
289echo " " >> shalw_matlabFile.m
290echo "p1 =  plot(A(:,1), B(:,1), '-k'); % shallow 50x50 " >> shalw_matlabFile.m
291echo "  hold on" >> shalw_matlabFile.m
292echo "p2 =  plot(A(:,2), B(:,2), ':k'); % shallow 100x100" >> shalw_matlabFile.m
293echo "  hold on" >> shalw_matlabFile.m
294echo "p3 =  plot(A(:,3), B(:,3), '--k'); % shallow 200x200" >> shalw_matlabFile.m
295echo "  hold on" >> shalw_matlabFile.m
296#echo "p4 =  plot(A(:,4), B(:,4), '--ko'); % shallow 100x100 Amdahl" >> shalw_matlabFile.m
297#echo "  hold on" >> shalw_matlabFile.m
298#echo "p5 =  plot(A(:,5), B(:,5), ':kx'); % shallow 200x200 Real" >> shalw_matlabFile.m
299#echo "  hold on" >> shalw_matlabFile.m
300#echo "p6 =  plot(A(:,6), B(:,6), ':ko'); % shallow 200x200 Amdahl" >> shalw_matlabFile.m
301#echo "  hold on" >> shalw_matlabFile.m
302echo " " >> shalw_matlabFile.m
303echo "xlabel('Cores' , 'FontSize' ,22);" >> shalw_matlabFile.m
304echo "ylabel('Time (seconds)' , 'FontSize', 22);" >> shalw_matlabFile.m
305echo " " >> shalw_matlabFile.m
306echo "legend([p1, p2, p3],'50x50','100x100','200x200',1);" >> shalw_matlabFile.m
307#echo "set(h1, 'Location', 'NorthWest');" >> shalw_matlabFile.m
308#echo "legend([p1,p2,p3,p4,p5,p6],'50x50 real','50x50 Amdahl','100x100 real','100x100 Amdahl','200x200 real','200x200 Amdahl',1);" >> shalw_50x50_matlabFile.m
309echo " " >> shalw_matlabFile.m
310echo "saveas(gcf, 'shalw_matlabFile_print', 'fig');" >> shalw_matlabFile.m
311echo "saveas(gcf, 'shalw_matlabFile_print', 'eps');" >> shalw_matlabFile.m
312echo "quit;" >> shalw_matlabFile.m
313
314
315# Generate the matlab file for the speedup time
316echo "A=[1, 1, 1; 2, 2, 2; 4, 4, 4; 8, 8, 8];" > shalw_matlabFile_speedup.m
317#echo "A=[1 1 1 1 1 1; 2 2 2 2 2 2; 4 4 4 4 4 4; 8 8 8 8 8 8];" >> shalw_matlabFile_speedup.m
318echo "B=[$R_50x50, $R_100x100, $R_200x200; $R2_50x50, $R2_100x100, $R2_200x200; $R4_50x50, $R4_100x100, $R4_200x200; $R8_50x50, $R8_100x100, $R8_200x200]; " >> shalw_matlabFile_speedup.m
319
320echo " " >> shalw_matlabFile_speedup.m
321echo "p1 =  plot(A(:,1), B(:,1), '-k'); % shalw 50x50 real speedup" >> shalw_matlabFile_speedup.m
322echo "  hold on" >> shalw_matlabFile_speedup.m
323echo "p2 =  plot(A(:,2), B(:,2), ':k'); % shalw 100x100 real speedup" >> shalw_matlabFile_speedup.m
324echo "  hold on" >> shalw_matlabFile_speedup.m
325echo "p3 =  plot(A(:,3), B(:,3), '--k'); % shallow 200x200 real speedup" >> shalw_matlabFile_speedup.m
326echo "  hold on" >> shalw_matlabFile_speedup.m
327#echo "p4 =  plot(A(:,4), B(:,4), '--ko'); % shallow 100x100 Amdahl" >> shalw_50x50_matlabFile_speedup.m
328#echo "  hold on" >> shalw_50x50_matlabFile_speedup.m
329#echo "p5 =  plot(A(:,5), B(:,5), ':kx'); % shallow 200x200 Real" >> shalw_50x50_matlabFile_speedup.m
330#echo "  hold on" >> shalw_50x50_matlabFile_speedup.m
331#echo "p6 =  plot(A(:,6), B(:,6), ':ko'); % shallow 200x200 Amdahl" >> shalw_50x50_matlabFile_speedup.m
332#echo "  hold on" >> shalw_50x50_matlabFile_speedup.m
333echo " " >> shalw_matlabFile_speedup.m
334echo "xlabel('Cores' , 'FontSize' ,22);" >> shalw_matlabFile_speedup.m
335echo "ylabel('Speedup' , 'FontSize', 22);" >> shalw_matlabFile_speedup.m
336echo " " >> shalw_matlabFile_speedup.m
337echo "h1 = legend([p1, p2, p3],'50x50','100x100','200x200',1);" >> shalw_matlabFile_speedup.m
338echo "set(h1, 'Location', 'NorthWest');" >> shalw_matlabFile_speedup.m
339#echo "legend([p1,p2,p3,p4,p5,p6],'50x50 real','50x50 Amdahl','100x100 real','100x100 Amdahl','200x200 real','200x200 Amdahl',1);" >> shalw_50x50_matlabFile_speedup.m
340echo " " >> shalw_matlabFile_speedup.m
341echo "saveas(gcf, 'shalw_matlabFile_speedup_print', 'fig');" >> shalw_matlabFile_speedup.m
342echo "saveas(gcf, 'shalw_matlabFile_speedup_print', 'eps');" >> shalw_matlabFile_speedup.m
343echo "quit;" >> shalw_matlabFile_speedup.m
344
345
346
347
348
349
350# Generate the matlab file for the efficency
351echo "A=[1, 1, 1; 2, 2, 2; 4, 4, 4; 8, 8, 8];" > shalw_matlabFile_efficency.m
352#echo "A=[1 1 1 1 1 1; 2 2 2 2 2 2; 4 4 4 4 4 4; 8 8 8 8 8 8];" >> shalw_50x50_matlabFile_efficency.m
353
354echo "B=[$EFF_50x50, $EFF_100x100, $EFF_200x200; $EFF2_50x50, $EFF2_100x100, $EFF2_200x200; $EFF4_50x50, $EFF4_100x100, $EFF4_200x200; $EFF8_50x50, $EFF8_100x100, $EFF8_200x200]; " >> shalw_matlabFile_efficency.m
355
356echo " " >> shalw_matlabFile_efficency.m
357echo "p1 =  plot(A(:,1), B(:,1), '-k'); % shalw 50x50 efficency" >> shalw_matlabFile_efficency.m
358echo "  hold on" >> shalw_matlabFile_efficency.m
359echo "p2 =  plot(A(:,2), B(:,2), ':k'); % shalw 100x100 efficency" >> shalw_matlabFile_efficency.m
360echo "  hold on" >> shalw_matlabFile_efficency.m
361echo "p3 =  plot(A(:,3), B(:,3), '--k'); % shallow 200x200 efficency" >> shalw_matlabFile_efficency.m
362echo "  hold on" >> shalw_matlabFile_efficency.m
363#echo "p4 =  plot(A(:,4), B(:,4), '--ko'); % shallow 100x100 Amdahl" >> shalw_50x50_matlabFile_efficency.m
364#echo "  hold on" >> shalw_50x50_matlabFile_efficency.m
365#echo "p5 =  plot(A(:,5), B(:,5), ':kx'); % shallow 200x200 Real" >> shalw_50x50_matlabFile_efficency.m
366#echo "  hold on" >> shalw_50x50_matlabFile_efficency.m
367#echo "p6 =  plot(A(:,6), B(:,6), ':ko'); % shallow 200x200 Amdahl" >> shalw_50x50_matlabFile_efficency.m
368#echo "  hold on" >> shalw_50x50_matlabFile_efficency.m
369echo " " >> shalw_matlabFile_efficency.m
370echo "xlabel('Cores' , 'FontSize' ,22);" >> shalw_matlabFile_efficency.m
371echo "ylabel('Efficency' , 'FontSize', 22);" >> shalw_matlabFile_efficency.m
372echo " " >> shalw_matlabFile_efficency.m
373echo "legend([p1, p2, p3],'50x50','100x100','200x200',1);" >> shalw_matlabFile_efficency.m
374#echo "set(h1, 'Location', 'NorthWest');" >> shalw_matlabFile_efficency.m
375#echo "legend([p1,p2,p3,p4,p5,p6],'50x50 real','50x50 Amdahl','100x100 real','100x100 Amdahl','200x200 real','200x200 Amdahl',1);" >> shalw_50x50_matlabFile_efficency.m
376echo " " >> shalw_matlabFile_efficency.m
377echo "saveas(gcf, 'shalw_matlabFile_efficency_print', 'fig');" >> shalw_matlabFile_efficency.m
378echo "saveas(gcf, 'shalw_matlabFile_efficency_print', 'eps');" >> shalw_matlabFile_efficency.m
379echo "quit;" >> shalw_matlabFile_efficency.m
380
381
382
383
384
385# Lanciare matlab
386#matlab
387matlab -r "shalw_matlabFile"
388matlab -r "shalw_matlabFile_speedup"
389matlab -r "shalw_matlabFile_efficency"
390
391showfoto shalw_matlabFile_print.eps &
392showfoto shalw_matlabFile_speedup_print.eps &
393showfoto shalw_matlabFile_efficency_print.eps &
394
395
Note: See TracBrowser for help on using the repository browser.