From 4f2d49969244627f0675a5f32cd91e35546bd4ed Mon Sep 17 00:00:00 2001 From: David A Minton Date: Mon, 24 Apr 2023 17:02:06 -0400 Subject: [PATCH] Improved messaging of distribute operation --- src/swiftest/swiftest_coarray.f90 | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/swiftest/swiftest_coarray.f90 b/src/swiftest/swiftest_coarray.f90 index 84144ae77..6c5ccc389 100644 --- a/src/swiftest/swiftest_coarray.f90 +++ b/src/swiftest/swiftest_coarray.f90 @@ -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 @@ -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