fix: improve modern diag manager performance (#1634)
[FMS.git] / test_fms / diag_manager / test_time_pow.sh
blob5e343de9bb68dae97d223b36a35924543bb28c79
1 #!/bin/sh
3 #***********************************************************************
4 #* GNU Lesser General Public License
5 #*
6 #* This file is part of the GFDL Flexible Modeling System (FMS).
7 #*
8 #* FMS is free software: you can redistribute it and/or modify it under
9 #* the terms of the GNU Lesser General Public License as published by
10 #* the Free Software Foundation, either version 3 of the License, or (at
11 #* your option) any later version.
13 #* FMS is distributed in the hope that it will be useful, but WITHOUT
14 #* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 #* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16 #* for more details.
18 #* You should have received a copy of the GNU Lesser General Public
19 #* License along with FMS. If not, see <http://www.gnu.org/licenses/>.
20 #***********************************************************************
22 # Set common test settings.
23 . ../test-lib.sh
25 if [ -z "${skipflag}" ]; then
26 # create and enter directory for in/output files
27 output_dir
29 cat <<_EOF > diag_table.yaml
30 title: test_pow
31 base_date: 2 1 1 0 0 0
32 diag_files:
33 - file_name: test_pow
34 time_units: hours
35 unlimdim: time
36 freq: 6 hours
37 varlist:
38 - module: ocn_mod
39 var_name: var0
40 output_name: var0_pow
41 reduction: pow2
42 kind: r4
43 - module: ocn_mod
44 var_name: var1
45 output_name: var1_pow
46 reduction: pow2
47 kind: r4
48 - module: ocn_mod
49 var_name: var2
50 output_name: var2_pow
51 reduction: pow2
52 kind: r4
53 - module: ocn_mod
54 var_name: var3
55 output_name: var3_pow
56 reduction: pow2
57 kind: r4
58 - module: ocn_mod
59 var_name: var3
60 output_name: var3_Z
61 reduction: pow2
62 zbounds: 2. 3.
63 kind: r4
64 - file_name: test_pow_regional
65 time_units: hours
66 unlimdim: time
67 sub_region:
68 - grid_type: latlon
69 corner1: 78. 78.
70 corner2: 78. 78.
71 corner3: 81. 81.
72 corner4: 81. 81.
73 freq: 6 hours
74 varlist:
75 - module: ocn_mod
76 var_name: var3
77 output_name: var3_pow
78 reduction: pow2
79 zbounds: 2. 3.
80 kind: r4
81 _EOF
83 # remove any existing files that would result in false passes during checks
84 rm -f *.nc
86 # tests with no mask, no openmp
87 my_test_count=1
88 printf "&diag_manager_nml \n use_modern_diag=.true. \n / \n&test_reduction_methods_nml \n test_case = 0 \n use_pow_data=.true. \n/" | cat > input.nml
89 test_expect_success "Running diag_manager with "pow" reduction method (test $my_test_count)" '
90 mpirun -n 6 ../test_reduction_methods
92 test_expect_success "Checking answers for the "pow" reduction method (test $my_test_count)" '
93 mpirun -n 1 ../check_time_pow
96 my_test_count=`expr $my_test_count + 1`
97 printf "&diag_manager_nml \n use_modern_diag=.true. \n / \n &test_reduction_methods_nml \n test_case = 0 \n mask_case = 1 \n use_pow_data=.true.\n/" | cat > input.nml
98 test_expect_success "Running diag_manager with "pow" reduction method, logical mask (test $my_test_count)" '
99 mpirun -n 6 ../test_reduction_methods
101 test_expect_success "Checking answers for the "pow" reduction method, logical mask (test $my_test_count)" '
102 mpirun -n 1 ../check_time_pow
105 my_test_count=`expr $my_test_count + 1`
106 printf "&diag_manager_nml \n use_modern_diag=.true. \n / \n &test_reduction_methods_nml \n test_case = 0 \n mask_case = 2 \n use_pow_data=.true.\n/" | cat > input.nml
107 test_expect_success "Running diag_manager with "pow" reduction method, real mask (test $my_test_count)" '
108 mpirun -n 6 ../test_reduction_methods
110 test_expect_success "Checking answers for the "pow" reduction method, real mask (test $my_test_count)" '
111 mpirun -n 1 ../check_time_pow
114 # openmp tests
116 export OMP_NUM_THREADS=2
117 my_test_count=`expr $my_test_count + 1`
118 printf "&diag_manager_nml \n use_modern_diag=.true. \n / \n&test_reduction_methods_nml \n test_case = 1 \n use_pow_data=.true.\n/" | cat > input.nml
119 test_expect_success "Running diag_manager with "pow" reduction method with openmp (test $my_test_count)" '
120 mpirun -n 6 ../test_reduction_methods
122 test_expect_success "Checking answers for the "pow" reduction method with openmp (test $my_test_count)" '
123 mpirun -n 1 ../check_time_pow
126 my_test_count=`expr $my_test_count + 1`
127 printf "&diag_manager_nml \n use_modern_diag=.true. \n / \n&test_reduction_methods_nml \n test_case = 1 \n mask_case = 1 \n use_pow_data=.true.\n/" | cat > input.nml
128 test_expect_success "Running diag_manager with "pow" reduction method with openmp, logical mask (test $my_test_count)" '
129 mpirun -n 6 ../test_reduction_methods
131 test_expect_success "Checking answers for the "pow" reduction method with openmp, logical mask (test $my_test_count)" '
132 mpirun -n 1 ../check_time_pow
135 my_test_count=`expr $my_test_count + 1`
136 printf "&diag_manager_nml \n use_modern_diag=.true. \n / \n&test_reduction_methods_nml \n test_case = 1 \n mask_case = 2 \n use_pow_data=.true.\n/" | cat > input.nml
137 test_expect_success "Running diag_manager with "pow" reduction method with openmp, real mask (test $my_test_count)" '
138 mpirun -n 6 ../test_reduction_methods
140 test_expect_success "Checking answers for the "pow" reduction method with openmp, real mask (test $my_test_count)" '
141 mpirun -n 1 ../check_time_pow
144 # halo output and mask tests
146 export OMP_NUM_THREADS=1
148 my_test_count=`expr $my_test_count + 1`
149 printf "&diag_manager_nml \n use_modern_diag=.true. \n / \n&test_reduction_methods_nml \n test_case = 2 \n use_pow_data=.true.\n/" | cat > input.nml
150 test_expect_success "Running diag_manager with "pow" reduction method with halo output (test $my_test_count)" '
151 mpirun -n 6 ../test_reduction_methods
153 test_expect_success "Checking answers for the "pow" reduction method with halo output (test $my_test_count)" '
154 mpirun -n 1 ../check_time_pow
157 my_test_count=`expr $my_test_count + 1`
158 printf "&diag_manager_nml \n use_modern_diag=.true. \n / \n&test_reduction_methods_nml \n test_case = 2 \n mask_case = 1 \n use_pow_data=.true.\n/" | cat > input.nml
159 test_expect_success "Running diag_manager with "pow" reduction method with halo output with logical mask (test $my_test_count)" '
160 mpirun -n 6 ../test_reduction_methods
162 test_expect_success "Checking answers for the "pow" reduction method with halo output with logical mask (test $my_test_count)" '
163 mpirun -n 1 ../check_time_pow
166 my_test_count=`expr $my_test_count + 1`
167 printf "&diag_manager_nml \n use_modern_diag=.true. \n / \n&test_reduction_methods_nml \n test_case = 2 \n mask_case = 2 \n use_pow_data=.true.\n/" | cat > input.nml
168 test_expect_success "Running diag_manager with "pow" reduction method with halo output with real mask (test $my_test_count)" '
169 mpirun -n 6 ../test_reduction_methods
171 test_expect_success "Checking answers for the "pow" reduction method with halo output with real mask (test $my_test_count)" '
172 mpirun -n 1 ../check_time_pow
175 test_done