Skip to content
This repository was archived by the owner on Aug 28, 2024. It is now read-only.

Commit

Permalink
Improved messaging of distribute operation
Browse files Browse the repository at this point in the history
  • Loading branch information
daminton committed Apr 24, 2023
1 parent 9cf4bcb commit 4f2d499
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions src/swiftest/swiftest_coarray.f90
Original file line number Diff line number Diff line change
Expand Up @@ -516,22 +516,25 @@ module subroutine swiftest_coarray_distribute_system(nbody_system, param)
class(swiftest_tp), allocatable :: tp
logical, dimension(:), allocatable :: lspill_list
integer(I4B), codimension[:], allocatable :: ntp
character(len=NAMELEN) :: image_num_char
character(len=NAMELEN) :: image_num_char, ntp_num_char
class(swiftest_tp), allocatable, codimension[:] :: cotp
class(swiftest_tp), allocatable :: tmp

if (.not.param%lcoarray) return
if (this_image() == 1) then
write(image_num_char,*) num_images()
write(param%display_unit,*) " Distributing test particles across " // trim(adjustl(image_num_char)) // " images."
end if

allocate(ntp[*])
ntp = nbody_system%tp%nbody
sync all
ntot = ntp[1]
if (ntot == 0) return


write(image_num_char,*) num_images()

if (this_image() == 1) then
write(ntp_num_char,*) ntot
write(param%display_unit,*) " Distributing " // trim(adjustl(ntp_num_char)) // " test particles across " // trim(adjustl(image_num_char)) // " images."
end if

allocate(lspill_list(ntot))
num_per_image = ceiling(1.0_DP * ntot / num_images())
istart = (this_image() - 1) * num_per_image + 1
Expand All @@ -553,6 +556,9 @@ module subroutine swiftest_coarray_distribute_system(nbody_system, param)
allocate(tmp, mold=nbody_system%tp)
call nbody_system%tp%spill(tmp, lspill_list(:), ldestructive=.true.)

write(ntp_num_char,*) nbody_system%tp%nbody
write(param%display_unit,*) "Image " // trim(adjustl(image_num_char)) // " ntp: " // trim(adjustl(ntp_num_char))

deallocate(tmp, cotp)

return
Expand Down

0 comments on commit 4f2d499

Please sign in to comment.