Pre-allocate halo buffers for all 4 fields
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(halo_async_t), | intent(out) | :: | ha | |||
| type(decomp_t), | intent(in) | :: | decomp | |||
| integer, | intent(in) | :: | nghost | |||
| integer, | intent(in) | :: | nx_local | |||
| integer, | intent(in) | :: | ny_local |
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| integer, | private | :: | nx_total | ||||
| integer, | private | :: | ny_total |
subroutine halo_async_init(ha, decomp, nghost, nx_local, ny_local) !! Pre-allocate halo buffers for all 4 fields type(halo_async_t), intent(out) :: ha type(decomp_t), intent(in) :: decomp integer, intent(in) :: nghost, nx_local, ny_local integer :: nx_total, ny_total ha%decomp = decomp ha%nghost = nghost ha%nx_local = nx_local ha%ny_local = ny_local nx_total = nx_local + 2*nghost ny_total = ny_local + 2*nghost ha%nx_total = nx_total ha%ny_total = ny_total ! Per-field strip sizes, multiplied by NFIELDS for combined buffers ha%strip_ew = NFIELDS*nghost*ny_total ha%strip_sn = NFIELDS*nx_total*nghost if (.not. decomp%has_west) then ha%rank_west = decomp_rank_from_coords(decomp%px, decomp%rx - 1, decomp%ry) allocate (ha_buf_send_west(ha%strip_ew), ha_buf_recv_west(ha%strip_ew)) !$acc enter data create( ha_buf_send_west, ha_buf_recv_west) end if if (.not. decomp%has_east) then ha%rank_east = decomp_rank_from_coords(decomp%px, decomp%rx + 1, decomp%ry) allocate (ha_buf_send_east(ha%strip_ew), ha_buf_recv_east(ha%strip_ew)) !$acc enter data create( ha_buf_send_east, ha_buf_recv_east) end if if (.not. decomp%has_south) then ha%rank_south = decomp_rank_from_coords(decomp%px, decomp%rx, decomp%ry - 1) allocate (ha_buf_send_south(ha%strip_sn), ha_buf_recv_south(ha%strip_sn)) !$acc enter data create( ha_buf_send_south, ha_buf_recv_south) end if if (.not. decomp%has_north) then ha%rank_north = decomp_rank_from_coords(decomp%px, decomp%rx, decomp%ry + 1) allocate (ha_buf_send_north(ha%strip_sn), ha_buf_recv_north(ha%strip_sn)) !$acc enter data create( ha_buf_send_north, ha_buf_recv_north) end if ha%initialised = .true. end subroutine halo_async_init