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

dmUpdate: fix nvhpc compile error #1473

Merged
merged 7 commits into from
Mar 19, 2024
Merged
Show file tree
Hide file tree
Changes from 5 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
5 changes: 4 additions & 1 deletion diag_manager/diag_data.F90
Original file line number Diff line number Diff line change
Expand Up @@ -585,7 +585,10 @@ subroutine fms_add_attribute(this, att_name, att_value)
this%att_value = att_value
type is (character(len=*))
allocate(character(len=len(att_value)) :: this%att_value(natt))
this%att_value = att_value
select type(aval => this%att_value)
type is (character(len=*))
aval = att_value
end select
end select
end subroutine fms_add_attribute

Expand Down
21 changes: 16 additions & 5 deletions exchange/xgrid.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1514,7 +1514,7 @@ end subroutine get_ocean_model_area_elements
!> @brief Sets up exchange grid connectivity using grid specification file and
!! processor domain decomposition.
subroutine setup_xmap(xmap, grid_ids, grid_domains, grid_file, atm_grid, lnd_ug_domain)
type (xmap_type), intent(inout) :: xmap
type(xmap_type), intent(inout) :: xmap
character(len=3), dimension(:), intent(in ) :: grid_ids
type(Domain2d), dimension(:), intent(in ) :: grid_domains
character(len=*), intent(in ) :: grid_file
Expand All @@ -1524,7 +1524,8 @@ subroutine setup_xmap(xmap, grid_ids, grid_domains, grid_file, atm_grid, lnd_ug_
integer :: g, p, i
integer :: nxgrid_file, i1, i2, i3, tile1, tile2, j
integer :: nxc, nyc, out_unit
type (grid_type), pointer, save :: grid =>NULL(), grid1 =>NULL()
type(grid_type), pointer :: grid => NULL()!< pointer to loop through grid_type's in list
type(grid_type), pointer, save :: grid1 => NULL() !< saved pointer to the first grid in the list
real(r8_kind), dimension(3) :: xxx
real(r8_kind), dimension(:,:), allocatable :: check_data
real(r8_kind), dimension(:,:,:), allocatable :: check_data_3D
Expand All @@ -1541,6 +1542,7 @@ subroutine setup_xmap(xmap, grid_ids, grid_domains, grid_file, atm_grid, lnd_ug_
integer :: lnd_ug_id, l
integer, allocatable :: grid_index(:)
type(FmsNetcdfFile_t) :: gridfileobj, mosaicfileobj, fileobj
type(xmap_type), allocatable, save :: xmap_tmp

call mpp_clock_begin(id_setup_xmap)

Expand Down Expand Up @@ -1593,9 +1595,18 @@ subroutine setup_xmap(xmap, grid_ids, grid_domains, grid_file, atm_grid, lnd_ug_
endif

call mpp_clock_begin(id_load_xgrid)
do g=1,size(grid_ids(:))
grid => xmap%grids(g)
if (g==1) grid1 => xmap%grids(g)

! nvhpc compiler workaround
! saves passed in xmap as an allocatable
! this lets us use a normal assignment instead of a pointer assignment in the loop to avoid a compiler error
Copy link
Member

Choose a reason for hiding this comment

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

Do we need to report this to nvidia?

Copy link
Contributor

Choose a reason for hiding this comment

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

Let's make sure we have tested using the very latest nvhpc 24.3 before filing a bug with NVidia.

Copy link
Contributor Author

@rem1776 rem1776 Mar 19, 2024

Choose a reason for hiding this comment

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

The xgrid compilation error was pretty hard to reproduce, Niki first saw this using 22.3 and I've only been able to get the error using his xml to compile. I don't seem to get the error when i compile with autotools, and didn't even get it when i tried compiling one of my xml's with nvidia.

Copy link
Member

Choose a reason for hiding this comment

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

We can get the makefile and everything else needed and send it to them

xmap_tmp = xmap

grid1 => xmap%grids(1)

do g=1, size(grid_ids(:))

grid = xmap_tmp%grids(g)

grid%id = grid_ids (g)
grid%domain = grid_domains(g)
grid%on_this_pe = mpp_domain_is_initialized(grid_domains(g))
Expand Down
Loading