-
Notifications
You must be signed in to change notification settings - Fork 138
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
horiz interp mixed precision #1067
Conversation
horiz_interp/horiz_interp.inc
Outdated
allocate(lon_src_1d(nlon_in), lat_src_1d(nlat_in)) | ||
allocate(lon_dst(nlon_out,nlat_out), lat_dst(nlon_out,nlat_out)) | ||
do i = 1, nlon_in | ||
lon_src_1d(i) = (lon_in(i) + lon_in(i+1)) * 0.5 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should also make numerical values of the same precision: real(0.5, FMS_HI_KIND_)
horiz_interp/horiz_interp.inc
Outdated
@@ -0,0 +1,818 @@ | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about make a separate include directory in horiz_interp for the *fh and *inc files?
horiz_interp/horiz_interp.F90
Outdated
end function is_lat_lon | ||
|
||
!##################################################################### | ||
#undef FMS_HI_KIND |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should be consistent with mpp and have all the #defs and #undefs in a *.inc file. Perhaps separate *inc files for r4 and r8
horiz_interp/horiz_interp.F90
Outdated
|
||
!##################################################################### | ||
#undef FMS_HI_KIND | ||
#define FMS_HI_KIND 4 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should use r4_kind instead of 4
|
||
end subroutine horiz_interp_bicubic_del | ||
|
||
|
||
#undef FMS_HI_KIND |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing underscores for the macros
diag_manager/diag_manager.F90
Outdated
@@ -1473,6 +1473,7 @@ LOGICAL FUNCTION send_data_3d(diag_field_id, field, time, is_in, js_in, ks_in, & | |||
ie_in=ie_in, je_in=je_in, ke_in=ke_in, weight=weight, err_msg=err_msg) | |||
endif | |||
END FUNCTION send_data_3d | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
extra line in diag_manager
@@ -102,650 +136,37 @@ subroutine horiz_interp_bicubic_init | |||
if(module_is_initialized) return | |||
call write_version_number("HORIZ_INTERP_BICUBIC_MOD", version) | |||
module_is_initialized = .true. | |||
tpi = 2.0*PI | |||
tpi = real(2.0*PI, R8_KIND) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just in case .... real(2.0_r8_kind*PI, r8_kind) (pi is already r8)
end interface | ||
|
||
!> @addtogroup horiz_interp_bilinear_mod | ||
!> @{ | ||
|
||
real, parameter :: epsln=1.e-10 | ||
real(r8_kind), parameter :: epsln=1.d-10 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1.e-10_r8_kind
integer, parameter :: num_nbrs_default = 4 | ||
real, parameter :: large=1.e20 | ||
real, parameter :: epsln=1.e-10 | ||
real(R8_KIND), parameter :: large=1.d20 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
d's
real, parameter :: large=1.e20 | ||
real, parameter :: epsln=1.e-10 | ||
real(R8_KIND), parameter :: large=1.d20 | ||
real(R8_KIND), parameter :: epsln=1.d-10 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
d here too
enddo | ||
enddo | ||
|
||
! --- area of output grid boxes --- | ||
|
||
do n = 1, nlat_out | ||
do m = 1, nlon_out | ||
Interp%area_dst(m,n) = dlon_out(m) * dsph_out(n) | ||
Interp%HI_KIND_TYPE_%area_dst(m,n) = dlon_out(m) * dsph_out(n) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
math here too
if(dot < -1.) dot = -1. | ||
spherical_distance = acos(dot) | ||
if(dot > 1.0_kindl) dot = 1.0_kindl | ||
if(dot < real(-1.d0, FMS_HI_KIND_)) dot = -1.0_kindl |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for consistency, 1.0_kindl
do while (continue_search .and. step_size > 0) | ||
do while (step <= map_src_size .and. continue_search) | ||
! count land points as nearest neighbors | ||
d = spherical_distance(theta_dst(i,j),phi_dst(i,j),theta_src(step),phi_src(step)) | ||
d = HORIZ_INTERP_SPHERICAL_DISTANCE_(theta_dst(i,j),phi_dst(i,j),theta_src(step),phi_src(step)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these got changed to macros, there are several more in this subroutine
2*0.0_kindl, -1.0_kindl, 1.0_kindl, 6*0.0_kindl, -1.0_kindl, 1.0_kindl, 2*0.0_kindl, 2.0_kindl, & | ||
-2.0_kindl, 2*0.0_kindl, -1.0_kindl, 1.0_kindl/ | ||
|
||
|
||
|
||
d1d2=d1*d2 | ||
do i=1,4 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
line 493, 0.0_kindl
real :: tavr | ||
integer :: ipass = 0 | ||
integer, parameter :: kindl = FMS_HI_KIND_ | ||
real(FMS_HI_KIND_), parameter :: blank = real(-1.d30, FMS_HI_KIND_) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for consistency, 1.e30_lkind
@mlee03 this is updated now, anything I didn't comment on should be fixed. |
real(HI_TEST_KIND_), allocatable, dimension(:,:) :: lat_out_2D, lon_out_2D | ||
real(HI_TEST_KIND_), allocatable, dimension(:,:,:) :: wghts | ||
!! array sizes and number of lat/lon per index | ||
integer :: dlon_src, dlat_src, dlon_dst, dlat_dst |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be real
real(HI_TEST_KIND_), parameter :: SMALL = 1.0e-10_lkind | ||
|
||
! set up longitude and latitude of source/destination grid. | ||
dlon_src = (lon_src_end-lon_src_beg)/ni_src |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
real(ni_src,HI_TEST_KIND_) and below too
|
||
allocate(lon_in_1D(ni_src+1), lat_in_1D(nj_src+1)) | ||
do i = 1, ni_src+1 | ||
lon_in_1D(i) = lon_src_beg + (i-1)*dlon_src |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
real(i-1, Hi_TEST_KIND_)
…re, and fms_mod (#1239) * feat: mixed precision axis_utils2 (#1104) * feat: mixed precision fms_mod (#1147) * feat: horiz interp mixed precision (#1067) * mixed precision sat_vapor_pressure (#1095) * feat: add mixed precision axis_utils unit tests (#1172) * fix: move type definitions to before first usage to fix nvhpc bug (#1187) * fix: change allocatable type for intel errors (#1221) Co-authored-by: Caitlyn McAllister <[email protected]> Co-authored-by: Jesse Lentz <[email protected]> Co-authored-by: MiKyung Lee <[email protected]>
…re, and fms_mod (#1239) (#1258) * feat: mixed precision axis_utils2 (#1104) * feat: mixed precision fms_mod (#1147) * feat: horiz interp mixed precision (#1067) * mixed precision sat_vapor_pressure (#1095) * feat: add mixed precision axis_utils unit tests (#1172) * fix: move type definitions to before first usage to fix nvhpc bug (#1187) * fix: change allocatable type for intel errors (#1221) Co-authored-by: Caitlyn McAllister <[email protected]> Co-authored-by: Jesse Lentz <[email protected]> Co-authored-by: MiKyung Lee <[email protected]>
Description
updates horiz_interp for mixed precision and adds some derived types for both size reals
adds in explicit r4/r8 tests
How Has This Been Tested?
intel and gnu on amd
Checklist:
make distcheck
passes