v0.10.0
cpu_times_p.sh
Go to the documentation of this file.
1 #!/bin/sh
2 # " chmod -x FILE_NAME " before run the bach script
3 DIR_NAME="error_mesh_file"
4 NB_PROC=1
5 ODISP=1
6 ERROR_TYPE="h1"
7 WAVE_NUMBER="10"
8 
9 # for WAVE_NUMBER in {3,5,10}
10 # do
11 partition="true"
12 file1="impinging_cylinder.cub"
13 #ERROR_TYPE="h1"
14 
15 # BIN_PATH="@CMAKE_CURRENT_BINARY_DIR@"
16 # SRC_PATH="@CMAKE_CURRENT_SOURCE_DIR@"
17 BIN_PATH="./"
18 SRC_PATH="./src"
19 
20 MPIRUN="mpirun -np $NB_PROC"
21 
22 cd $BIN_PATH
23 
24 # for WAVE_NUMBER in 3 5 10
25 # do
26 
27 # echo LOG: plane wave guide P convergence test
28 # echo | tee -a wave_guide_p.txt
29 # echo "Start p convergence test for plane wave guide ..." | tee -a wave_guide_p.txt
30 # $MPIRUN $BIN_PATH/best_approximation \
31 # -my_file plane_wave_cube.cub \
32 # -my_is_partitioned false \
33 # -wave_number $WAVE_NUMBER \
34 # -wave_direction 0.7071,0.7071,0 \
35 # -analytical_solution_type plane_wave \
36 # -save_postproc_mesh false \
37 # -ksp_type fgmres \
38 # -pc_type lu \
39 # -pc_factor_mat_solver_package superlu_dist \
40 # -ksp_monitor \
41 # -my_order 7 \
42 # -my_max_post_proc_ref_level 0 \
43 # -add_incident_wave false \
44 # -wave_guide_angle 45
45 #
46 # for ODISP in {1..3..1};
47 # do
48 # let NB_PROC=${ODISP}+1
49 # #echo $NB_PROC
50 # #BEGIN analytical solution
51 # # $MPIRUN $BIN_PATH/best_approximation \
52 # # -my_file plane_wave_cube.cub \
53 # # -my_is_partitioned false \
54 # # -wave_number $WAVE_NUMBER \
55 # # -wave_direction 0.7071,0.7071,0 \
56 # # -analytical_solution_type plane_wave \
57 # # -save_postproc_mesh false \
58 # # -ksp_type fgmres \
59 # # -pc_type lu \
60 # # -pc_factor_mat_solver_package superlu_dist \
61 # # -ksp_monitor \
62 # # -my_order $ODISP \
63 # # -my_max_post_proc_ref_level 0 \
64 # # -add_incident_wave false \
65 # # -wave_guide_angle 45
66 #
67 # #BEGIN numerical solution
68 # $MPIRUN $BIN_PATH/fe_approximation \
69 # -my_file analytical_solution.h5m \
70 # -my_is_partitioned false \
71 # -wave_number $WAVE_NUMBER \
72 # -wave_direction 0.7071,0.7071,0 \
73 # -analytical_solution_type plane_wave \
74 # -save_postproc_mesh false \
75 # -ksp_type fgmres \
76 # -pc_type lu \
77 # -pc_factor_mat_solver_package mumps \
78 # -ksp_monitor \
79 # -my_order $ODISP \
80 # -my_max_post_proc_ref_level 0 \
81 # -add_incident_wave false \
82 # -wave_guide_angle 45 |
83 # grep --line-buffered -i "Problem ACOUSTIC_PROBLEM Nb. rows\|Time =" | tee -a -i wave_guide_p.txt
84 # #BEGIN error calculation
85 #
86 # $MPIRUN $BIN_PATH/error_norm \
87 # -my_file $BIN_PATH/fe_solution.h5m \
88 # -norm_type $ERROR_TYPE \
89 # -relative_error false \
90 # -ksp_type fgmres \
91 # -pc_type lu \
92 # -pc_factor_mat_solver_package superlu_dist \
93 # -ksp_monitor \
94 # -my_order 1 \
95 # -my_max_post_proc_ref_level 0 \
96 # -save_postproc_mesh true \
97 # 2>&1 | grep --line-buffered -i " $ERROR_TYPE realtive error " | tee -a -i wave_guide_p.txt
98 # #RENAME files inot their order and wave number.
99 # mbconvert norm_error.h5m norm_error.vtk
100 # mv norm_error.vtk norm_error_k${WAVE_NUMBER}_order_${ODISP}.vtk
101 # done
102 #
103 # #SAVE the results to different directory
104 # mkdir CPU_times_${ERROR_TYPE}_waveguide | mv norm_error_k${WAVE_NUMBER}_order_*.vtk ./CPU_times_${ERROR_TYPE}_waveguide
105 rm -rf CPU_times_${ERROR_TYPE}_cylinder_processor${NB_PROC}_p
106 rm -rf CPU_times_hard_cylinder_p_*.txt | rm -rf norm_error_k${WAVE_NUMBER}_order_*.vtk
107 
108 # for batman in `seq 1 1`;
109 # do
110 
111  #echo $NB_PROC
112  #BEGIN analytical solution
113 # mpirun -np 8 ./best_approximation \
114 # -my_file impinging_cylinder.cub \
115 # -my_is_partitioned false \
116 # -wave_number $WAVE_NUMBER \
117 # -wave_direction 1,0,0 \
118 # -analytical_solution_type hard_cylinder_scatter_wave \
119 # -save_postproc_mesh false \
120 # -ksp_type fgmres \
121 # -pc_type lu \
122 # -pc_factor_mat_solver_package superlu_dist \
123 # -ksp_monitor \
124 # -my_order 7 \
125 # -my_max_post_proc_ref_level 0 \
126 # -add_incident_wave false \
127 # -amplitude_of_incident_wave 1
128 # done
129 
130 # for ODISP in {1..7..1};
131 for NB_PROC in `seq 1 6`;
132 do
133  # let NB_PROC+=${ODISP}
134  # if [ $NB_PROC <= 6 ]; then ODISP=`expr $NB_PROC`; fi
135  # if [ $NB_PROC -le 6 ]; then ODISP=$NB_PROC; else ODISP=6; fi
136 
137  echo LOG: sound hard cylinder computational times analysis test
138  echo | tee -a CPU_times_hard_cylinder_p_${NB_PROC}.txt
139  echo "Start p enrichment for sound hard cylinder calculation time..." | tee -a CPU_times_hard_cylinder_p_${NB_PROC}.txt
140 
141 MPIRUN="mpirun -np $NB_PROC"
142 
143  if [ $partition = true ]; then mbpart -t -p PARTKWAY $NB_PROC impinging_cylinder.cub impinging_cylinder_parts$NB_PROC.h5m; fi
144 
145 if [ $partition = true ]
146 then file1="impinging_cylinder_parts$NB_PROC.h5m"
147 fi
148 
149 # if [ $NB_PROC = 6 ];
150 # then
151 # for ODISP in 2 3 4 5 6
152 # else
153  for ODISP in 1 2 3 4 5 6
154 # fi
155 # for ODISP in 1 2 3 4 5 6
156 do
157  #To use partitioned mesh, first mbpart -t -p PARTKWAY 4 sphere4.cub sphere4_4parts.h5m,
158 # let NB_PROC=${ODISP}+1
159 # #echo $NB_PROC
160  #BEGIN analytical solution
161  # $MPIRUN $BIN_PATH/best_approximation \
162  # -my_file $file1 \
163  # -my_is_partitioned $partition \
164  # -wave_number $WAVE_NUMBER \
165  # -wave_direction 1,0,0 \
166  # -analytical_solution_type hard_cylinder_scatter_wave \
167  # -save_postproc_mesh false \
168  # -ksp_type fgmres \
169  # -pc_type lu \
170  # -pc_factor_mat_solver_package superlu_dist \
171  # -ksp_monitor \
172  # -my_order $ODISP \
173  # -my_max_post_proc_ref_level 0 \
174  # -add_incident_wave false \
175 
176 #
177 #BEGIN numerical solution
178 echo " "| tee -a CPU_times_hard_cylinder_p_${NB_PROC}.txt
179 echo " "| tee -a CPU_times_hard_cylinder_p_${NB_PROC}.txt
180 echo "Start numerical calculation with $NB_PROC processes, and order $ODISP ... with $NB_PROC partitioned mesh" | tee -a CPU_times_hard_cylinder_p_${NB_PROC}.txt
181 
182 $MPIRUN $BIN_PATH/fe_approximation \
183 -my_file $file1 \
184 -my_is_partitioned $partition \
185 -wave_number $WAVE_NUMBER \
186 -wave_direction 1,0,0 \
187 -save_postproc_mesh false \
188 -ksp_type fgmres \
189 -pc_type lu \
190 -pc_factor_mat_solver_package superlu_dist \
191 -ksp_monitor \
192 -my_order $ODISP \
193 -my_max_post_proc_ref_level 0 \
194 -amplitude_of_incident_wave 1 \
195 -add_incident_wave false 2>&1 |
196 grep --line-buffered -i "Problem ACOUSTIC_PROBLEM Nb. rows\|Time =\|Memory usage =" | tee -a -i CPU_times_hard_cylinder_p_${NB_PROC}.txt
197 echo " "
198 # echo " begin error calculation "
199 # echo " "
200 #BEGIN error calculation
201 # $MPIRUN $BIN_PATH/error_norm \
202 # -my_file $BIN_PATH/fe_solution.h5m \
203 # -my_is_partitioned $partition \
204 # -norm_type $ERROR_TYPE \
205 # -relative_error false \
206 # -ksp_type fgmres \
207 # -pc_type lu \
208 # -pc_factor_mat_solver_package superlu_dist \
209 # -ksp_monitor \
210 # -my_order 1 \
211 # -my_max_post_proc_ref_level 0 \
212 # -save_postproc_mesh true 2>&1 | grep --line-buffered -i " realtive error " | tee -a -i CPU_times_hard_cylinder_p_${NB_PROC}.txt
213 # #RENAME files inot their order and wave number.
214 # mbconvert norm_error.h5m norm_error.vtk |
215 # mv norm_error.vtk norm_error_k${WAVE_NUMBER}_order_${ODISP}.vtk
216 
217 done
218 
219 done
220 
221 #SAVE the results to different directory
222 # mkdir CPU_times_${ERROR_TYPE}_cylinder_processor${NB_PROC}_p
223 rm -rf impinging_cylinder_parts*.h5m
224 
225 # mv norm_error_k${WAVE_NUMBER}_order_*.vtk ./CPU_times_${ERROR_TYPE}_cylinder_processor${NB_PROC}_p
226 
227 # done
228 
229 # done
230 #foo="Hello"
231 #foo="$foo World"
232 #echo $foo
233 #> Hello World