From 5d9859d6ef8be7a7d8e0c0523a1594a7b2aaf95b Mon Sep 17 00:00:00 2001 From: David A Minton Date: Fri, 22 Oct 2021 03:00:30 -0400 Subject: [PATCH] Added timing instrumentation to encounter checks --- src/encounter/encounter_check.f90 | 48 +++++++++++++++++++++++++++++-- 1 file changed, 46 insertions(+), 2 deletions(-) diff --git a/src/encounter/encounter_check.f90 b/src/encounter/encounter_check.f90 index c64dbd68a..f32cd1db7 100644 --- a/src/encounter/encounter_check.f90 +++ b/src/encounter/encounter_check.f90 @@ -377,6 +377,8 @@ subroutine encounter_check_all_sort_and_sweep_plpl(npl, x, v, renc, dt, lvdotr, npl_last = npl end if + call timer%reset() + call timer%start() !$omp parallel do default(private) schedule(static) & !$omp shared(x, v, renc, boundingbox) & !$omp firstprivate(dt, npl, n) @@ -392,17 +394,31 @@ subroutine encounter_check_all_sort_and_sweep_plpl(npl, x, v, renc, dt, lvdotr, x(dim,1:npl) + renc(1:npl) + vshift_max(1:npl) * v(dim,1:npl) * dt]) end do !$omp end parallel do + call timer%stop() + write(*,*) "plpl sort : ",timer%count_stop_step - timer%count_start_step + call timer%reset() + call timer%start() call boundingbox%sweep(npl, nenc, index1, index2) + call timer%stop() + write(*,*) "plpl sweep : ",timer%count_stop_step - timer%count_start_step if (nenc > 0) then ! Now that we have identified potential pairs, use the narrow-phase process to get the final values allocate(lencounter(nenc)) allocate(lvdotr(nenc)) + call timer%reset() + call timer%start() call encounter_check_all(nenc, index1, index2, x, v, x, v, renc, renc, dt, lencounter, lvdotr) + call timer%stop() + write(*,*) "plpl check : ",timer%count_stop_step - timer%count_start_step + call timer%reset() + call timer%start() call encounter_check_reduce_broadphase(npl, nenc, index1, index2, lencounter, lvdotr) + call timer%stop() + write(*,*) "plpl reduce: ",timer%count_stop_step - timer%count_start_step deallocate(lencounter) end if @@ -447,9 +463,7 @@ subroutine encounter_check_all_sort_and_sweep_plplm(nplm, nplt, xplm, vplm, xplt ntot = nplm + nplt n = 2 * ntot if (ntot /= ntot_last) then - call boundingbox%setup(ntot, ntot_last) - ntot_last = ntot end if @@ -479,8 +493,14 @@ subroutine encounter_check_all_sort_and_sweep_plplm(nplm, nplt, xplm, vplm, xplt xplt(dim,1:nplt) + renct(1:nplt) + vpltshift_max(1:nplt) * vplt(dim,1:nplt) * dt]) end do !$omp end parallel do + call timer%stop() + write(*,*) "plplm sort : ",timer%count_stop_step - timer%count_start_step + call timer%reset() + call timer%start() call boundingbox%sweep(nplm, nplt, nenc, index1, index2) + call timer%stop() + write(*,*) "plplm sweep : ",timer%count_stop_step - timer%count_start_step if (nenc > 0) then ! Shift tiny body indices back into the range of the input position and velocity arrays @@ -490,12 +510,20 @@ subroutine encounter_check_all_sort_and_sweep_plplm(nplm, nplt, xplm, vplm, xplt allocate(lencounter(nenc)) allocate(lvdotr(nenc)) + call timer%reset() + call timer%start() call encounter_check_all(nenc, index1, index2, xplm, vplm, xplt, vplt, rencm, renct, dt, lencounter, lvdotr) + call timer%stop() + write(*,*) "plplm check : ",timer%count_stop_step - timer%count_start_step ! Shift the tiny body indices back to their natural range index2(:) = index2(:) + nplm + call timer%reset() + call timer%start() call encounter_check_reduce_broadphase(ntot, nenc, index1, index2, lencounter, lvdotr) + call timer%stop() + write(*,*) "plplm reduce: ",timer%count_stop_step - timer%count_start_step end if return end subroutine encounter_check_all_sort_and_sweep_plplm @@ -656,6 +684,8 @@ subroutine encounter_check_all_triangular_plpl(npl, x, v, renc, dt, lvdotr, inde call util_index_array(ind_arr, npl) + call timer%reset() + call timer%start() !$omp parallel do default(private) schedule(static)& !$omp shared(x, v, renc, lenc, ind_arr) & !$omp firstprivate(npl, dt) @@ -667,8 +697,14 @@ subroutine encounter_check_all_triangular_plpl(npl, x, v, renc, dt, lvdotr, inde renc(i), renc(:), dt, ind_arr(:), lenc(i)) end do !$omp end parallel do + call timer%stop() + write(*,*) "plpl triang: ",timer%count_stop_step - timer%count_start_step + call timer%reset() + call timer%start() call encounter_check_collapse_ragged_list(lenc, npl, nenc, index1, index2, lvdotr) + call timer%stop() + write(*,*) "plpl tricol: ",timer%count_stop_step - timer%count_start_step return end subroutine encounter_check_all_triangular_plpl @@ -704,6 +740,8 @@ subroutine encounter_check_all_triangular_plplm(nplm, nplt, xplm, vplm, xplt, vp call util_index_array(ind_arr, nplt) + call timer%reset() + call timer%start() !$omp parallel do default(private) schedule(static)& !$omp shared(xplm, vplm, xplt, vplt, rencm, renct, lenc, ind_arr) & !$omp firstprivate(nplm, nplt, dt) @@ -715,8 +753,14 @@ subroutine encounter_check_all_triangular_plplm(nplm, nplt, xplm, vplm, xplt, vp rencm(i), renct(:), dt, ind_arr(:), lenc(i)) end do !$omp end parallel do + call timer%stop() + write(*,*) "plplm triang: ",timer%count_stop_step - timer%count_start_step + call timer%reset() + call timer%start() call encounter_check_collapse_ragged_list(lenc, nplm, nenc, index1, index2, lvdotr) + call timer%stop() + write(*,*) "plplm tricol: ",timer%count_stop_step - timer%count_start_step return end subroutine encounter_check_all_triangular_plplm