Skip to content

Commit

Permalink
chore: Update mixedmode (#1304)
Browse files Browse the repository at this point in the history
  • Loading branch information
mlee03 authored Jul 27, 2023
1 parent ba97253 commit d2733bb
Show file tree
Hide file tree
Showing 104 changed files with 3,820 additions and 1,693 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
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,24 @@ and this project uses `yyyy.rr[.pp]`, where `yyyy` is the year a patch is releas
`rr` is a sequential release number (starting from `01`), and an optional two-digit
sequential patch number (starting from `01`).

<<<<<<< HEAD
=======
## [2023.01.01] - 2023-06-06
### Changed
- FMS2_IO: Performance changes for domain_reads_2d and domain_reads_3d:
- Root pe reads the data
- Uses mpp_scatter to send the data to the other pes
- Added unit tests to test all of the domain_read/domain_write interfaces

- FMS2_IO: Performance changes for compressed_writes_1d/2d/3d
- Uses mpp_gather to get data for write
- Added unit tests to test all of the compressed writes interfaces
- Compressed_writes_4d/5d were unchanged

- FMS2_IO: Extended mpp_scatter and mpp_gather to work for int8; added a kludge for scatter since the data is assumed to be (x,y,z)


>>>>>>> origin/mixedmode_base
## [2023.01] - 2023-04-03
### Known Issues
- If using GCC 10 or higher as well as MPICH, compilation errors will occur unless `-fallow-argument-mismatch` is included in the Fortran compiler flags(the flag will now be added automatically if building with autotools or CMake).
Expand Down
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
5 changes: 4 additions & 1 deletion amip_interp/amip_interp.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1353,7 +1353,10 @@ subroutine read_record (type, Date, Adate, dat)
else
call fms2_io_read_data(fileobj, ncfieldname, dat, unlim_dim_level=k)
endif
idat = nint(dat, I2_KIND) ! reconstruct packed data for reproducibility
!TODO This assumes that the data is "packed" (has the scale_factor and add_offset attributes)
! in fms2_io_read_data the data is unpacked (data_in_file*scale_factor + add_offset)
! the line below "packs" the data again. This is needed for reproducibility
idat = nint(dat*100., I2_KIND)

!---- unpacking of data ----

Expand Down
5 changes: 4 additions & 1 deletion amip_interp/include/amip_interp.inc
Original file line number Diff line number Diff line change
Expand Up @@ -1353,7 +1353,10 @@ endif
else
call fms2_io_read_data(fileobj, ncfieldname, dat, unlim_dim_level=k)
endif
idat = nint(dat, I2_KIND) ! reconstruct packed data for reproducibility
!TODO This assumes that the data is "packed" (has the scale_factor and add_offset attributes)
! in fms2_io_read_data the data is unpacked (data_in_file*scale_factor + add_offset)
! the line below "packs" the data again. This is needed for reproducibility
idat = nint(dat*100., I2_KIND)
!---- unpacking of data ----
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
30 changes: 14 additions & 16 deletions axis_utils/include/axis_utils2.inc
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

!***********************************************************************
!* GNU Lesser General Public License
!*
Expand Down Expand Up @@ -165,28 +164,27 @@
end function LON_IN_RANGE_
!> @brief Returns monotonic array of longitudes s.t., lon_strt <= lon(:) <= lon_strt+360.
!> @brief Returns monotonic array of longitudes s.t., lon_strt <= lon(:) < lon_strt+360.
!!
!! This may require that entries be moved from the beginning of the array to
!! the end. If no entries are moved (i.e., if lon(:) is already monotonic in
!! the range from lon_start to lon_start + 360), then istrt is set to 0. If
!! any entries are moved, then istrt is set to the original index of the entry
!! which becomes lon(1).
!!
!! e.g.,
!!
!> <br>The first istrt-1 entries are moved to the end of the array:
!! lon = 0 1 2 3 4 5 ... 358 359; lon_strt = 3
!! ==> lon = 3 4 5 6 7 8 ... 359 360 361 362; istrt = 4
!!
!! e.g.
!! lon = 0 1 2 3 4 5 ... 358 359; lon_strt = 3 ==>
!! tranlon = 3 4 5 6 7 8 ... 359 360 361 362; istrt = 4
!! lon = 0 1 2 3 4 5 ... 358 359; lon_strt = 0
!! ==> lon = 0 1 2 3 4 5 ... 358 359; istrt = 0
subroutine TRANLON_(lon, lon_start, istrt)
! returns array of longitudes s.t. lon_strt <= lon < lon_strt+360.
! also, the first istrt-1 entries are moved to the end of the array
!
! e.g.
! lon = 0 1 2 3 4 5 ... 358 359; lon_strt = 3 ==>
! tranlon = 3 4 5 6 7 8 ... 359 360 361 362; istrt = 4
real(kind=FMS_AU_KIND_), intent(inout), dimension(:) :: lon
real(kind=FMS_AU_KIND_), intent(in) :: lon_start
integer, intent(out) :: istrt
integer :: len, i
real(kind=FMS_AU_KIND_) :: lon_strt, tmp(size(lon(:))-1)
Expand Down Expand Up @@ -214,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 @@ -96,8 +98,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 @@ -150,8 +154,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 @@ -327,17 +333,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 @@ -3751,6 +3760,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 @@ -4064,7 +4074,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
Loading

0 comments on commit d2733bb

Please sign in to comment.