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

Fix test failures with ifx due to use of host associated arrays #1606

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
41 changes: 21 additions & 20 deletions test_fms/diag_integral/test_diag_integral.F90
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ program test_diag_integral
real(TEST_DI_KIND_) :: weight(nxy,nxy,nxy) !> weights required to test sum_field_wght_3d
real(TEST_DI_KIND_) :: immadeuph(nxy,nxy) !> array to test sum_field_2d_hemi

real(r8_kind) :: lat(nxyp,nxyp), lon(nxyp,nxyp)
real(r8_kind) :: area(nxy,nxy)
real(r8_kind) :: lat(nxyp,nxyp), lon(nxyp,nxyp)
real(r8_kind) :: area(nxy,nxy)
type(time_type) :: Time_init, Time

!testing and generating answers
Expand Down Expand Up @@ -96,6 +96,24 @@ program test_diag_integral
call test_sum_diag_integral_field !< compare read in values to the expected values.

contains
!-------------------------------------
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this test be updated like the other one to pass in the variables to each routine?

The only real change I'm seeing in this test is moving the intialize_arrays subroutine up in the file, which shouldn't change anything technically, but maybe ifx thinks otherwise.

!-------------------------------------
subroutine initialize_arrays

!> made up numbers

implicit none

lon=1.0_lkind
lat=1.0_lkind
area=1.0_lkind
immadeup2=1.0_lkind
immadeup3=1.0_lkind
immadeupw=1.0_lkind
immadeuph=1.0_lkind
weight=1.0_lkind

end subroutine initialize_arrays
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not get rid of initialize_arrays and initialize these in the declaration statements at the top of the program instead? As a bonus, that would give them an implicit save attribute.

!-------------------------------------
!-------------------------------------
subroutine test_diag_integral_init
Expand Down Expand Up @@ -177,6 +195,7 @@ subroutine read_diag_integral_file

character(*), parameter :: di_file='diag_integral.out'
integer :: iunit

character(100) :: cline1, cline2, cline3, cline4, cline5, clin6

!> read in computed values
Expand All @@ -203,22 +222,4 @@ subroutine check_answers(answer, outresult, whoami)
end subroutine check_answers
!-------------------------------------
!-------------------------------------
subroutine initialize_arrays

!> made up numbers

implicit none

lon=1.0_lkind
lat=1.0_lkind
area=1.0_lkind
immadeup2=1.0_lkind
immadeup3=1.0_lkind
immadeupw=1.0_lkind
immadeuph=1.0_lkind
weight=1.0_lkind

end subroutine initialize_arrays
!-------------------------------------
!-------------------------------------
end program test_diag_integral
44 changes: 28 additions & 16 deletions test_fms/topography/test_topography.F90
Original file line number Diff line number Diff line change
Expand Up @@ -144,20 +144,22 @@ program test_top
end if
!-------------------------------------------------------------------------------------------------------------!

call test_topog_mean ; call test_topog_stdev
call test_get_ocean_frac ; call test_get_ocean_mask
call test_get_water_frac ; call test_get_water_mask
call test_topog_mean(lat2d, lon2d, lat1d, lon1d) ; call test_topog_stdev(lat2d, lon2d, lat1d, lon1d)
call test_get_ocean_frac(lat2d, lon2d, lat1d, lon1d) ; call test_get_ocean_mask(lat2d, lon2d, lat1d, lon1d)
call test_get_water_frac(lat2d, lon2d, lat1d, lon1d) ; call test_get_water_mask(lat2d, lon2d, lat1d, lon1d)

call fms_end

contains

subroutine test_topog_mean()
subroutine test_topog_mean(lat2d, lon2d, lat1d, lon1d)
!! The naming convention of zmean2d/1d in this routine does not relate to their
!! dimensions but correlates with what dimensions of lat and lon they are being
!! tested with. In this case, the sizes of both zmean2d and zmean1d are both the
!! same size but have to be these specific dimensions per the topography_mod code
implicit none
real(kind=TEST_TOP_KIND_), dimension(2,2), intent(in) :: lat2d, lon2d
real(kind=TEST_TOP_KIND_), dimension(2), intent(in) :: lat1d, lon1d
real(kind=TEST_TOP_KIND_), dimension(size(lon2d,1)-1,size(lat2d,2)-1) :: zmean2d
real(kind=TEST_TOP_KIND_), dimension(size(lon1d)-1,size(lat1d)-1) :: zmean1d
logical :: get_mean_answer
Expand All @@ -182,13 +184,15 @@ subroutine test_topog_mean()

end subroutine test_topog_mean

subroutine test_topog_stdev
subroutine test_topog_stdev(lat2d, lon2d, lat1d, lon1d)

!! The naming convention of stdev2d/1d in this routine does not relate to their
!! dimensions but correlates with what dimensions of lat and lon they are being
!! tested with. In this case, the sizes of both stdev2d and stdev1d are both the
!! same size but have to be these specific dimensions per the topography_mod code
implicit none
real(kind=TEST_TOP_KIND_), dimension(2,2), intent(in) :: lat2d, lon2d
real(kind=TEST_TOP_KIND_), dimension(2), intent(in) :: lat1d, lon1d
real(kind=TEST_TOP_KIND_), dimension(size(lon2d,1)-1,size(lat2d,2)-1) :: stdev2d
real(kind=TEST_TOP_KIND_), dimension(size(lon1d)-1,size(lat1d)-1) :: stdev1d
logical :: get_stdev_answer
Expand All @@ -213,13 +217,15 @@ subroutine test_topog_stdev

end subroutine test_topog_stdev

subroutine test_get_ocean_frac
subroutine test_get_ocean_frac(lat2d, lon2d, lat1d, lon1d)

!! The naming convention of ocean_frac2d/1d in this routine does not relate to their
!! dimensions but correlates with what dimensions of lat and lon they are being
!! tested with. In this case, the sizes of both ocean_frac2d and ocean_frac1d are both the
!! same size but have to be these specific dimensions per the topography_mod code
implicit none
real(kind=TEST_TOP_KIND_), dimension(2,2), intent(in) :: lat2d, lon2d
real(kind=TEST_TOP_KIND_), dimension(2), intent(in) :: lat1d, lon1d
real(kind=TEST_TOP_KIND_), dimension(size(lon2d,1)-1,size(lat2d,2)-1) :: ocean_frac2d
real(kind=TEST_TOP_KIND_), dimension(size(lon1d)-1,size(lat1d)-1) :: ocean_frac1d
logical :: get_ocean_frac_answer
Expand All @@ -243,16 +249,18 @@ subroutine test_get_ocean_frac
! with a larger ocean_frac1d array size
end subroutine test_get_ocean_frac

subroutine test_get_ocean_mask
subroutine test_get_ocean_mask(lat2d, lon2d, lat1d, lon1d)

!! The naming convention of ocean_mask2d/1d in this routine does not relate to their
!! dimensions but correlates with what dimensions of lat and lon they are being
!! tested with. In this case, the sizes of both ocean_mask2d and ocean_mask1d are both the
!! same size but have to be these specific dimensions per the topography_mod code
implicit none
logical, dimension(size(lon2d,1)-1,size(lat2d,2)-1) :: ocean_mask2d
logical, dimension(size(lon1d)-1,size(lat1d)-1) :: ocean_mask1d
logical :: get_ocean_mask_answer
real(kind=TEST_TOP_KIND_), dimension(2,2), intent(in) :: lat2d, lon2d
real(kind=TEST_TOP_KIND_), dimension(2), intent(in) :: lat1d, lon1d
logical, dimension(size(lon2d,1)-1,size(lat2d,2)-1) :: ocean_mask2d
logical, dimension(size(lon1d)-1,size(lat1d)-1) :: ocean_mask1d
logical :: get_ocean_mask_answer

!---------------------------------------- test get_ocean_mask 2d ---------------------------------------------!

Expand All @@ -275,12 +283,14 @@ subroutine test_get_ocean_mask

end subroutine test_get_ocean_mask

subroutine test_get_water_frac
subroutine test_get_water_frac(lat2d, lon2d, lat1d, lon1d)
!! The naming convention of water_frac2d/1d in this routine does not relate to their
!! dimensions but correlates with what dimensions of lat and lon they are being
!! tested with. In this case, the sizes of both water_frac2d and water_frac1d are both the
!! same size but have to be these specific dimensions per the topography_mod code
implicit none
real(kind=TEST_TOP_KIND_), dimension(2,2), intent(in) :: lat2d, lon2d
real(kind=TEST_TOP_KIND_), dimension(2), intent(in) :: lat1d, lon1d
real(kind=TEST_TOP_KIND_), dimension(size(lon2d,1)-1,size(lat2d,2)-1) :: water_frac2d
real(kind=TEST_TOP_KIND_), dimension(size(lon1d)-1,size(lat1d)-1) :: water_frac1d
logical :: get_water_frac_answer
Expand All @@ -305,16 +315,18 @@ subroutine test_get_water_frac

end subroutine test_get_water_frac

subroutine test_get_water_mask
subroutine test_get_water_mask(lat2d, lon2d, lat1d, lon1d)

!! The naming convention of water_mask2d/1d in this routine does not relate to their
!! dimensions but correlates with what dimensions of lat and lon they are being
!! tested with. In this case, the sizes of both water_mask2d and water_mask1d are both the
!! same size but have to be these specific dimensions per the topography_mod code
implicit none
logical, dimension(size(lon2d,1)-1,size(lat2d,2)-1) :: water_mask2d
logical, dimension(size(lon1d)-1,size(lat1d)-1) :: water_mask1d
logical :: get_water_mask_answer
real(kind=TEST_TOP_KIND_), dimension(2,2), intent(in) :: lat2d, lon2d
real(kind=TEST_TOP_KIND_), dimension(2), intent(in) :: lat1d, lon1d
logical, dimension(size(lon2d,1)-1,size(lat2d,2)-1) :: water_mask2d
logical, dimension(size(lon1d)-1,size(lat1d)-1) :: water_mask1d
logical :: get_water_mask_answer

!---------------------------------------- test get_water_mask 2d ---------------------------------------------!

Expand Down Expand Up @@ -352,4 +364,4 @@ end subroutine check_answers



end program test_top
end program test_top
Loading