fix: improve modern diag manager performance (#1634)
[FMS.git] / test_fms / diag_manager / test_time_min.sh
blobf2969d47c9c2e41ea11e09b410681ac00839d1c8
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 # Copyright (c) 2019-2020 Ed Hartnett, Seth Underwood
24 # Set common test settings.
25 . ../test-lib.sh
27 if [ -z "${skipflag}" ]; then
28 # create and enter directory for in/output files
29 output_dir
31 #TODO replace with yaml diag_table and set diag_manager_nml::use_modern_diag=.true.
32 cat <<_EOF > diag_table.yaml
33 title: test_min
34 base_date: 2 1 1 0 0 0
35 diag_files:
36 - file_name: test_min
37 time_units: hours
38 unlimdim: time
39 freq: 6 hours
40 varlist:
41 - module: ocn_mod
42 var_name: var0
43 output_name: var0_min
44 reduction: min
45 kind: r4
46 - module: ocn_mod
47 var_name: var1
48 output_name: var1_min
49 reduction: min
50 kind: r4
51 - module: ocn_mod
52 var_name: var2
53 output_name: var2_min
54 reduction: min
55 kind: r4
56 - module: ocn_mod
57 var_name: var3
58 output_name: var3_min
59 reduction: min
60 kind: r4
61 - module: ocn_mod
62 var_name: var4
63 output_name: var4_min
64 reduction: min
65 kind: r4
66 - module: ocn_mod
67 var_name: var3
68 output_name: var3_Z_min
69 reduction: min
70 zbounds: 2. 3.
71 kind: r4
72 - file_name: test_min_regional
73 time_units: hours
74 unlimdim: time
75 sub_region:
76 - grid_type: latlon
77 corner1: 78. 78.
78 corner2: 78. 78.
79 corner3: 81. 81.
80 corner4: 81. 81.
81 freq: 6 hours
82 varlist:
83 - module: ocn_mod
84 var_name: var3
85 output_name: var3_min
86 reduction: min
87 zbounds: 2. 3.
88 kind: r4
89 _EOF
91 my_test_count=1
92 printf "&diag_manager_nml \n use_modern_diag=.true. \n / \n&test_reduction_methods_nml \n test_case = 0 \n/" | cat > input.nml
93 test_expect_success "Running diag_manager with "min" reduction method (test $my_test_count)" '
94 mpirun -n 6 ../test_reduction_methods
96 test_expect_success "Checking answers for the "min" reduction method (test $my_test_count)" '
97 mpirun -n 1 ../check_time_min
100 my_test_count=`expr $my_test_count + 1`
101 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
102 test_expect_success "Running diag_manager with "min" reduction method, logical mask (test $my_test_count)" '
103 mpirun -n 6 ../test_reduction_methods
105 test_expect_success "Checking answers for the "min" reduction method, logical mask (test $my_test_count)" '
106 mpirun -n 1 ../check_time_min
109 my_test_count=`expr $my_test_count + 1`
110 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
111 test_expect_success "Running diag_manager with "min" reduction method, real mask (test $my_test_count)" '
112 mpirun -n 6 ../test_reduction_methods
114 test_expect_success "Checking answers for the "min" reduction method, real mask (test $my_test_count)" '
115 mpirun -n 1 ../check_time_min
118 export OMP_NUM_THREADS=2
119 my_test_count=`expr $my_test_count + 1`
120 printf "&diag_manager_nml \n use_modern_diag=.true. \n / \n&test_reduction_methods_nml \n test_case = 1 \n \n/" | cat > input.nml
121 test_expect_success "Running diag_manager with "min" reduction method with openmp (test $my_test_count)" '
122 mpirun -n 6 ../test_reduction_methods
124 test_expect_success "Checking answers for the "min" reduction method with openmp (test $my_test_count)" '
125 mpirun -n 1 ../check_time_min
128 my_test_count=`expr $my_test_count + 1`
129 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
130 test_expect_success "Running diag_manager with "min" reduction method with openmp, logical mask (test $my_test_count)" '
131 mpirun -n 6 ../test_reduction_methods
133 test_expect_success "Checking answers for the "min" reduction method with openmp, logical mask (test $my_test_count)" '
134 mpirun -n 1 ../check_time_min
137 my_test_count=`expr $my_test_count + 1`
138 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
139 test_expect_success "Running diag_manager with "min" reduction method with openmp, real mask (test $my_test_count)" '
140 mpirun -n 6 ../test_reduction_methods
142 test_expect_success "Checking answers for the "min" reduction method with openmp, real mask (test $my_test_count)" '
143 mpirun -n 1 ../check_time_min
145 export OMP_NUM_THREADS=1
147 my_test_count=`expr $my_test_count + 1`
148 printf "&diag_manager_nml \n use_modern_diag=.true. \n / \n&test_reduction_methods_nml \n test_case = 2 \n \n/" | cat > input.nml
149 test_expect_success "Running diag_manager with "min" reduction method with halo output (test $my_test_count)" '
150 mpirun -n 6 ../test_reduction_methods
152 test_expect_success "Checking answers for the "min" reduction method with halo output (test $my_test_count)" '
153 mpirun -n 1 ../check_time_min
156 my_test_count=`expr $my_test_count + 1`
157 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
158 test_expect_success "Running diag_manager with "min" reduction method with halo output with logical mask (test $my_test_count)" '
159 mpirun -n 6 ../test_reduction_methods
161 test_expect_success "Checking answers for the "min" reduction method with halo output with logical mask (test $my_test_count)" '
162 mpirun -n 1 ../check_time_min
165 my_test_count=`expr $my_test_count + 1`
166 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
167 test_expect_success "Running diag_manager with "min" reduction method with halo output with real mask (test $my_test_count)" '
168 mpirun -n 6 ../test_reduction_methods
170 test_expect_success "Checking answers for the "min" reduction method with halo output with real mask (test $my_test_count)" '
171 mpirun -n 1 ../check_time_min
174 test_done