F95 timing routines

Problems running VASP: crashes, internal errors, "wrong" results.


Moderators: Global Moderator, Moderator

Post Reply
Message
Author
job
Jr. Member
Jr. Member
Posts: 55
Joined: Tue Aug 16, 2005 7:44 am

F95 timing routines

#1 Post by job » Tue Aug 16, 2005 9:48 am

I thought that I had some problems related to FP exceptions in the timing routines, so I rewrote them in F95 (some trivial changes are of course also needed in the vasp.4.lib Makefile). Well, the "problem" turned out to be a non-issue, but here are the subroutines in case anyone finds them useful. They should work on any platform where a F95 compiler is available. To the vasp team: Please feel free to include the code in a future vasp release, if you wish.

Code: Select all

! Copyright (c) 2005 Janne Blomqvist
! Return some timing information using f95 intrinsics.
subroutine timing ( mode, utime, stime, etime, minpgf, majpgf, &
     rsizm, avsiz, iswps, ioops, ivcsw, ierr)
  use preclib
  implicit none

  ! Arguments.
  real(q), intent(out) :: utime, stime, etime, rsizm, avsiz
  integer, intent(in) :: mode
  integer, intent(out) :: minpgf, majpgf, iswps, ioops, ivcsw, ierr

  ! Local variables.
  logical, save :: init = .false.
  real(q), save :: utinit = 0._q
  integer :: count, rate

  ierr = 0

  stime = 0._q
  ! Use -1 to signal to the user that these values are not calculated.
  rsizm = -1._q
  avsiz = -1._q
  minpgf = -1
  majpgf = -1
  iswps = -1
  ioops = -1
  ivcsw = -1

  call system_clock (count = count, count_rate = rate)
  etime = real (count, q) / real (rate, q)

  if (.not. init) then
     call cpu_time (utinit)
     init = .true.
     utime = 0._q
  else
     call cpu_time (utime)
     utime = utime - utinit
  end if
end subroutine timing


! F95 implementation of VTIME. Note that as in the VASP default
! implementation, VPU time is the cpu time and CPU time is the wallclock
! time.
subroutine vtime (vputim, cputim)
  use preclib
  implicit none

  ! Arguments.
  real(q), intent(out) :: vputim, cputim

  ! Local variables.
  integer :: count, rate

  call system_clock (count = count, count_rate = rate)
  cputim = real (count, q) / real (rate, q)

  call cpu_time (vputim)
end subroutine vtime
Last edited by job on Tue Aug 16, 2005 9:48 am, edited 1 time in total.

job
Jr. Member
Jr. Member
Posts: 55
Joined: Tue Aug 16, 2005 7:44 am

F95 timing routines

#2 Post by job » Tue Aug 16, 2005 9:54 am

Whoops, linebreaks were messed up when I copy-pasted the code. You can download it from http://www.fyslab.hut.fi/~job/timing_f95.f90 instead.
Last edited by job on Tue Aug 16, 2005 9:54 am, edited 1 time in total.

Post Reply