Skip to content

Commit

Permalink
Update/improve debug_blocks output, see CICE-Consortium#718.
Browse files Browse the repository at this point in the history
  • Loading branch information
apcraig committed Aug 8, 2022
1 parent 5a1701c commit 58e3b8f
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 14 deletions.
5 changes: 3 additions & 2 deletions cicecore/cicedynB/infrastructure/ice_blocks.F90
Original file line number Diff line number Diff line change
Expand Up @@ -314,9 +314,10 @@ subroutine create_blocks(nx_global, ny_global, ew_boundary_type, &

if (debug_blocks) then
if (my_task == master_task) then
write(nu_diag,*) 'block i,j locations'
write(nu_diag,*) ' '
write(nu_diag,'(2a)') subname,' block ID, iblock, jblock Locations:'
do n = 1, nblocks_tot
write(nu_diag,*) 'block id, iblock, jblock, tripole:', &
write(nu_diag,'(2a,3i8,l4)') subname,' global block ID, iblock, jblock, tripole:', &
all_blocks(n)%block_id, &
all_blocks(n)%iblock, &
all_blocks(n)%jblock, &
Expand Down
45 changes: 41 additions & 4 deletions cicecore/cicedynB/infrastructure/ice_domain.F90
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ module ice_domain
use ice_kinds_mod
use ice_constants, only: shlat, nhlat
use ice_communicate, only: my_task, master_task, get_num_procs, &
add_mpi_barriers
add_mpi_barriers, ice_barrier
use ice_broadcast, only: broadcast_scalar, broadcast_array
use ice_blocks, only: block, get_block, create_blocks, nghost, &
nblocks_x, nblocks_y, nblocks_tot, nx_block, ny_block, debug_blocks
use ice_distribution, only: distrb
use ice_boundary, only: ice_halo
use ice_exit, only: abort_ice
use ice_fileunits, only: nu_nml, nml_filename, nu_diag, &
get_fileunit, release_fileunit
get_fileunit, release_fileunit, flush_fileunit
use icepack_intfc, only: icepack_warnings_flush, icepack_warnings_aborted
use icepack_intfc, only: icepack_query_parameters

Expand Down Expand Up @@ -326,6 +326,7 @@ subroutine init_domain_distribution(KMTG,ULATG,grid_ice)
ig,jg ,&! global indices
igm1,igp1,jgm1,jgp1,&! global indices
ninfo ,&! ice_distributionGet check
np, nlb, m ,&! debug blocks temporaries
work_unit ,&! size of quantized work unit
#ifdef USE_NETCDF
fid ,&! file id
Expand Down Expand Up @@ -596,8 +597,41 @@ subroutine init_domain_distribution(KMTG,ULATG,grid_ice)

call create_local_block_ids(blocks_ice, distrb_info)

! write out block distribution
! internal check of icedistributionGet as part of verification process
if (debug_blocks) then

call flush_fileunit(nu_diag)
call ice_barrier()
if (my_task == master_task) then
write(nu_diag,*) ' '
write(nu_diag,'(2a)') subname, ' Blocks by Proc:'
endif
call ice_distributionGet(distrb_info, nprocs=np, numLocalBlocks=nlb)
do m = 1, np
if (m == my_task+1) then
do n=1,nlb
write(nu_diag,'(2a,3i8)') &
subname,' my_task, local block ID, global block ID: ', &
my_task, n, distrb_info%blockGlobalID(n)
enddo
call flush_fileunit(nu_diag)
endif
call ice_barrier()
enddo

if (my_task == master_task) then
write(nu_diag,*) ' '
write(nu_diag,'(2a)') subname, ' Blocks by Global Block ID:'
do m = 1, nblocks_tot
write(nu_diag,'(2a,3i8)') &
subname,' global block id, proc, local block ID: ', &
m, distrb_info%blockLocation(m), distrb_info%blockLocalID(m)
enddo
call flush_fileunit(nu_diag)
endif
call ice_barrier()

call ice_distributionGet(distrb_info, nprocs=ninfo)
if (ninfo /= distrb_info%nprocs) &
call abort_ice(subname//' ice_distributionGet nprocs ERROR', file=__FILE__, line=__LINE__)
Expand Down Expand Up @@ -635,8 +669,11 @@ subroutine init_domain_distribution(KMTG,ULATG,grid_ice)

deallocate(blkinfo)

if (my_task == master_task) &
write(nu_diag,*) subname,' ice_distributionGet checks pass'
if (my_task == master_task) then
write(nu_diag,*) ' '
write(nu_diag,'(2a)') subname,' ice_distributionGet checks pass'
write(nu_diag,*) ' '
endif
endif

if (associated(blocks_ice)) then
Expand Down
8 changes: 0 additions & 8 deletions cicecore/shared/ice_distribution.F90
Original file line number Diff line number Diff line change
Expand Up @@ -180,14 +180,6 @@ subroutine create_local_block_ids(block_ids, distribution)
do n=1,size(distribution%blockLocation)
if (distribution%blockLocation(n) == my_task+1) then
block_ids(distribution%blockLocalID(n)) = n

if (debug_blocks .and. my_task == master_task) then
write(nu_diag,'(2a,3i8)') &
subname,' block id, proc, local_block: ', &
block_ids(distribution%blockLocalID(n)), &
distribution%blockLocation(n), &
distribution%blockLocalID(n)
endif
endif
end do
endif
Expand Down

0 comments on commit 58e3b8f

Please sign in to comment.