Skip to content

Commit

Permalink
mixed precision to interpolator
Browse files Browse the repository at this point in the history
  • Loading branch information
mlee03 authored and mlee03 committed Jul 25, 2023
1 parent b4bacc1 commit a628956
Show file tree
Hide file tree
Showing 117 changed files with 3,926 additions and 1,783 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
52 changes: 52 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,58 @@ 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`).

## [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)


## [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).
- GCC 11.1.0 is unsupported due to compilation issues with select type. The issue is resolved in later GCC releases.
- When outputting sub-region diagnostics, the current diag_manager does not add "tileX" to the filename when using a cube sphere. This leads to trouble when trying to combine the files and regrid them (if the region is in two different tiles)

### Added
- DIAG_MANAGER: Added code refactored as part of larger diag_manager rewrite for the send_data routines. The refactored code is disabled by default and enabled by setting `use_refactored_send` to true in the diag_manager_nml, and should mirror current behaviour.
- FMS2_IO: Added the ability to set deflate_level and shuffle netcdf options in `fms2_io_nml`. Also added functionality for registering dimensions as unlimited compressed.
- YAML_PARSER: Added support for emitting multiple tabbed section keys to allow diag manager yaml output

### Changed
- STRING_UTILS: Extended the `string` interface in fms_string_utils_mod to accept reals of 4 or 8 kind, as well as 1, 2, and 3 dimensional real arrays
- DIAG_MANAGER: Changed the `log_diag_field_info` routine to allow for specifying seperator
- INTERPOLATOR(s): In horiz_interp, amip_interp and interpolator, changed pointers arrays into allocatables

### Fixed
- TRIDIAGONAL: Added OMP directives to prevent race conditions
- DIAG_MANAGER: Added `diag_send_data` routine to fix class(\*) related compiler issues from the refactor update
- SAT_VAPOR_PRES_K: Removed implied saves causing issues with class(\*) type checking
- TIME_INTERP: Fixed naming conflicts between module level and local variables
- YAML_PARSER: Fixed typo in variable name, rename variables to avoid fortran keywords
- DOCS: Fixed incorrect serial build instructions
- COMPILER SUPPORT: Fixed compilation errors with Intel's llvm-based compiler and added support for the CMake build. Also fixed mpp_checksum unit test failures with openmpi and nvhpc compilation issues.
- TIME_MANAGER: Fixed an bug from PR #1169 that was causing answer changes in land models

### Tag Commit Hashes
- 2023.01-beta4 (63626578cb8ed4bed1ce670b88acd6a1ec438e32)
- 2023.01-beta3 (0ff254e409b74d7d17ab234abe5ecd985967256c)
- 2023.01-beta2 (74d8e734bd43b0ce043003da74896e5d747afc2f)
- 2023.01-beta1 (6255971af28381fad22547bdc2c538fc3ea2e8bf)
- 2023.01-alpha4 (4526cc94a3e19fe8fa151f54b0db432e1fb2f7d0)
- 2023.01-alpha3 (f0e8cab3d8e58195f7c2663b84fd0bed12fa8b64)
- 2023.01-alpha2 (91e732473f7cffce070f9ce239f8ffa22c081261)
- 2023.01-alpha1 (203c8bf464ff26fe0fe39b1451caedd026bbce55)


## [2022.04] - 2022-10-13
### 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
9 changes: 8 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ set(CMAKE_Fortran_FLAGS_DEBUG)

# Define the CMake project
project(FMS
VERSION 2022.04.0
VERSION 2023.01.0
DESCRIPTION "GFDL FMS Library"
HOMEPAGE_URL "https://www.gfdl.noaa.gov/fms"
LANGUAGES C Fortran)
Expand Down 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
12 changes: 6 additions & 6 deletions FMS.pc
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,17 @@ includedir=${prefix}/include

# Including the following, as they may be useful when building other components
# and as a way to better record how the library was built.
ccompiler=mpiicc
fccompiler=mpiifort
ccompiler=mpicc
fccompiler=mpif90
cppflagss.compiled= -fopenmp
cflags.compiled=-I/opt/netcdf/4.9.2/ONEAPI/2023.1/include -I/opt/hdf5/1.14.1-2/ONEAPI/2023.1/include -fopenmp
fcflags.compiled=-O0 -g -traceback -I/opt/netcdf/4.9.2/ONEAPI/2023.1/include -I/opt/netcdf/4.9.2/ONEAPI/2023.1/include -FR -real-size 64 -fopenmp
ldflags.compiled=-L/opt/netcdf/4.9.2/ONEAPI/2023.1/lib64 -lnetcdf
cflags.compiled=-I/opt/netcdf/4.9.2/GCC/13.1.0/include -I/opt/libyaml/0.2.5/GNU/13.1.0/include -fopenmp
fcflags.compiled=-I/opt/netcdf/4.9.2/GCC/13.1.0/include -I/opt/netcdf/4.9.2/GCC/13.1.0/include -g -fbacktrace -fopenmp -Wall -Wconversion-extra -I/opt/libyaml/0.2.5/GNU/13.1.0/include -ffree-form -ffree-line-length-none -fdefault-real-8 -fcray-pointer
ldflags.compiled= -L/opt/netcdf/4.9.2/GCC/13.1.0/lib64 -lnetcdf -L/opt/mpich/4.0.3/GNU/12.2.0/lib -L/opt/libyaml/0.2.5/GNU/13.1.0/lib

Name: FMS
Description: The Flexible Modeling System Infrastructure Library
URL: https://www.gfdl.noaa.gov/fms
Version: 2022.04.00-dev
Version: 2023.01.00-dev
Libs: -L$(libdir) -lFMS
Libs.private: -lnetcdff
Cflags: -I${includedir}
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: 18 additions & 2 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ AC_PREREQ([2.69])

# Initialize with name, version, and support email address.
AC_INIT([GFDL FMS Library],
[2022.04.00-dev],
[2023.01.00-dev],
[[email protected]],
[FMS],
[https://www.github.com/NOAA-GFDL/FMS])
Expand Down 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
Loading

0 comments on commit a628956

Please sign in to comment.