Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mixed-precision diag_integral_mod #1217

Merged
merged 42 commits into from
Aug 3, 2023
Merged
Show file tree
Hide file tree
Changes from 39 commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
46d8e44
Update mixedmode_base branch to main (#1144)
mlee03 Mar 8, 2023
dde0b88
update the mixedmode_base branch to main (#1154)
mlee03 Mar 15, 2023
bc9e4d9
Merge branch 'mixedmode' into mixedmode_base
rem1776 Apr 5, 2023
2977578
rm accidental empty line
Apr 5, 2023
b3374f6
chore: bring mixedmode_base up to date with main (#1173)
mlee03 Apr 5, 2023
75ae1ba
diag_integral mixedmode update
May 4, 2023
a35a730
fix ci
May 4, 2023
91a1171
diag_integral cmake fix
May 4, 2023
d7709bc
attempt to fix ci
May 4, 2023
886849e
fix ci?
May 4, 2023
18514e2
push fh files
May 4, 2023
94a1e86
add unit tests
May 10, 2023
7fe7c46
more unit testing
May 10, 2023
3e218ca
cleanup test
May 11, 2023
2b84cf3
fix diag_integral mixedmode updates
May 11, 2023
4cfea48
add test_sum_field_wght_3d
May 11, 2023
526eaf3
cleanup
May 11, 2023
ae9e29e
missed get_axis_time
May 11, 2023
f6b5506
forgot r8_kind, ci failed
May 11, 2023
cca0c7d
chore: update mixedmode_base to main (#1234)
mlee03 May 24, 2023
e3653f6
add hemi tests
Jul 6, 2023
4d0ce31
unit tests version 1
Jul 7, 2023
ea06581
simplify unit tests
Jul 7, 2023
07d83b8
add comments
Jul 7, 2023
c9ad0ce
add one more TODO
Jul 7, 2023
712330b
chore: merge main updates into mixedmode_base(#1267)
mlee03 Jul 7, 2023
dbdd8ab
change lkind to r8_kind in unit test
Jul 12, 2023
77fa219
Merge remote-tracking branch 'origin/mixedmode' into mixedmode-diagint
Jul 19, 2023
21eeb95
fix merge conflict in cmake
Jul 19, 2023
54762df
missed merge conflict issues in cmake
Jul 19, 2023
20a3b9a
merge main updates to mixedmode_base
Jul 19, 2023
313d032
spaces
Jul 19, 2023
c65263f
update to main
Jul 19, 2023
18fb872
fix configure.ac
Jul 19, 2023
670e6be
one more update to configure.ac
Jul 19, 2023
5922527
constants4
Jul 19, 2023
39949fe
constants4 debacle
Jul 24, 2023
995d198
update diag_integral
Jul 25, 2023
282bc99
forgot about Makefile.am
Jul 25, 2023
591114b
Merge remote-tracking branch 'origin/mixedmode' into mixedmode-diagint
Jul 31, 2023
6268731
fix changelog
Aug 2, 2023
8375aae
fix monin stable_mix_3d
Aug 2, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)


>>>>>>> mkl/update_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
12 changes: 10 additions & 2 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 Expand Up @@ -299,6 +306,7 @@ foreach(kind ${kinds})
mpp/include
sat_vapor_pres/include
horiz_interp/include
diag_integral/include
random_numbers/include
diag_manager/include
constants4
Expand Down Expand Up @@ -347,9 +355,9 @@ foreach(kind ${kinds})
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/horiz_interp/include>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/string_utils/include>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/mpp/include>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/random_numbers/include>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/diag_integral/include>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/diag_manager/include>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/field_manager/include>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note to reviewers: field_manager was included twice. Hence this line was deleted in this PR

$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/random_numbers/include>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/tracer_manager/include>)

target_include_directories(${libTgt} INTERFACE
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
20 changes: 19 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 Expand Up @@ -480,8 +496,10 @@ AC_CONFIG_FILES([
test_fms/parser/Makefile
test_fms/string_utils/Makefile
test_fms/sat_vapor_pres/Makefile
test_fms/diag_integral/Makefile
test_fms/tracer_manager/Makefile
test_fms/random_numbers/Makefile

FMS.pc
])

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
Loading