Commit ea1580e5 authored by Lorenz Huedepohl's avatar Lorenz Huedepohl
Browse files

Add interface for timer_start/timer_stop to API

parent 7329e8f8
......@@ -98,6 +98,8 @@ module elpa_api
! Timer
procedure(elpa_get_time_i), deferred, public :: get_time
procedure(elpa_print_times_i), deferred, public :: print_times
procedure(elpa_timer_start_i), deferred, public :: timer_start
procedure(elpa_timer_stop_i), deferred, public :: timer_stop
! Actual math routines
generic, public :: eigenvectors => & !< method eigenvectors for solving the full eigenvalue problem
......@@ -355,10 +357,31 @@ module elpa_api
!> \details
!> \param self class(elpa_t): the ELPA object
abstract interface
subroutine elpa_print_times_i(self)
subroutine elpa_print_times_i(self, name1, name2, name3, name4)
import elpa_t
implicit none
class(elpa_t), intent(in) :: self
character(len=*), intent(in), optional :: name1, name2, name3, name4
end subroutine
end interface
abstract interface
subroutine elpa_timer_start_i(self, name)
import elpa_t
implicit none
class(elpa_t), intent(inout) :: self
character(len=*), intent(in) :: name
end subroutine
end interface
abstract interface
subroutine elpa_timer_stop_i(self, name)
import elpa_t
implicit none
class(elpa_t), intent(inout) :: self
character(len=*), intent(in) :: name
end subroutine
end interface
......
......@@ -77,6 +77,8 @@ module elpa_impl
! timer
procedure, public :: get_time => elpa_get_time
procedure, public :: print_times => elpa_print_times
procedure, public :: timer_start => elpa_timer_start
procedure, public :: timer_stop => elpa_timer_stop
!> \brief the private methods
......@@ -444,13 +446,33 @@ module elpa_impl
end function
subroutine elpa_print_times(self)
subroutine elpa_print_times(self, name1, name2, name3, name4)
class(elpa_impl_t), intent(in) :: self
character(len=*), intent(in), optional :: name1, name2, name3, name4
#ifdef HAVE_DETAILED_TIMINGS
call self%timer%print()
call self%timer%print(name1, name2, name3, name4)
#endif
end subroutine
subroutine elpa_timer_start(self, name)
class(elpa_impl_t), intent(inout) :: self
character(len=*), intent(in) :: name
#ifdef HAVE_DETAILED_TIMINGS
call self%timer%start(name)
#endif
end subroutine
subroutine elpa_timer_stop(self, name)
class(elpa_impl_t), intent(inout) :: self
character(len=*), intent(in) :: name
#ifdef HAVE_DETAILED_TIMINGS
call self%timer%stop(name)
#endif
end subroutine
!> \brief elpa_eigenvectors_d: class method to solve the eigenvalue problem for double real matrices
!>
!> The dimensions of the matrix a (locally ditributed and global), the block-cyclic distribution
......
......@@ -138,8 +138,9 @@ program test
type(output_t) :: write_to_file
class(elpa_t), pointer :: e
#ifdef TEST_ALL_KERNELS
integer :: i, kernel
integer :: i
#endif
integer :: kernel
call read_input_parameters_traditional(na, nev, nblk, write_to_file)
call setup_mpi(myid, nprocs)
......@@ -210,28 +211,44 @@ program test
#ifdef TEST_ALL_KERNELS
do i = 0, elpa_option_cardinality(KERNEL_KEY)
kernel = elpa_option_enumerate(KERNEL_KEY, i)
#endif /* TEST_ALL_KERNELS */
#endif
#ifdef TEST_KERNEL
call e%set(KERNEL_KEY, TEST_KERNEL, error)
assert_elpa_ok(error)
kernel = TEST_KERNEL
#endif
#ifdef TEST_ALL_KERNELS
#ifdef TEST_SOLVER_2STAGE
call e%set(KERNEL_KEY, kernel, error)
#ifdef TEST_KERNEL
assert_elpa_ok(error)
#else
if (error /= ELPA_OK) then
cycle
endif
#endif
if (myid == 0) print *, elpa_int_value_to_string(KERNEL_KEY, kernel), " kernel"
call e%timer_start(elpa_int_value_to_string(KERNEL_KEY, kernel))
#else
call e%timer_start("e%eigenvectors()")
#endif
! The actual solve step
call e%eigenvectors(a, ev, z, error)
assert_elpa_ok(error)
#ifdef TEST_SOLVER_2STAGE
call e%timer_stop(elpa_int_value_to_string(KERNEL_KEY, kernel))
#else
call e%timer_stop("e%eigenvectors()")
#endif
if (myid .eq. 0) then
call e%print_times()
#ifdef TEST_SOLVER_2STAGE
call e%print_times(elpa_int_value_to_string(KERNEL_KEY, kernel))
#else
call e%print_times("e%eigenvectors()")
#endif
endif
status = check_correctness(na, nev, as, z, ev, sc_desc, myid)
if (status /= 0) then
print *, "Result incorrect!"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment