Skip to content

Commit

Permalink
Merge pull request #216 from lnw/master
Browse files Browse the repository at this point in the history
fix estimated time
  • Loading branch information
bast authored Mar 19, 2019
2 parents 554d8e6 + ef3797c commit 681a0bc
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 25 deletions.
14 changes: 9 additions & 5 deletions src/fgimic/jfield.f90
Original file line number Diff line number Diff line change
Expand Up @@ -198,13 +198,17 @@ subroutine jfield_eta(this, mol, xdens, fac)
real(DP), dimension(3) :: bar=(/D1,D1,D1/)
real(DP), dimension(3) :: foobar
real(DP), parameter :: SC=0.25d0
real(4) :: hours_per_sec = 1.0/3600.0
real(4) :: days_per_hour = 1.0/24.0
real(4) :: hours_per_day = 24.0
integer :: no_tests = 100

call get_grid_size(this%grid, p1, p2, p3)

call new_jtensor(jt, mol, xdens)
call etime(times, tim1)
tim1=times(1)
do i=1,100
do i=1,no_tests
call jtensor(jt, (/i*SC, i*SC, i*SC/), foo, spin_a)
foobar=matmul(bar,reshape(foo,(/3,3/)))
end do
Expand All @@ -215,10 +219,10 @@ subroutine jfield_eta(this, mol, xdens, fac)
delta_t=tim2-tim1
if ( present(fac) ) delta_t=delta_t*fac
write(str_g, '(a,f11.2,a,a,f6.1,a)') 'Estimated CPU time for single core &
&calculation: ', delta_t*real(p1*p2*p3)/100.d0, ' sec', &
' (', delta_t*real(p1*p2*p3)/3600.d0, ' h )'
if ( delta_t*real(p1*p2*p3)/3600.d0 .gt. 48 ) then
write(str_g, '(a,f4.1,a)') '(', delta_t*real(p1*p2*p3)/3600.d0/24, ' days )'
calculation: ', delta_t*real(p1*p2*p3)/real(no_tests), ' sec', &
' (', delta_t*real(p1*p2*p3)/real(no_tests) * hours_per_sec, ' h )'
if ( delta_t*real(p1*p2*p3)/real(no_tests) * hours_per_sec .gt. 2*hours_per_day ) then ! will take more than two days?
write(str_g, '(a,f4.1,a)') '(', delta_t*real(p1*p2*p3)/real(no_tests) * hours_per_sec*days_per_hour, ' days )'
end if
call msg_info(str_g)
call nl
Expand Down
42 changes: 22 additions & 20 deletions src/libgimic/timer.f90
Original file line number Diff line number Diff line change
Expand Up @@ -14,27 +14,28 @@ subroutine stockas_klocka()
real(4) :: etime
character(BUFLEN) :: fdate

real(4) :: secs_per_hour = 3600.0
real(4) :: hours_per_sec = 1.0/3600.0
real(4) :: days_per_hour = 1.0/24.0
real(4) :: hours_per_day = 24.0

delta_t=etime(times)
call msg_out(repeat('-', 70))
write(str_g, '(a,f9.2,a,a,f6.1,a)') ' wall time:', delta_t, 'sec', &
' (', delta_t/secs_per_hour, ' h )'
if ( delta_t/secs_per_hour .gt. 2*hours_per_day ) then
write(str_g, '(a,f4.1,a)') '(', delta_t/secs_per_hour/hours_per_day, ' days )'
' (', delta_t*hours_per_sec, ' h )'
if ( delta_t*hours_per_sec .gt. 2*hours_per_day ) then
write(str_g, '(a,f4.1,a)') '(', delta_t*hours_per_sec*days_per_hour, ' days )'
end if
call msg_out(str_g)
write(str_g, '(a,f9.2,a,a,f6.1,a)') ' user:', times(1), 'sec', &
' (', times(1)/secs_per_hour, ' h )'
if ( times(1)/secs_per_hour .gt. 2*hours_per_day ) then
write(str_g, '(a,f4.1,a)') '(', times(1)/secs_per_hour/hours_per_day, ' days )'
' (', times(1)*hours_per_sec, ' h )'
if ( times(1)*hours_per_sec .gt. 2*hours_per_day ) then
write(str_g, '(a,f4.1,a)') '(', times(1)*hours_per_sec*days_per_hour, ' days )'
end if
call msg_out(str_g)
write(str_g, '(a,f9.2,a,a,f6.1,a)') ' sys:', times(2), 'sec', &
' (', times(2)/secs_per_hour, ' h )'
if ( times(2)/secs_per_hour .gt. 2*hours_per_day ) then
write(str_g, '(a,f4.1,a)') '(', times(2)/secs_per_hour/hours_per_day, ' days )'
' (', times(2)*hours_per_sec, ' h )'
if ( times(2)*hours_per_sec .gt. 2*hours_per_day ) then
write(str_g, '(a,f4.1,a)') '(', times(2)*hours_per_sec*days_per_hour, ' days )'
end if
call msg_out(str_g)
call msg_out(repeat('-', 70))
Expand All @@ -45,28 +46,29 @@ subroutine swatch(foo)
integer(I4), intent(in) :: foo

real(4) :: dtime
real(4) :: secs_per_hour = 3600.0
real(4) :: hours_per_sec = 1.0/3600.0
real(4) :: days_per_hour = 1.0/24.0
real(4) :: hours_per_day = 24.0

delta_t=dtime(times)
if (foo > 0) then
call msg_out(repeat('-', 70))
write(str_g, '(a,f9.2,a,a,f6.1,a)') ' wall time:', delta_t, 'sec', &
' (', delta_t/secs_per_hour, ' h )'
if ( delta_t/secs_per_hour .gt. 2*hours_per_day ) then
write(str_g, '(a,f4.1,a)') '(', delta_t/secs_per_hour/hours_per_day, ' days )'
' (', delta_t*hours_per_sec, ' h )'
if ( delta_t*hours_per_sec .gt. 2*hours_per_day ) then
write(str_g, '(a,f4.1,a)') '(', delta_t*hours_per_sec*days_per_hour, ' days )'
end if
call msg_out(str_g)
write(str_g, '(a,f9.2,a,a,f6.1,a)') ' user:', times(1), 'sec', &
' (', times(1)/secs_per_hour, ' h )'
if ( times(1)/secs_per_hour .gt. 2*hours_per_day ) then
write(str_g, '(a,f4.1,a)') '(', times(1)/secs_per_hour/hours_per_day, ' days )'
' (', times(1)*hours_per_sec, ' h )'
if ( times(1)*hours_per_sec .gt. 2*hours_per_day ) then
write(str_g, '(a,f4.1,a)') '(', times(1)*hours_per_sec*days_per_hour, ' days )'
end if
call msg_out(str_g)
write(str_g, '(a,f9.2,a,a,f6.1,a)') ' sys:', times(2), 'sec', &
' (', times(2)/secs_per_hour, ' h )'
if ( times(2)/secs_per_hour .gt. 2*hours_per_day ) then
write(str_g, '(a,f4.1,a)') '(', times(2)/secs_per_hour/hours_per_day, ' days )'
' (', times(2)*hours_per_sec, ' h )'
if ( times(2)*hours_per_sec .gt. 2*hours_per_day ) then
write(str_g, '(a,f4.1,a)') '(', times(2)*hours_per_sec*days_per_hour, ' days )'
end if
call msg_out(str_g)
call msg_out(repeat('-', 70))
Expand Down

0 comments on commit 681a0bc

Please sign in to comment.