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

Commit

Permalink
Added timing instrumentation to encounter checks
Browse files Browse the repository at this point in the history
  • Loading branch information
daminton committed Oct 22, 2021
1 parent 625dec6 commit 5d9859d
Showing 1 changed file with 46 additions and 2 deletions.
48 changes: 46 additions & 2 deletions src/encounter/encounter_check.f90
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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

Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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)
Expand All @@ -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
Expand Down Expand Up @@ -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)
Expand All @@ -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
Expand Down

0 comments on commit 5d9859d

Please sign in to comment.