Skip to content

Commit

Permalink
Merge pull request #3 from dustinswales/feature/ccpp_implementation
Browse files Browse the repository at this point in the history
Feature/ccpp implementation
  • Loading branch information
dustinswales authored Aug 28, 2024
2 parents 37161ba + f2d5eb2 commit e442346
Show file tree
Hide file tree
Showing 39 changed files with 4,193 additions and 3,352 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.*

6 changes: 6 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ endif()
###############################################################################

set(MPI ON)
set(OLD_MPTBLS ON)
add_subdirectory(ccpp)

###############################################################################
Expand Down Expand Up @@ -164,6 +165,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,007 changes: 512 additions & 495 deletions atmos_model.F90

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions ccpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,16 @@ endif()
#------------------------------------------------------------------------------
# Add host-model specific preprocessor flag (needed for some physics schemes)
add_definitions(-DFV3)
add_definitions(-DOLD_MPTBLS)

#------------------------------------------------------------------------------
# Set MPI flags for C/C++/Fortran preprocessor
if(MPI)
add_definitions(-DMPI)
endif()
if (OLD_MPTBLS)
add_definitions(-DOLD_MPTBLS)
endif()

#------------------------------------------------------------------------------
# Set flag for 32bit dynamics build
Expand Down
25 changes: 12 additions & 13 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 Expand Up @@ -163,9 +162,9 @@
'physics/physics/MP/Thompson/mp_thompson_pre.F90',
'physics/physics/MP/Thompson/mp_thompson.F90',
'physics/physics/MP/Thompson/mp_thompson_post.F90',
'physics/physics/MP/TEMPO/drivers/ccpp/mp_tempo_pre.F90',
'physics/physics/MP/TEMPO/drivers/ccpp/mp_tempo.F90',
'physics/physics/MP/TEMPO/drivers/ccpp/mp_tempo_post.F90',
'physics/physics/MP/TEMPO/mp_tempo_pre.F90',
'physics/physics/MP/TEMPO/mp_tempo.F90',
'physics/physics/MP/TEMPO/mp_tempo_post.F90',
'physics/physics/MP/Zhao_Carr/zhaocarr_gscond.f',
'physics/physics/MP/Zhao_Carr/zhaocarr_precpd.f',
'physics/physics/PBL/HEDMF/hedmf.f',
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 e442346

Please sign in to comment.