v0.10.0
cpu_times_h.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}_h
106 rm -rf CPU_times_hard_cylinder_h_*.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 # for ODISP in {1..7..1};
130 for NB_PROC in `seq 1 7`;
131 do
132  # let NB_PROC+=${ODISP}
133  # if [ $NB_PROC <= 6 ]; then ODISP=`expr $NB_PROC`; fi
134  # if [ $NB_PROC -le 7 ]; then ODISP=$NB_PROC; else ODISP=7; fi
135 
136  echo LOG: sound hard cylinder computational times analysis test
137  echo | tee -a CPU_times_hard_cylinder_h_${NB_PROC}.txt
138  echo "Start h increment for sound hard cylinder calculation time..." | tee -a CPU_times_hard_cylinder_h_${NB_PROC}.txt
139  MPIRUN="mpirun -np $NB_PROC"
140 
141  for ODISP in 1 2 3 4 5 6 7
142  do
143 
144  rm -rf impinging_cylinder_parts*.h5m
145  if [ $partition = true ]; then mbpart -t -p PARTKWAY $NB_PROC impinging_cylinder_$ODISP.cub impinging_cylinder_parts$NB_PROC.h5m; fi
146 
147 if [ $partition = true ]
148 then file1="impinging_cylinder_parts$NB_PROC.h5m"
149 fi
150 
151  #To use partitioned mesh, first mbpart -t -p PARTKWAY 4 sphere4.cub sphere4_4parts.h5m,
152 # let NB_PROC=${ODISP}+1
153 # #echo $NB_PROC
154  #BEGIN analytical solution
155  # $MPIRUN $BIN_PATH/best_approximation \
156  # -my_file $file1 \
157  # -my_is_partitioned $partition \
158  # -wave_number $WAVE_NUMBER \
159  # -wave_direction 1,0,0 \
160  # -analytical_solution_type hard_cylinder_scatter_wave \
161  # -save_postproc_mesh false \
162  # -ksp_type fgmres \
163  # -pc_type lu \
164  # -pc_factor_mat_solver_package superlu_dist \
165  # -ksp_monitor \
166  # -my_order $ODISP \
167  # -my_max_post_proc_ref_level 0 \
168  # -add_incident_wave false \
169 
170 #
171 #BEGIN numerical solution
172 echo " "| tee -a CPU_times_hard_cylinder_h_${NB_PROC}.txt
173 echo " "| tee -a CPU_times_hard_cylinder_h_${NB_PROC}.txt
174 echo "Start numerical calculation with $NB_PROC processes, and h file $ODISP ... with $NB_PROC partitioned mesh" | tee -a CPU_times_hard_cylinder_h_${NB_PROC}.txt
175 
176 $MPIRUN $BIN_PATH/fe_approximation \
177 -my_file $file1 \
178 -my_is_partitioned $partition \
179 -wave_number $WAVE_NUMBER \
180 -wave_direction 1,0,0 \
181 -save_postproc_mesh false \
182 -ksp_type fgmres \
183 -pc_type lu \
184 -pc_factor_mat_solver_package superlu_dist \
185 -ksp_monitor \
186 -my_order 2 \
187 -my_max_post_proc_ref_level 0 \
188 -amplitude_of_incident_wave 1 \
189 -add_incident_wave false 2>&1 |
190 grep --line-buffered -i "Problem ACOUSTIC_PROBLEM Nb. rows\|Time =\|Memory usage =" | tee -a -i CPU_times_hard_cylinder_h_${NB_PROC}.txt
191 echo " "
192 # echo " begin error calculation "
193 # echo " "
194 #BEGIN error calculation
195 # $MPIRUN $BIN_PATH/error_norm \
196 # -my_file $BIN_PATH/fe_solution.h5m \
197 # -my_is_partitioned $partition \
198 # -norm_type $ERROR_TYPE \
199 # -relative_error false \
200 # -ksp_type fgmres \
201 # -pc_type lu \
202 # -pc_factor_mat_solver_package superlu_dist \
203 # -ksp_monitor \
204 # -my_order 1 \
205 # -my_max_post_proc_ref_level 0 \
206 # -save_postproc_mesh true 2>&1 | grep --line-buffered -i " realtive error " | tee -a -i CPU_times_hard_cylinder_h_${NB_PROC}.txt
207 # #RENAME files inot their order and wave number.
208 # mbconvert norm_error.h5m norm_error.vtk |
209 # mv norm_error.vtk norm_error_k${WAVE_NUMBER}_order_${ODISP}.vtk
210 
211 done
212 
213 done
214 
215 #SAVE the results to different directory
216 # mkdir CPU_times_${ERROR_TYPE}_cylinder_processor${NB_PROC}_p
217 rm -rf impinging_cylinder_parts*.h5m
218 # mv norm_error_k${WAVE_NUMBER}_order_*.vtk ./CPU_times_${ERROR_TYPE}_cylinder_k${WAVE_NUMBER}_h
219 
220 # done
221 
222 # done
223 #foo="Hello"
224 #foo="$foo World"
225 #echo $foo
226 #> Hello World