Skip to content

Commit

Permalink
mixed-precision: update mixedmode base (#1289)
Browse files Browse the repository at this point in the history
  • Loading branch information
mlee03 authored Jul 26, 2023
1 parent 712330b commit 8c72630
Show file tree
Hide file tree
Showing 64 changed files with 1,401 additions and 920 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/build_cmake_gnu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@ jobs:
matrix:
omp-flags: [ -DOPENMP=on, -DOPENMP=off ]
libyaml-flag: [ "", -DWITH_YAML=on ]
io-flag: [ "", -DUSE_DEPRECATED_IO=on ]
container:
image: noaagfdl/hpc-me.ubuntu-minimal:cmake
env:
CMAKE_FLAGS: "${{ matrix.omp-flags }} ${{ matrix.libyaml-flag }} -D64BIT=on"
CMAKE_FLAGS: "${{ matrix.omp-flags }} ${{ matrix.io-flag }} ${{ matrix.libyaml-flag }} -D64BIT=on"
steps:
- name: Checkout code
uses: actions/checkout@v2
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/build_ubuntu_gnu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@ jobs:
matrix:
conf-flags: [--disable-openmp, --enable-mixed-mode, --disable-setting-flags, --with-mpi=no]
input-flag: [--with-yaml, --enable-test-input=/home/unit_tests_input]
io-flag: [ --enable-deprecated-io, --disable-deprecated-io]
container:
image: noaagfdl/hpc-me.ubuntu-minimal:gnu-input
env:
TEST_VERBOSE: 1
DISTCHECK_CONFIGURE_FLAGS: "${{ matrix.conf-flags }} ${{ matrix.input-flag }}"
DISTCHECK_CONFIGURE_FLAGS: "${{ matrix.conf-flags }} ${{ matrix.input-flag }} ${{ matrix.io-flag }}"
steps:
- name: Checkout code
uses: actions/checkout@v2
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/intel_pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ jobs:
intel-autotools:
runs-on: ubuntu-latest
container:
image: intel/oneapi-hpckit:2022.2-devel-ubuntu20.04
image: intel/oneapi-hpckit:2023.1.0-devel-ubuntu20.04
env:
CC: mpiicc
FC: mpiifort
Expand All @@ -22,7 +22,7 @@ jobs:
path: /libs
key: ${{ runner.os }}-intel-libs
- name: Install packages for building
run: apt update && apt install -y autoconf libtool automake zlibc zlib1g-dev
run: apt-get update && apt-get install -y autoconf libtool automake zlibc zlib1g-dev
- if: steps.cache.outputs.cache-hit != 'true'
name: Build netcdf
run: |
Expand Down Expand Up @@ -50,4 +50,4 @@ jobs:
- name: Compile
run: make -j || make
- name: Run test suite
run: make check LD_LIBRARY_PATH="/libs/lib:$LD_LIBRARY_PATH" SKIP_TESTS="$SKIP_TESTS" VERBOSE=1
run: make check LD_LIBRARY_PATH="/libs/lib:$LD_LIBRARY_PATH" TEST_VERBOSE=1
28 changes: 23 additions & 5 deletions .github/workflows/update_docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
types: [published]
workflow_dispatch:
jobs:
update_docs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
Expand All @@ -23,8 +23,26 @@ jobs:
run: |
sudo apt -y install doxygen graphviz
doxygen gen_docs/Doxyfile
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
- name: Upload Pages Artifact
uses: actions/upload-pages-artifact@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./gen_docs/html
path: 'gen_docs/html'
deploy:
needs: build

# Grant GITHUB_TOKEN the permissions required to make a Pages deployment
permissions:
pages: write # to deploy to Pages
id-token: write # to verify the deployment originates from an appropriate source

# Deploy to the github-pages environment
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}

# Specify runner + deployment step
runs-on: ubuntu-latest
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1
7 changes: 7 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ option(ENABLE_QUAD_PRECISION "Enable compiler definition -DENABLE_QUAD_PRECISION
option(GFS_PHYS "Enable compiler definition -DGFS_PHYS" OFF)
option(LARGEFILE "Enable compiler definition -Duse_LARGEFILE" OFF)
option(WITH_YAML "Enable compiler definition -Duse_yaml" OFF)
option(USE_DEPRECATED_IO "Enable compiler definition -Duse_deprecated_io (compile with fms_io/mpp_io)" OFF)

if(32BIT)
list(APPEND kinds "r4")
Expand Down Expand Up @@ -109,6 +110,8 @@ list(APPEND fms_fortran_src_files
column_diagnostics/column_diagnostics.F90
constants/constants.F90
constants/fmsconstants.F90
constants4/constantsr4.F90
constants4/fmsconstantsr4.F90
coupler/atmos_ocean_fluxes.F90
coupler/coupler_types.F90
coupler/ensemble_manager.F90
Expand Down Expand Up @@ -244,6 +247,10 @@ if(WITH_YAML)
list(APPEND fms_defs use_yaml)
endif()

if(USE_DEPRECATED_IO)
list(APPEND fms_defs use_deprecated_io)
endif()

if(INTERNAL_FILE_NML)
list(APPEND fms_defs INTERNAL_FILE_NML)
endif()
Expand Down
1 change: 1 addition & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ SUBDIRS = \
tridiagonal \
mpp \
constants \
constants4 \
memutils \
string_utils \
fms2_io \
Expand Down
3 changes: 2 additions & 1 deletion axis_utils/axis_utils.F90
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
!> @addtogroup axis_utils_mod
!> @{
module axis_utils_mod
#ifdef use_deprecated_io
use netcdf
use mpp_io_mod, only: axistype, atttype, default_axis, default_att, &
mpp_get_atts, mpp_get_axis_data, mpp_modify_meta, &
Expand Down Expand Up @@ -787,7 +788,7 @@ subroutine find_index(grid1, xs, xe, ks, ke)
if(ke == 0 ) call mpp_error(FATAL,' xe locate outside of grid1')

end subroutine find_index

#endif
end module axis_utils_mod
!> @}
! close documentation grouping
2 changes: 1 addition & 1 deletion axis_utils/include/axis_utils2.inc
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@
endif
lon_strt = lon(1)
do i=2,len+1
do i=2,len
lon(i) = lon_in_range(lon(i),lon_strt)
lon_strt = lon(i)
enddo
Expand Down
18 changes: 17 additions & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,13 @@ AS_IF([test ${enable_8byte_int:-no} = yes],
[enable_8byte_int=yes],
[enable_8byte_int=no])

AC_ARG_ENABLE([deprecated-io],
[AS_HELP_STRING([--enable-deprecated-io],
[Enables compilation of deprecated mpp_io and fms_io modules in addition to the updated fms2_io modules (default no)])])
AS_IF([test ${enable_deprecated_io:-no} = yes],
[enable_deprecated_io=yes],
[enable_deprecated_io=no])

# user enabled testing with input files
AC_MSG_CHECKING([whether to enable tests with input files])
AC_ARG_ENABLE([test-input],
Expand Down Expand Up @@ -203,7 +210,6 @@ AC_MSG_CHECKING([if netCDF was built with HDF5])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [[
#include <netcdf_meta.h>
#if !(NC_HAS_NC4)
choke me
#endif]])], [nc_has_nc4=yes], [nc_has_nc4=no])
AC_MSG_RESULT([$nc_has_nc4])
if test $nc_has_nc4 = no; then
Expand Down Expand Up @@ -281,6 +287,15 @@ if test $with_mpi = yes; then
AC_DEFINE([use_libMPI], [1], [This is required for the library to build])
fi

# check if compiling old io
if test $enable_deprecated_io = yes; then
#If the test pass, define use_deprecated_io macro and skip it's unit tests
AC_DEFINE([use_deprecated_io], [1], [This is required to use mpp_io and fms_io modules])
AM_CONDITIONAL([SKIP_DEPRECATED_IO_TESTS], true)
else
AM_CONDITIONAL([SKIP_DEPRECATED_IO_TESTS], false)
fi

# Set any required compile flags. This will not be done if the user wants to
# define all their own flags.
if test $enable_setting_flags = yes; then
Expand Down Expand Up @@ -426,6 +441,7 @@ AC_CONFIG_FILES([
time_interp/Makefile
time_manager/Makefile
constants/Makefile
constants4/Makefile
platform/Makefile
fms/Makefile
fms2_io/Makefile
Expand Down
14 changes: 12 additions & 2 deletions coupler/coupler_types.F90
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,10 @@ module coupler_types_mod
use fms2_io_mod, only: get_variable_attribute, get_dimension_size, get_dimension_names
use fms2_io_mod, only: register_variable_attribute, get_variable_dimension_names
use fms2_io_mod, only: get_variable_num_dimensions
#ifdef use_deprecated_io
use fms_io_mod, only: restart_file_type, fms_io_register_restart_field=>register_restart_field
use fms_io_mod, only: query_initialized, restore_state
#endif
use time_manager_mod, only: time_type
use diag_manager_mod, only: register_diag_field, send_data
use data_override_mod, only: data_override
Expand Down Expand Up @@ -95,8 +97,10 @@ module coupler_types_mod
integer :: atm_tr_index = 0 !< atm_tr_index
character(len=128) :: ice_restart_file = ' ' !< ice_restart_file
character(len=128) :: ocean_restart_file = ' ' !< ocean_restart_file
#ifdef use_deprecated_io
type(restart_file_type), pointer :: rest_type => NULL() !< A pointer to the restart_file_type
!! that is used for this field.
#endif
type(FmsNetcdfDomainFile_t), pointer :: fms2_io_rest_type => NULL() !< A pointer to the restart_file_type
!! That is used for this field
logical :: use_atm_pressure !< use_atm_pressure
Expand Down Expand Up @@ -149,8 +153,10 @@ module coupler_types_mod
integer :: atm_tr_index = 0 !< atm_tr_index
character(len=128) :: ice_restart_file = ' ' !< ice_restart_file
character(len=128) :: ocean_restart_file = ' ' !< ocean_restart_file
#ifdef use_deprecated_io
type(restart_file_type), pointer :: rest_type => NULL() !< A pointer to the restart_file_type
!! that is used for this field.
#endif
type(FmsNetcdfDomainFile_t), pointer :: fms2_io_rest_type => NULL() !< A pointer to the restart_file_type
!! That is used for this field
logical :: use_atm_pressure !< use_atm_pressure
Expand Down Expand Up @@ -319,17 +325,20 @@ module coupler_types_mod
!! in restart files.
!> @ingroup coupler_types_mod
interface coupler_type_register_restarts
#ifdef use_deprecated_io
module procedure mpp_io_CT_register_restarts_2d, mpp_io_CT_register_restarts_3d
module procedure mpp_io_CT_register_restarts_to_file_2d, mpp_io_CT_register_restarts_to_file_3d

#endif
module procedure CT_register_restarts_2d, CT_register_restarts_3d
end interface coupler_type_register_restarts

!> This is the interface to read in the fields in a coupler_bc_type that have
!! been saved in restart files.
!> @ingroup coupler_types_mod
interface coupler_type_restore_state
#ifdef use_deprecated_io
module procedure mpp_io_CT_restore_state_2d, mpp_io_CT_restore_state_3d
#endif
module procedure CT_restore_state_2d, CT_restore_state_3d
end interface coupler_type_restore_state

Expand Down Expand Up @@ -3743,6 +3752,7 @@ end subroutine CT_destructor_3d
!!
!! This subroutine registers the fields in a coupler_2d_bc_type to be saved in restart files
!! specified in the field table.
#ifdef use_deprecated_io
subroutine mpp_io_CT_register_restarts_2d(var, bc_rest_files, num_rest_files, mpp_domain, ocean_restart)
type(coupler_2d_bc_type), intent(inout) :: var !< BC_type structure to be registered for restarts
type(restart_file_type), dimension(:), pointer :: bc_rest_files !< Structures describing the restart files
Expand Down Expand Up @@ -4056,7 +4066,7 @@ subroutine mpp_io_CT_restore_state_3d(var, directory, all_or_nothing, all_requir
endif
endif
end subroutine mpp_io_CT_restore_state_3d

#endif
end module coupler_types_mod
!> @}
! close documentation grouping
4 changes: 4 additions & 0 deletions coupler/ensemble_manager.F90
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ module ensemble_manager_mod
use mpp_mod, only : mpp_pe, mpp_declare_pelist
use mpp_mod, only : input_nml_file
use fms2_io_mod, only : fms2_io_set_filename_appendix=>set_filename_appendix
#ifdef use_deprecated_io
use fms_io_mod, only : fms_io_set_filename_appendix=>set_filename_appendix
#endif

IMPLICIT NONE

Expand Down Expand Up @@ -408,7 +410,9 @@ subroutine ensemble_pelist_setup(concurrent, atmos_npes, ocean_npes, land_npes,

!< Both calls are needed for cases where both fms2io/fmsio are used
call fms2_io_set_filename_appendix(trim(text))
#ifdef use_deprecated_io
call fms_io_set_filename_appendix(trim(text))
#endif
endif

end subroutine ensemble_pelist_setup
Expand Down
14 changes: 12 additions & 2 deletions coupler/include/coupler_types.inc
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,10 @@ module coupler_types_mod
use fms2_io_mod, only: get_variable_attribute, get_dimension_size, get_dimension_names
use fms2_io_mod, only: register_variable_attribute, get_variable_dimension_names
use fms2_io_mod, only: get_variable_num_dimensions
#ifdef use_deprecated_io
use fms_io_mod, only: restart_file_type, fms_io_register_restart_field=>register_restart_field
use fms_io_mod, only: query_initialized, restore_state
#endif
use time_manager_mod, only: time_type
use diag_manager_mod, only: register_diag_field, send_data
use data_override_mod, only: data_override
Expand Down Expand Up @@ -95,8 +97,10 @@ module coupler_types_mod
integer :: atm_tr_index = 0 !< atm_tr_index
character(len=128) :: ice_restart_file = ' ' !< ice_restart_file
character(len=128) :: ocean_restart_file = ' ' !< ocean_restart_file
#ifdef use_deprecated_io
type(restart_file_type), pointer :: rest_type => NULL() !< A pointer to the restart_file_type
!! that is used for this field.
#endif
type(FmsNetcdfDomainFile_t), pointer :: fms2_io_rest_type => NULL() !< A pointer to the restart_file_type
!! That is used for this field
logical :: use_atm_pressure !< use_atm_pressure
Expand Down Expand Up @@ -149,8 +153,10 @@ module coupler_types_mod
integer :: atm_tr_index = 0 !< atm_tr_index
character(len=128) :: ice_restart_file = ' ' !< ice_restart_file
character(len=128) :: ocean_restart_file = ' ' !< ocean_restart_file
#ifdef use_deprecated_io
type(restart_file_type), pointer :: rest_type => NULL() !< A pointer to the restart_file_type
!! that is used for this field.
#endif
type(FmsNetcdfDomainFile_t), pointer :: fms2_io_rest_type => NULL() !< A pointer to the restart_file_type
!! That is used for this field
logical :: use_atm_pressure !< use_atm_pressure
Expand Down Expand Up @@ -319,17 +325,20 @@ module coupler_types_mod
!! in restart files.
!> @ingroup coupler_types_mod
interface coupler_type_register_restarts
#ifdef use_deprecated_io
module procedure mpp_io_CT_register_restarts_2d, mpp_io_CT_register_restarts_3d
module procedure mpp_io_CT_register_restarts_to_file_2d, mpp_io_CT_register_restarts_to_file_3d

#endif
module procedure CT_register_restarts_2d, CT_register_restarts_3d
end interface coupler_type_register_restarts

!> This is the interface to read in the fields in a coupler_bc_type that have
!! been saved in restart files.
!> @ingroup coupler_types_mod
interface coupler_type_restore_state
#ifdef use_deprecated_io
module procedure mpp_io_CT_restore_state_2d, mpp_io_CT_restore_state_3d
#endif
module procedure CT_restore_state_2d, CT_restore_state_3d
end interface coupler_type_restore_state

Expand Down Expand Up @@ -3743,6 +3752,7 @@ contains
!!
!! This subroutine registers the fields in a coupler_2d_bc_type to be saved in restart files
!! specified in the field table.
#ifdef use_deprecated_io
subroutine mpp_io_CT_register_restarts_2d(var, bc_rest_files, num_rest_files, mpp_domain, ocean_restart)
type(coupler_2d_bc_type), intent(inout) :: var !< BC_type structure to be registered for restarts
type(restart_file_type), dimension(:), pointer :: bc_rest_files !< Structures describing the restart files
Expand Down Expand Up @@ -4056,7 +4066,7 @@ contains
endif
endif
end subroutine mpp_io_CT_restore_state_3d

#endif
end module coupler_types_mod
!> @}
! close documentation grouping
4 changes: 4 additions & 0 deletions coupler/include/ensemble_manager.inc
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ module ensemble_manager_mod
use mpp_mod, only : mpp_pe, mpp_declare_pelist
use mpp_mod, only : input_nml_file
use fms2_io_mod, only : fms2_io_set_filename_appendix=>set_filename_appendix
#ifdef use_deprecated_io
use fms_io_mod, only : fms_io_set_filename_appendix=>set_filename_appendix
#endif

IMPLICIT NONE

Expand Down Expand Up @@ -408,7 +410,9 @@ contains

!< Both calls are needed for cases where both fms2io/fmsio are used
call fms2_io_set_filename_appendix(trim(text))
#ifdef use_deprecated_io
call fms_io_set_filename_appendix(trim(text))
#endif
endif

end subroutine ensemble_pelist_setup
Expand Down
5 changes: 3 additions & 2 deletions diag_manager/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,9 @@ fms_diag_axis_object_mod.$(FC_MODEXT): diag_data_mod.$(FC_MODEXT) fms_diag_time_
fms_diag_time_reduction_mod.$(FC_MODEXT): diag_data_mod.$(FC_MODEXT)
fms_diag_elem_weight_procs_mod.$(FC_MODEXT): diag_data_mod.$(FC_MODEXT)
fms_diag_outfield_mod.$(FC_MODEXT): diag_data_mod.$(FC_MODEXT) fms_diag_elem_weight_procs_mod.$(FC_MODEXT)
fms_diag_fieldbuff_update_mod.$(FC_MODEXT): diag_data_mod.$(FC_MODEXT) fms_diag_outfield_mod.$(FC_MODEXT) \
fms_diag_elem_weight_procs_mod.$(FC_MODEXT) fms_diag_bbox_mod.$(FC_MODEXT)
fms_diag_fieldbuff_update_mod.$(FC_MODEXT): diag_data_mod.$(FC_MODEXT) diag_util_mod.$(FC_MODEXT) \
fms_diag_outfield_mod.$(FC_MODEXT) fms_diag_elem_weight_procs_mod.$(FC_MODEXT) \
fms_diag_bbox_mod.$(FC_MODEXT)
diag_manager_mod.$(FC_MODEXT): diag_axis_mod.$(FC_MODEXT) diag_data_mod.$(FC_MODEXT) diag_util_mod.$(FC_MODEXT) \
diag_output_mod.$(FC_MODEXT) diag_grid_mod.$(FC_MODEXT) diag_table_mod.$(FC_MODEXT) \
fms_diag_time_reduction_mod.$(FC_MODEXT) fms_diag_outfield_mod.$(FC_MODEXT) \
Expand Down
Loading

0 comments on commit 8c72630

Please sign in to comment.