Deallocate memory and find simulation time.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(controltype), | intent(in) | :: | control | Control parameters |
subroutine destroy_time(control)
!< Deallocate memory and find simulation time.
implicit none
type(controltype), intent(in) :: control
!< Control parameters
real(wp), dimension(:), allocatable :: total_time
!< Total time of executation for each block
integer :: ierr
!< error variable for mpi communication
DebugCall('deallocate_misc')
!simlulation clock data
if(control%process_id==0) write(*, '(A)') '>> TIME <<'
if(control%process_id==0) write(*, '(A)') "Simulation Clock : "//trim(write_time(sim_clock))
call alloc(total_time, 1, control%total_process)
CALL CPU_TIME(t2)
CALL SYSTEM_CLOCK(COUNT=nb_ticks_final)
nb_ticks = nb_ticks_final - nb_ticks_initial
IF (nb_ticks_final < nb_ticks_initial) &
nb_ticks = nb_ticks + nb_ticks_max
elapsed_time = REAL(nb_ticks) / nb_ticks_sec
cpu_time_elapsed = t2-t1
write(*,'(A,I0,A)') 'process: ',control%process_id,&
" > SYSTEM clock <: "//trim(write_time(elapsed_time))//&
" /-\ CPU time <: "//trim(write_time(cpu_time_elapsed))
!total time including all blocks
call MPI_GATHER(elapsed_time, 1, MPI_DOUBLE_PRECISION, &
total_time, 1, MPI_DOUBLE_PRECISION, 0,MPI_COMM_WORLD, ierr)
if(control%process_id==0) print*, "Total SYSTEM clock: ", trim(write_time(sum(total_time)))
call MPI_GATHER(cpu_time_elapsed, 1, MPI_DOUBLE_PRECISION, &
total_time, 1, MPI_DOUBLE_PRECISION, 0,MPI_COMM_WORLD, ierr)
if(control%process_id==0) print*, "Total CPU time : ", trim(write_time(sum(total_time)))
end subroutine destroy_time