Specify minimum buffer size (per process) for communication
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(mg_t), | intent(inout) | :: | mg | |||
| integer, | intent(out) | :: | n_send(0:mg%n_cpu-1) | |||
| integer, | intent(out) | :: | n_recv(0:mg%n_cpu-1) | |||
| integer, | intent(out) | :: | dsize |
subroutine mg_ghost_cell_buffer_size(mg, n_send, n_recv, dsize) type(mg_t), intent(inout) :: mg integer, intent(out) :: n_send(0:mg%n_cpu-1) integer, intent(out) :: n_recv(0:mg%n_cpu-1) integer, intent(out) :: dsize integer :: i, id, lvl, nc allocate(mg%comm_ghostcell%n_send(0:mg%n_cpu-1,& mg%first_normal_lvl:mg%highest_lvl)) allocate(mg%comm_ghostcell%n_recv(0:mg%n_cpu-1,& mg%first_normal_lvl:mg%highest_lvl)) dsize = mg%box_size**(1-1) do lvl = mg%first_normal_lvl, mg%highest_lvl nc = mg%box_size_lvl(lvl) mg%buf(:)%i_send = 0 mg%buf(:)%i_recv = 0 mg%buf(:)%i_ix = 0 do i = 1, size(mg%lvls(lvl)%my_ids) id = mg%lvls(lvl)%my_ids(i) call buffer_ghost_cells(mg, id, nc, 1, dry_run=.true.) end do if (lvl > 1) then do i = 1, size(mg%lvls(lvl-1)%my_ref_bnds) id = mg%lvls(lvl-1)%my_ref_bnds(i) call buffer_refinement_boundaries(mg, id, nc, 1, dry_run=.true.) end do end if ! Set ghost cells to received data mg%buf(:)%i_recv = 0 do i = 1, size(mg%lvls(lvl)%my_ids) id = mg%lvls(lvl)%my_ids(i) call set_ghost_cells(mg, id, nc, 1, dry_run=.true.) end do mg%comm_ghostcell%n_send(:, lvl) = mg%buf(:)%i_send/dsize mg%comm_ghostcell%n_recv(:, lvl) = mg%buf(:)%i_recv/dsize end do n_send = maxval(mg%comm_ghostcell%n_send, dim=2) n_recv = maxval(mg%comm_ghostcell%n_recv, dim=2) end subroutine mg_ghost_cell_buffer_size