Skip to content

Commit aa14843

Browse files
climbfujiAlexanderRichert-NOAAdustinswales
authored
Convert GFS DDTs from blocked data structures to contiguous arrays (now also includes #752) (#798)
* Convert GFS_grid DDT: use contiguous arrays instead of blocked data structures * Add GCC-based CI build --------- Co-authored-by: Alex Richert <[email protected]> Co-authored-by: Dustin Swales <[email protected]>
1 parent 0495c19 commit aa14843

29 files changed

+3651
-3247
lines changed

.github/pull_request_template.md

+5
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,8 @@ Do PRs in upstream repositories need to be merged first?
3535
If so add the "waiting for other repos" label and list the upstream PRs
3636
- waiting on noaa-emc/nems/pull/<pr_number>
3737
- waiting on noaa-emc/fv3atm/pull/<pr_number>
38+
39+
# Requirements before merging
40+
- [ ] All new code in this PR is tested by at least one unit test
41+
- [ ] All new code in this PR includes Doxygen documentation
42+
- [ ] All new code in this PR does not add new compilation warnings (check CI output)

.github/workflows/GCC.yml

+39-8
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
mpi: ["mpich", "openmpi"]
2525

2626
steps:
27-
27+
2828
- name: checkout-fv3atm
2929
uses: actions/checkout@v4
3030
with:
@@ -59,6 +59,7 @@ jobs:
5959
spack config add "packages:mpi:require:'${{ matrix.mpi }}'"
6060
spack concretize |& tee ${SPACK_ENV}/log.concretize
6161
spack install -j2 --fail-fast
62+
echo "spackrc=$?" >> ${GITHUB_ENV}
6263
spack clean --all
6364
6465
build_fv3atm:
@@ -73,9 +74,20 @@ jobs:
7374

7475
steps:
7576

76-
- name: install-doxygen
77+
# Only do Doxygen and gcovr build for one job
78+
- name: decide-doc-gcovr-build
79+
run: |
80+
if [[ "${{ matrix.cmake_opts }}" == "-D32BIT=ON" && "${{ matrix.gcc_ver }}" == 12 && "${{ matrix.mpi }}" == mpich ]]; then
81+
echo 'devbuild=ON' | tee -a ${GITHUB_ENV}
82+
echo 'gcov_cmake="-DCMAKE_Fortran_FLAGS=-fprofile-abs-path -fprofile-arcs -ftest-coverage -O0"' | tee -a ${GITHUB_ENV}
83+
else
84+
echo 'devbuild=OFF' | tee -a ${GITHUB_ENV}
85+
fi
86+
87+
- name: install-utilities
7788
run: |
7889
sudo apt-get install doxygen graphviz
90+
python3 -m pip install gcovr
7991
8092
- name: install-cmake
8193
run: |
@@ -109,14 +121,34 @@ jobs:
109121
export CC=mpicc
110122
export CXX=mpicxx
111123
export FC=mpif90
112-
cat /home/runner/work/fv3atm/fv3atm/spack-develop/opt/spack/linux-ubuntu22.04-zen2/gcc-12.3.0/fms-2023.04-*/lib/cmake/fms/fms-config.cmake
113-
cmake ${GITHUB_WORKSPACE}/fv3atm -DBUILD_TESTING=ON ${{ matrix.cmake_opts }} -DENABLE_DOCS=ON
124+
cmake ${GITHUB_WORKSPACE}/fv3atm -DBUILD_TESTING=ON ${{ matrix.cmake_opts }} -DENABLE_DOCS=ON ${{ env.gcov_cmake }}
114125
make -j2
115-
ls -l /home/runner/work/fv3atm/fv3atm/fv3atm/io
116126
117-
- uses: actions/upload-artifact@v4
127+
- name: run-tests
128+
run: |
129+
cd $GITHUB_WORKSPACE/build
130+
ctest -j2 --output-on-failure --rerun-failed
131+
132+
- name: get-test-coverage
133+
if: ${{ env.devbuild == 'ON' }}
134+
run: |
135+
cd $GITHUB_WORKSPACE/build
136+
gcovr -r .. -v --html-details --gcov-executable gcov-12 --exclude $GITHUB_WORKSPACE/fv3atm/tests --exclude $GITHUB_WORKSPACE/fv3atm/stochastic_physics_repo --exclude $GITHUB_WORKSPACE/fv3atm/build/ccpp --exclude $GITHUB_WORKSPACE/fv3atm/ccpp/physics --exclude $GITHUB_WORKSPACE/fv3atm/ccpp/framework --exclude $GITHUB_WORKSPACE/fv3atm/atmos_cubed_sphere --exclude CMakeFiles --print-summary -o test-coverage.html
137+
138+
- name: upload-test-coverage
139+
uses: actions/upload-artifact@v4
140+
if: ${{ env.devbuild == 'ON' }}
141+
with:
142+
name: test-coverage-fv3atm-${{ github.sha }}
143+
path: |
144+
${{ github.workspace }}/build/*.html
145+
${{ github.workspace }}/build/*.css
146+
147+
- name: upload-docs
148+
uses: actions/upload-artifact@v4
149+
if: ${{ env.devbuild == 'ON' }}
118150
with:
119-
name: docs-gcc${{ matrix.gcc_ver }}-${{ matrix.mpi }}-${{ matrix.cmake_opts }}
151+
name: docs-fv3atm
120152
path: |
121153
build/docs/html
122154
@@ -126,4 +158,3 @@ jobs:
126158
with:
127159
name: ccpp_prebuild_logs-gcc${{ matrix.gcc_ver }}-${{ matrix.mpi }}-${{ matrix.cmake_opts }}
128160
path: ${{ github.workspace }}/build/ccpp/ccpp_prebuild.*
129-

CMakeLists.txt

+5
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,11 @@ if(OPENMP)
164164
target_link_libraries(fv3atm PUBLIC OpenMP::OpenMP_Fortran)
165165
endif()
166166

167+
if(BUILD_TESTING)
168+
include(CTest)
169+
add_subdirectory(tests)
170+
endif()
171+
167172
###############################################################################
168173
### Install
169174
###############################################################################

atmos_model.F90

+509-492
Large diffs are not rendered by default.

ccpp/config/ccpp_prebuild_config.py

+9-10
Original file line numberDiff line numberDiff line change
@@ -55,16 +55,15 @@
5555
},
5656
'GFS_typedefs' : {
5757
'GFS_control_type' : 'GFS_Control',
58-
'GFS_data_type' : 'GFS_Data(cdata%blk_no)',
59-
'GFS_diag_type' : 'GFS_Data(cdata%blk_no)%Intdiag',
60-
'GFS_tbd_type' : 'GFS_Data(cdata%blk_no)%Tbd',
61-
'GFS_sfcprop_type' : 'GFS_Data(cdata%blk_no)%Sfcprop',
62-
'GFS_coupling_type' : 'GFS_Data(cdata%blk_no)%Coupling',
63-
'GFS_statein_type' : 'GFS_Data(cdata%blk_no)%Statein',
64-
'GFS_cldprop_type' : 'GFS_Data(cdata%blk_no)%Cldprop',
65-
'GFS_radtend_type' : 'GFS_Data(cdata%blk_no)%Radtend',
66-
'GFS_grid_type' : 'GFS_Data(cdata%blk_no)%Grid',
67-
'GFS_stateout_type' : 'GFS_Data(cdata%blk_no)%Stateout',
58+
'GFS_statein_type' : 'GFS_Statein',
59+
'GFS_stateout_type' : 'GFS_Stateout',
60+
'GFS_grid_type' : 'GFS_Grid',
61+
'GFS_tbd_type' : 'GFS_Tbd',
62+
'GFS_cldprop_type' : 'GFS_Cldprop',
63+
'GFS_sfcprop_type' : 'GFS_Sfcprop',
64+
'GFS_radtend_type' : 'GFS_Radtend',
65+
'GFS_coupling_type' : 'GFS_Coupling',
66+
'GFS_diag_type' : 'GFS_Intdiag',
6867
'GFS_typedefs' : '',
6968
},
7069
}

ccpp/data/CCPP_data.F90

+29-5
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,15 @@ module CCPP_data
88
use CCPP_typedefs, only: GFS_interstitial_type, &
99
GFDL_interstitial_type
1010
use GFS_typedefs, only: GFS_control_type, &
11-
GFS_data_type
11+
GFS_statein_type, &
12+
GFS_stateout_type, &
13+
GFS_grid_type, &
14+
GFS_tbd_type, &
15+
GFS_cldprop_type, &
16+
GFS_sfcprop_type, &
17+
GFS_radtend_type, &
18+
GFS_coupling_type, &
19+
GFS_diag_type
1220

1321
implicit none
1422

@@ -20,15 +28,31 @@ module CCPP_data
2028
ccpp_suite, &
2129
GFDL_interstitial, &
2230
GFS_control, &
23-
GFS_data, &
31+
GFS_statein, &
32+
GFS_stateout, &
33+
GFS_grid, &
34+
GFS_tbd, &
35+
GFS_cldprop, &
36+
GFS_sfcprop, &
37+
GFS_radtend, &
38+
GFS_coupling, &
39+
GFS_intdiag, &
2440
GFS_interstitial
2541

2642
!-------------------------------------------------------!
27-
! GFS data containers, GFS_Data has dimension nblocks !
28-
! and GFS_Interstitial has dimension nthreads !
43+
! GFS data containers; !
44+
! GFS_Interstitial has dimension nthreads !
2945
!-------------------------------------------------------!
3046
type(GFS_control_type), save, target :: GFS_control
31-
type(GFS_data_type), dimension(:), allocatable, save, target :: GFS_data
47+
type(GFS_statein_type), save, target :: GFS_statein
48+
type(GFS_stateout_type), save, target :: GFS_stateout
49+
type(GFS_grid_type), save, target :: GFS_grid
50+
type(GFS_tbd_type), save, target :: GFS_tbd
51+
type(GFS_cldprop_type), save, target :: GFS_cldprop
52+
type(GFS_sfcprop_type), save, target :: GFS_sfcprop
53+
type(GFS_radtend_type), save, target :: GFS_radtend
54+
type(GFS_coupling_type), save, target :: GFS_coupling
55+
type(GFS_diag_type), save, target :: GFS_intdiag
3256
type(GFS_interstitial_type), dimension(:), allocatable, save, target :: GFS_interstitial
3357

3458
!------------------------------------------------------!

ccpp/data/CCPP_data.meta

+52-10
Original file line numberDiff line numberDiff line change
@@ -24,24 +24,66 @@
2424
units = DDT
2525
dimensions = ()
2626
type = GFS_control_type
27-
[GFS_Data(ccpp_block_number)]
28-
standard_name = GFS_data_type_instance
29-
long_name = instance of derived type GFS_data_type
27+
[GFS_Statein]
28+
standard_name = GFS_statein_type_instance
29+
long_name = prognostic state data in from dycore
3030
units = DDT
3131
dimensions = ()
32-
type = GFS_data_type
32+
type = GFS_statein_type
33+
[GFS_Stateout]
34+
standard_name = GFS_stateout_type_instance
35+
long_name = prognostic state or tendencies return to dycore
36+
units = DDT
37+
dimensions = ()
38+
type = GFS_stateout_type
39+
[GFS_Grid]
40+
standard_name = GFS_grid_type_instance
41+
long_name = instance of derived type GFS_grid_type
42+
units = DDT
43+
dimensions = ()
44+
type = GFS_grid_type
45+
[GFS_Tbd]
46+
standard_name = GFS_tbd_type_instance
47+
long_name = instance of derived type GFS_tbd_type
48+
units = DDT
49+
dimensions = ()
50+
type = GFS_tbd_type
51+
[GFS_Cldprop]
52+
standard_name = GFS_cldprop_type_instance
53+
long_name = instance of derived type GFS_cldprop_type
54+
units = DDT
55+
dimensions = ()
56+
type = GFS_cldprop_type
57+
[GFS_Sfcprop]
58+
standard_name = GFS_sfcprop_type_instance
59+
long_name = instance of derived type GFS_sfcprop_type
60+
units = DDT
61+
dimensions = ()
62+
type = GFS_sfcprop_type
63+
[GFS_Radtend]
64+
standard_name = GFS_radtend_type_instance
65+
long_name = instance of derived type GFS_radtend_type
66+
units = DDT
67+
dimensions = ()
68+
type = GFS_radtend_type
69+
[GFS_Coupling]
70+
standard_name = GFS_coupling_type_instance
71+
long_name = instance of derived type GFS_coupling_type
72+
units = DDT
73+
dimensions = ()
74+
type = GFS_coupling_type
75+
[GFS_Intdiag]
76+
standard_name = GFS_diag_type_instance
77+
long_name = instance of derived type GFS_diag_type
78+
units = DDT
79+
dimensions = ()
80+
type = GFS_diag_type
3381
[GFS_Interstitial(ccpp_thread_number)]
3482
standard_name = GFS_interstitial_type_instance
3583
long_name = instance of derived type GFS_interstitial_type
3684
units = DDT
3785
dimensions = ()
3886
type = GFS_interstitial_type
39-
[GFS_Data]
40-
standard_name = GFS_data_type_instance_all_blocks
41-
long_name = instance of derived type GFS_data_type
42-
units = DDT
43-
dimensions = (ccpp_block_count)
44-
type = GFS_data_type
4587
[GFS_Interstitial]
4688
standard_name = GFS_interstitial_type_instance_all_threads
4789
long_name = instance of derived type GFS_interstitial_type

0 commit comments

Comments
 (0)