diff --git a/src/elpa_api.F90 b/src/elpa_api.F90 index 474f32e0c4ead5e421e0a90b81ed68dddd1f555d..735c15831f342b1ef79da01479a12677351f1a00 100644 --- a/src/elpa_api.F90 +++ b/src/elpa_api.F90 @@ -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 diff --git a/src/elpa_impl.F90 b/src/elpa_impl.F90 index 62d8aa6046f413e736c30d05d04f46c76a69d432..800d6b4d22fe6c41b715a95a45c7ae62d87eebfb 100644 --- a/src/elpa_impl.F90 +++ b/src/elpa_impl.F90 @@ -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 diff --git a/test/Fortran/test.F90 b/test/Fortran/test.F90 index 0805d7e8016e4e3f58650712f2af55ab8fc62ee5..f8dae9d18009abac16d4f2dca156b279f3b3e45c 100644 --- a/test/Fortran/test.F90 +++ b/test/Fortran/test.F90 @@ -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!"