Skip to content

Commit

Permalink
Convert GFS DDTs from blocked data structures to contiguous arrays (n…
Browse files Browse the repository at this point in the history
…ow 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]>
  • Loading branch information
3 people authored Aug 8, 2024
1 parent 0495c19 commit aa14843
Show file tree
Hide file tree
Showing 29 changed files with 3,651 additions and 3,247 deletions.
5 changes: 5 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,8 @@ Do PRs in upstream repositories need to be merged first?
If so add the "waiting for other repos" label and list the upstream PRs
- waiting on noaa-emc/nems/pull/<pr_number>
- waiting on noaa-emc/fv3atm/pull/<pr_number>

# Requirements before merging
- [ ] All new code in this PR is tested by at least one unit test
- [ ] All new code in this PR includes Doxygen documentation
- [ ] All new code in this PR does not add new compilation warnings (check CI output)
47 changes: 39 additions & 8 deletions .github/workflows/GCC.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
mpi: ["mpich", "openmpi"]

steps:

- name: checkout-fv3atm
uses: actions/checkout@v4
with:
Expand Down Expand Up @@ -59,6 +59,7 @@ jobs:
spack config add "packages:mpi:require:'${{ matrix.mpi }}'"
spack concretize |& tee ${SPACK_ENV}/log.concretize
spack install -j2 --fail-fast
echo "spackrc=$?" >> ${GITHUB_ENV}
spack clean --all
build_fv3atm:
Expand All @@ -73,9 +74,20 @@ jobs:

steps:

- name: install-doxygen
# Only do Doxygen and gcovr build for one job
- name: decide-doc-gcovr-build
run: |
if [[ "${{ matrix.cmake_opts }}" == "-D32BIT=ON" && "${{ matrix.gcc_ver }}" == 12 && "${{ matrix.mpi }}" == mpich ]]; then
echo 'devbuild=ON' | tee -a ${GITHUB_ENV}
echo 'gcov_cmake="-DCMAKE_Fortran_FLAGS=-fprofile-abs-path -fprofile-arcs -ftest-coverage -O0"' | tee -a ${GITHUB_ENV}
else
echo 'devbuild=OFF' | tee -a ${GITHUB_ENV}
fi
- name: install-utilities
run: |
sudo apt-get install doxygen graphviz
python3 -m pip install gcovr
- name: install-cmake
run: |
Expand Down Expand Up @@ -109,14 +121,34 @@ jobs:
export CC=mpicc
export CXX=mpicxx
export FC=mpif90
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
cmake ${GITHUB_WORKSPACE}/fv3atm -DBUILD_TESTING=ON ${{ matrix.cmake_opts }} -DENABLE_DOCS=ON
cmake ${GITHUB_WORKSPACE}/fv3atm -DBUILD_TESTING=ON ${{ matrix.cmake_opts }} -DENABLE_DOCS=ON ${{ env.gcov_cmake }}
make -j2
ls -l /home/runner/work/fv3atm/fv3atm/fv3atm/io
- uses: actions/upload-artifact@v4
- name: run-tests
run: |
cd $GITHUB_WORKSPACE/build
ctest -j2 --output-on-failure --rerun-failed
- name: get-test-coverage
if: ${{ env.devbuild == 'ON' }}
run: |
cd $GITHUB_WORKSPACE/build
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
- name: upload-test-coverage
uses: actions/upload-artifact@v4
if: ${{ env.devbuild == 'ON' }}
with:
name: test-coverage-fv3atm-${{ github.sha }}
path: |
${{ github.workspace }}/build/*.html
${{ github.workspace }}/build/*.css
- name: upload-docs
uses: actions/upload-artifact@v4
if: ${{ env.devbuild == 'ON' }}
with:
name: docs-gcc${{ matrix.gcc_ver }}-${{ matrix.mpi }}-${{ matrix.cmake_opts }}
name: docs-fv3atm
path: |
build/docs/html
Expand All @@ -126,4 +158,3 @@ jobs:
with:
name: ccpp_prebuild_logs-gcc${{ matrix.gcc_ver }}-${{ matrix.mpi }}-${{ matrix.cmake_opts }}
path: ${{ github.workspace }}/build/ccpp/ccpp_prebuild.*

5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,11 @@ if(OPENMP)
target_link_libraries(fv3atm PUBLIC OpenMP::OpenMP_Fortran)
endif()

if(BUILD_TESTING)
include(CTest)
add_subdirectory(tests)
endif()

###############################################################################
### Install
###############################################################################
Expand Down
1,001 changes: 509 additions & 492 deletions atmos_model.F90

Large diffs are not rendered by default.

19 changes: 9 additions & 10 deletions ccpp/config/ccpp_prebuild_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,16 +55,15 @@
},
'GFS_typedefs' : {
'GFS_control_type' : 'GFS_Control',
'GFS_data_type' : 'GFS_Data(cdata%blk_no)',
'GFS_diag_type' : 'GFS_Data(cdata%blk_no)%Intdiag',
'GFS_tbd_type' : 'GFS_Data(cdata%blk_no)%Tbd',
'GFS_sfcprop_type' : 'GFS_Data(cdata%blk_no)%Sfcprop',
'GFS_coupling_type' : 'GFS_Data(cdata%blk_no)%Coupling',
'GFS_statein_type' : 'GFS_Data(cdata%blk_no)%Statein',
'GFS_cldprop_type' : 'GFS_Data(cdata%blk_no)%Cldprop',
'GFS_radtend_type' : 'GFS_Data(cdata%blk_no)%Radtend',
'GFS_grid_type' : 'GFS_Data(cdata%blk_no)%Grid',
'GFS_stateout_type' : 'GFS_Data(cdata%blk_no)%Stateout',
'GFS_statein_type' : 'GFS_Statein',
'GFS_stateout_type' : 'GFS_Stateout',
'GFS_grid_type' : 'GFS_Grid',
'GFS_tbd_type' : 'GFS_Tbd',
'GFS_cldprop_type' : 'GFS_Cldprop',
'GFS_sfcprop_type' : 'GFS_Sfcprop',
'GFS_radtend_type' : 'GFS_Radtend',
'GFS_coupling_type' : 'GFS_Coupling',
'GFS_diag_type' : 'GFS_Intdiag',
'GFS_typedefs' : '',
},
}
Expand Down
34 changes: 29 additions & 5 deletions ccpp/data/CCPP_data.F90
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,15 @@ module CCPP_data
use CCPP_typedefs, only: GFS_interstitial_type, &
GFDL_interstitial_type
use GFS_typedefs, only: GFS_control_type, &
GFS_data_type
GFS_statein_type, &
GFS_stateout_type, &
GFS_grid_type, &
GFS_tbd_type, &
GFS_cldprop_type, &
GFS_sfcprop_type, &
GFS_radtend_type, &
GFS_coupling_type, &
GFS_diag_type

implicit none

Expand All @@ -20,15 +28,31 @@ module CCPP_data
ccpp_suite, &
GFDL_interstitial, &
GFS_control, &
GFS_data, &
GFS_statein, &
GFS_stateout, &
GFS_grid, &
GFS_tbd, &
GFS_cldprop, &
GFS_sfcprop, &
GFS_radtend, &
GFS_coupling, &
GFS_intdiag, &
GFS_interstitial

!-------------------------------------------------------!
! GFS data containers, GFS_Data has dimension nblocks !
! and GFS_Interstitial has dimension nthreads !
! GFS data containers; !
! GFS_Interstitial has dimension nthreads !
!-------------------------------------------------------!
type(GFS_control_type), save, target :: GFS_control
type(GFS_data_type), dimension(:), allocatable, save, target :: GFS_data
type(GFS_statein_type), save, target :: GFS_statein
type(GFS_stateout_type), save, target :: GFS_stateout
type(GFS_grid_type), save, target :: GFS_grid
type(GFS_tbd_type), save, target :: GFS_tbd
type(GFS_cldprop_type), save, target :: GFS_cldprop
type(GFS_sfcprop_type), save, target :: GFS_sfcprop
type(GFS_radtend_type), save, target :: GFS_radtend
type(GFS_coupling_type), save, target :: GFS_coupling
type(GFS_diag_type), save, target :: GFS_intdiag
type(GFS_interstitial_type), dimension(:), allocatable, save, target :: GFS_interstitial

!------------------------------------------------------!
Expand Down
62 changes: 52 additions & 10 deletions ccpp/data/CCPP_data.meta
Original file line number Diff line number Diff line change
Expand Up @@ -24,24 +24,66 @@
units = DDT
dimensions = ()
type = GFS_control_type
[GFS_Data(ccpp_block_number)]
standard_name = GFS_data_type_instance
long_name = instance of derived type GFS_data_type
[GFS_Statein]
standard_name = GFS_statein_type_instance
long_name = prognostic state data in from dycore
units = DDT
dimensions = ()
type = GFS_data_type
type = GFS_statein_type
[GFS_Stateout]
standard_name = GFS_stateout_type_instance
long_name = prognostic state or tendencies return to dycore
units = DDT
dimensions = ()
type = GFS_stateout_type
[GFS_Grid]
standard_name = GFS_grid_type_instance
long_name = instance of derived type GFS_grid_type
units = DDT
dimensions = ()
type = GFS_grid_type
[GFS_Tbd]
standard_name = GFS_tbd_type_instance
long_name = instance of derived type GFS_tbd_type
units = DDT
dimensions = ()
type = GFS_tbd_type
[GFS_Cldprop]
standard_name = GFS_cldprop_type_instance
long_name = instance of derived type GFS_cldprop_type
units = DDT
dimensions = ()
type = GFS_cldprop_type
[GFS_Sfcprop]
standard_name = GFS_sfcprop_type_instance
long_name = instance of derived type GFS_sfcprop_type
units = DDT
dimensions = ()
type = GFS_sfcprop_type
[GFS_Radtend]
standard_name = GFS_radtend_type_instance
long_name = instance of derived type GFS_radtend_type
units = DDT
dimensions = ()
type = GFS_radtend_type
[GFS_Coupling]
standard_name = GFS_coupling_type_instance
long_name = instance of derived type GFS_coupling_type
units = DDT
dimensions = ()
type = GFS_coupling_type
[GFS_Intdiag]
standard_name = GFS_diag_type_instance
long_name = instance of derived type GFS_diag_type
units = DDT
dimensions = ()
type = GFS_diag_type
[GFS_Interstitial(ccpp_thread_number)]
standard_name = GFS_interstitial_type_instance
long_name = instance of derived type GFS_interstitial_type
units = DDT
dimensions = ()
type = GFS_interstitial_type
[GFS_Data]
standard_name = GFS_data_type_instance_all_blocks
long_name = instance of derived type GFS_data_type
units = DDT
dimensions = (ccpp_block_count)
type = GFS_data_type
[GFS_Interstitial]
standard_name = GFS_interstitial_type_instance_all_threads
long_name = instance of derived type GFS_interstitial_type
Expand Down
Loading

0 comments on commit aa14843

Please sign in to comment.