fix: improve modern diag manager performance (#1634)
[FMS.git] / test_fms / diag_manager / test_time_rms.sh
blob8f3c526f779fdd42906da86af4e4902531674812
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_rms
31 base_date: 2 1 1 0 0 0
32 diag_files:
33 - file_name: test_rms
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_rms
41 reduction: average
42 kind: r4
43 - module: ocn_mod
44 var_name: var1
45 output_name: var1_rms
46 reduction: average
47 kind: r4
48 - module: ocn_mod
49 var_name: var2
50 output_name: var2_rms
51 reduction: average
52 kind: r4
53 - module: ocn_mod
54 var_name: var3
55 output_name: var3_rms
56 reduction: average
57 kind: r4
58 - module: ocn_mod
59 var_name: var4
60 output_name: var4_rms
61 reduction: average
62 kind: r4
63 - module: ocn_mod
64 var_name: var3
65 output_name: var3_Z
66 reduction: average
67 zbounds: 2. 3.
68 kind: r4
69 - file_name: test_rms_regional
70 time_units: hours
71 unlimdim: time
72 sub_region:
73 - grid_type: latlon
74 corner1: 78. 78.
75 corner2: 78. 78.
76 corner3: 81. 81.
77 corner4: 81. 81.
78 freq: 6 hours
79 varlist:
80 - module: ocn_mod
81 var_name: var3
82 output_name: var3_rms
83 reduction: average
84 zbounds: 2. 3.
85 kind: r4
86 _EOF
88 # remove any existing files that would result in false passes during checks
89 rm -f *.nc
91 # tests with no mask, no openmp
92 my_test_count=1
93 printf "&diag_manager_nml \n use_modern_diag=.true. \n / \n&test_reduction_methods_nml \n test_case = 0 \n/" | cat > input.nml
94 test_expect_success "Running diag_manager with "rms" reduction method (test $my_test_count)" '
95 mpirun -n 6 ../test_reduction_methods
97 test_expect_success "Checking answers for the "rms" reduction method (test $my_test_count)" '
98 mpirun -n 1 ../check_time_rms
101 my_test_count=`expr $my_test_count + 1`
102 printf "&diag_manager_nml \n use_modern_diag=.true. \n / \n &test_reduction_methods_nml \n test_case = 0 \n mask_case = 1 \n \n/" | cat > input.nml
103 test_expect_success "Running diag_manager with "rms" reduction method, logical mask (test $my_test_count)" '
104 mpirun -n 6 ../test_reduction_methods
106 test_expect_success "Checking answers for the "rms" reduction method, logical mask (test $my_test_count)" '
107 mpirun -n 1 ../check_time_rms
110 my_test_count=`expr $my_test_count + 1`
111 printf "&diag_manager_nml \n use_modern_diag=.true. \n / \n &test_reduction_methods_nml \n test_case = 0 \n mask_case = 2 \n \n/" | cat > input.nml
112 test_expect_success "Running diag_manager with "rms" reduction method, real mask (test $my_test_count)" '
113 mpirun -n 6 ../test_reduction_methods
115 test_expect_success "Checking answers for the "rms" reduction method, real mask (test $my_test_count)" '
116 mpirun -n 1 ../check_time_rms
119 # openmp tests
121 export OMP_NUM_THREADS=2
122 my_test_count=`expr $my_test_count + 1`
123 printf "&diag_manager_nml \n use_modern_diag=.true. \n / \n&test_reduction_methods_nml \n test_case = 1 \n \n/" | cat > input.nml
124 test_expect_success "Running diag_manager with "rms" reduction method with openmp (test $my_test_count)" '
125 mpirun -n 6 ../test_reduction_methods
127 test_expect_success "Checking answers for the "rms" reduction method with openmp (test $my_test_count)" '
128 mpirun -n 1 ../check_time_rms
131 my_test_count=`expr $my_test_count + 1`
132 printf "&diag_manager_nml \n use_modern_diag=.true. \n / \n&test_reduction_methods_nml \n test_case = 1 \n mask_case = 1 \n \n/" | cat > input.nml
133 test_expect_success "Running diag_manager with "rms" reduction method with openmp, logical mask (test $my_test_count)" '
134 mpirun -n 6 ../test_reduction_methods
136 test_expect_success "Checking answers for the "rms" reduction method with openmp, logical mask (test $my_test_count)" '
137 mpirun -n 1 ../check_time_rms
140 my_test_count=`expr $my_test_count + 1`
141 printf "&diag_manager_nml \n use_modern_diag=.true. \n / \n&test_reduction_methods_nml \n test_case = 1 \n mask_case = 2 \n \n/" | cat > input.nml
142 test_expect_success "Running diag_manager with "rms" reduction method with openmp, real mask (test $my_test_count)" '
143 mpirun -n 6 ../test_reduction_methods
145 test_expect_success "Checking answers for the "rms" reduction method with openmp, real mask (test $my_test_count)" '
146 mpirun -n 1 ../check_time_rms
149 # halo output and mask tests
151 export OMP_NUM_THREADS=1
153 my_test_count=`expr $my_test_count + 1`
154 printf "&diag_manager_nml \n use_modern_diag=.true. \n / \n&test_reduction_methods_nml \n test_case = 2 \n \n/" | cat > input.nml
155 test_expect_success "Running diag_manager with "rms" reduction method with halo output (test $my_test_count)" '
156 mpirun -n 6 ../test_reduction_methods
158 test_expect_success "Checking answers for the "rms" reduction method with halo output (test $my_test_count)" '
159 mpirun -n 1 ../check_time_rms
162 my_test_count=`expr $my_test_count + 1`
163 printf "&diag_manager_nml \n use_modern_diag=.true. \n / \n&test_reduction_methods_nml \n test_case = 2 \n mask_case = 1 \n \n/" | cat > input.nml
164 test_expect_success "Running diag_manager with "rms" reduction method with halo output with logical mask (test $my_test_count)" '
165 mpirun -n 6 ../test_reduction_methods
167 test_expect_success "Checking answers for the "rms" reduction method with halo output with logical mask (test $my_test_count)" '
168 mpirun -n 1 ../check_time_rms
171 my_test_count=`expr $my_test_count + 1`
172 printf "&diag_manager_nml \n use_modern_diag=.true. \n / \n&test_reduction_methods_nml \n test_case = 2 \n mask_case = 2 \n \n/" | cat > input.nml
173 test_expect_success "Running diag_manager with "rms" reduction method with halo output with real mask (test $my_test_count)" '
174 mpirun -n 6 ../test_reduction_methods
176 test_expect_success "Checking answers for the "rms" reduction method with halo output with real mask (test $my_test_count)" '
177 mpirun -n 1 ../check_time_rms
180 test_done