Commit 9947673b authored by Andreas Marek's avatar Andreas Marek
Browse files

Add option summary_timings to new interface

parent a953004b
......@@ -52,7 +52,7 @@
#include "config-f90.h"
!> \brief Fortran module which contains the source of ELPA 1stage
module ELPA1_COMPUTE
module elpa1_compute
use elpa_utilities
#ifdef HAVE_DETAILED_TIMINGS
use timings
......@@ -245,4 +245,4 @@ module ELPA1_COMPUTE
#endif /* WANT_SINGLE_PRECISION_COMPLEX */
end module ELPA1_compute
end module elpa1_compute
......@@ -136,13 +136,6 @@ module elpa1_impl
! Timing results, set by every call to solve_evp_xxx
real(kind=c_double), public :: time_evp_fwd !< time for forward transformations (to tridiagonal form)
real(kind=c_double), public :: time_evp_solve !< time for solving the tridiagonal system
real(kind=c_double), public :: time_evp_back !< time for back transformations of eigenvectors
logical, public :: elpa_print_times = .false. !< Set elpa_print_times to .true. for explicit timing outputs
!> \brief elpa_solve_evp_real_1stage_double_impl: Fortran function to solve the real eigenvalue problem with 1-stage solver. This is called by "elpa_solve_evp_real"
!>
! Parameters
......
......@@ -59,7 +59,8 @@ function elpa_solve_evp_&
&_1stage_&
&PRECISION&
&_impl ( na, nev, a, lda, ev, q, ldq, nblk, matrixCols, mpi_comm_rows, &
mpi_comm_cols, mpi_comm_all, useGPU) result(success)
mpi_comm_cols, mpi_comm_all, useGPU, time_evp_fwd, &
time_evp_solve, time_evp_back, summary_timings) result(success)
use precision
use cuda_functions
use mod_check_for_gpu
......@@ -104,6 +105,9 @@ function elpa_solve_evp_&
logical, intent(in) :: useGPU
logical :: success
real(kind=c_double) :: time_evp_fwd, &
time_evp_solve, time_evp_back
logical, intent(in) :: summary_timings
logical :: do_useGPU
integer(kind=ik) :: numberOfGPUDevices
......@@ -218,7 +222,7 @@ function elpa_solve_evp_&
& (na, a, lda, nblk, matrixCols, mpi_comm_rows, mpi_comm_cols, ev, e, tau, do_useGPU)
ttt1 = MPI_Wtime()
if(my_prow==0 .and. my_pcol==0 .and. elpa_print_times) write(error_unit,*) 'Time tridiag_real :',ttt1-ttt0
if(my_prow==0 .and. my_pcol==0 .and. summary_timings) write(error_unit,*) 'Time tridiag_real :',ttt1-ttt0
time_evp_fwd = ttt1-ttt0
ttt0 = MPI_Wtime()
......@@ -236,7 +240,7 @@ function elpa_solve_evp_&
if (.not.(success)) return
ttt1 = MPI_Wtime()
if(my_prow==0 .and. my_pcol==0 .and. elpa_print_times) write(error_unit,*) 'Time solve_tridi :',ttt1-ttt0
if(my_prow==0 .and. my_pcol==0 .and. summary_timings) write(error_unit,*) 'Time solve_tridi :',ttt1-ttt0
time_evp_solve = ttt1-ttt0
ttt0 = MPI_Wtime()
......@@ -250,7 +254,7 @@ function elpa_solve_evp_&
&PRECISION&
& (na, nev, a, lda, tau, q, ldq, nblk, matrixCols, mpi_comm_rows, mpi_comm_cols, do_useGPU)
ttt1 = MPI_Wtime()
if(my_prow==0 .and. my_pcol==0 .and. elpa_print_times) write(error_unit,*) 'Time trans_ev_real:',ttt1-ttt0
if(my_prow==0 .and. my_pcol==0 .and. summary_timings) write(error_unit,*) 'Time trans_ev_real:',ttt1-ttt0
time_evp_back = ttt1-ttt0
#if COMPLEXCASE == 1
......
......@@ -158,6 +158,16 @@ function elpa_solve_evp_&
endif
endif
if (elpa_print_times) then
call elpa1stage%set("summary_timings", 1,successInternal)
if (successInternal .ne. ELPA_OK) then
print *, "Cannot set summary_timings"
stop
success = .false.
return
endif
endif
call elpa1stage%solve(a(1:lda,1:matrixCols), ev, q(1:ldq,1:matrixCols), successInternal)
if (successInternal .ne. ELPA_OK) then
print *, "Cannot solve with ELPA 1stage"
......@@ -166,6 +176,11 @@ function elpa_solve_evp_&
return
endif
if (elpa_print_times) then
time_evp_fwd = elpa1stage%time_evp_fwd
time_evp_solve = elpa1stage%time_evp_solve
time_evp_back = elpa1stage%time_evp_back
endif
call elpa1stage%destroy()
call elpa_uninit()
......
......@@ -60,7 +60,7 @@ module ELPA2_compute
use ELPA_utilities
USE ELPA1_compute
use elpa1_impl, only : elpa_print_times, time_evp_back, time_evp_fwd, time_evp_solve
!use elpa1_impl, only : elpa_print_times, time_evp_back, time_evp_fwd, time_evp_solve
use elpa2_utilities
use elpa_pdgeqrf
use precision
......
......@@ -59,7 +59,7 @@ module elpa2_impl
! Version 1.1.2, 2011-02-21
use elpa_utilities
use elpa1_impl, only : elpa_print_times, time_evp_back, time_evp_fwd, time_evp_solve
! use elpa1_impl, only : elpa_print_times, time_evp_back, time_evp_fwd, time_evp_solve
use elpa2_utilities
implicit none
......
......@@ -55,7 +55,7 @@
&2stage_&
&PRECISION&
&_impl (na, nev, a, lda, ev, q, ldq, nblk, matrixCols, mpi_comm_rows, mpi_comm_cols, mpi_comm_all, &
useGPU, &
time_evp_fwd, time_evp_solve, time_evp_back, summary_timings, useGPU, &
#if REALCASE == 1
THIS_ELPA_KERNEL_API, useQR &
#endif
......@@ -107,6 +107,8 @@
#if COMPLEXCASE == 1
real(kind=C_DATATYPE_KIND), allocatable :: q_real(:,:)
#endif
real(kind=c_double) :: time_evp_fwd, time_evp_solve, time_evp_back
logical, intent(in) :: summary_timings
integer(kind=c_intptr_t) :: tmat_dev, q_dev, a_dev
real(kind=c_double) :: ttt0, ttt1, ttts ! MPI_WTIME always needs double
......@@ -385,7 +387,7 @@
)
if (.not.(success)) return
ttt1 = MPI_Wtime()
if (my_prow==0 .and. my_pcol==0 .and. elpa_print_times) &
if (my_prow==0 .and. my_pcol==0 .and. summary_timings) &
write(error_unit,*) "Time " // "bandred_&
&MATH_DATATYPE&
&_&
......@@ -413,7 +415,7 @@
(na, nbw, nblk, a, a_dev, lda, ev, e, matrixCols, hh_trans, mpi_comm_rows, mpi_comm_cols, mpi_comm_all, do_useGPU)
ttt1 = MPI_Wtime()
if (my_prow==0 .and. my_pcol==0 .and. elpa_print_times) &
if (my_prow==0 .and. my_pcol==0 .and. summary_timings) &
write(error_unit,*) "Time " // "tridiag_band_&
&MATH_DATATYPE&
&_&
......@@ -459,7 +461,7 @@
if (.not.(success)) return
ttt1 = MPI_Wtime()
if (my_prow==0 .and. my_pcol==0 .and. elpa_print_times) &
if (my_prow==0 .and. my_pcol==0 .and. summary_timings) &
write(error_unit,*) 'Time solve_tridi :',ttt1-ttt0
time_evp_solve = ttt1-ttt0
ttts = ttt1
......@@ -494,11 +496,11 @@
(na, nev, nblk, nbw, q, &
q_dev, &
ldq, matrixCols, hh_trans, mpi_comm_rows, mpi_comm_cols, wantDebug, do_useGPU_trans_ev_tridi, &
success, THIS_ELPA_KERNEL)
summary_timings, success, THIS_ELPA_KERNEL)
if (.not.(success)) return
ttt1 = MPI_Wtime()
if (my_prow==0 .and. my_pcol==0 .and. elpa_print_times) &
if (my_prow==0 .and. my_pcol==0 .and. summary_timings) &
write(error_unit,*) "Time " // "trans_ev_tridi_to_band_&
&MATH_DATATYPE&
&_&
......@@ -541,7 +543,7 @@
)
ttt1 = MPI_Wtime()
if (my_prow==0 .and. my_pcol==0 .and. elpa_print_times) &
if (my_prow==0 .and. my_pcol==0 .and. summary_timings) &
write(error_unit,*) "Time " // "trans_ev_band_to_full_&
&MATH_DATATYPE&
&_&
......
......@@ -57,7 +57,7 @@
&_&
&PRECISION &
(na, nev, nblk, nbw, q, q_dev, ldq, matrixCols, &
hh_trans, mpi_comm_rows, mpi_comm_cols, wantDebug, useGPU, success, &
hh_trans, mpi_comm_rows, mpi_comm_cols, wantDebug, useGPU, summary_timings, success, &
#if REALCASE == 1
THIS_REAL_ELPA_KERNEL)
#endif
......@@ -271,12 +271,12 @@
#ifndef WITH_MPI
integer(kind=ik) :: j1
#endif
integer(kind=c_intptr_t), parameter :: size_of_datatype = size_of_&
integer(kind=c_intptr_t), parameter :: size_of_datatype = size_of_&
&PRECISION&
&_&
&MATH_DATATYPE
logical :: summary_timings
call timer%start("trans_ev_tridi_to_band_&
&MATH_DATATYPE&
......@@ -2617,7 +2617,7 @@
#else /* WITH_MPI */
if (my_prow==0 .and. my_pcol==0 .and. elpa_print_times) &
if (my_prow==0 .and. my_pcol==0 .and. summary_timings) &
write(error_unit,'(" Kernel time:",f10.3," MFlops: ",es12.5)') kernel_time, kernel_flops/kernel_time*1.d-6
#endif /* WITH_MPI */
......
......@@ -198,6 +198,16 @@
endif
#endif
if (elpa_print_times) then
call elpa2stage%set("summary_timings", 1,successInternal)
if (successInternal .ne. ELPA_OK) then
print *, "Cannot set summary_timings"
stop
success = .false.
return
endif
endif
call elpa2stage%solve(a(1:lda,1:matrixCols), ev, q(1:ldq,1:matrixCols), successInternal)
if (successInternal .ne. ELPA_OK) then
print *, "Cannot solve with ELPA 2stage"
......@@ -206,6 +216,12 @@
return
endif
if (elpa_print_times) then
time_evp_fwd = elpa2stage%time_evp_fwd
time_evp_solve = elpa2stage%time_evp_solve
time_evp_back = elpa2stage%time_evp_back
endif
call elpa2stage%destroy()
call elpa_uninit()
......
......@@ -77,6 +77,23 @@ typedef struct {
/** OPTIONS **/
/* summary timings */
int summary_timings_cardinality() {
return 2;
}
const int summary_timings_enumerate_option(unsigned int n) {
return n;
}
int summary_timings_valid(elpa_options_t options, int value) {
if (value >= 0 && value < summary_timings_cardinality()) {
return ELPA_OK;
} else {
return ELPA_ERROR;
}
}
/* wantDebug */
int wantDebug_cardinality() {
......@@ -186,6 +203,7 @@ int complex_kernel_valid(elpa_options_t options, int value) {
elpa_int_option_t elpa_int_options[] = {
{"summary_timings", 0, summary_timings_cardinality, summary_timings_enumerate_option, summary_timings_valid},
{"wantDebug", 0, wantDebug_cardinality, wantDebug_enumerate_option, wantDebug_valid},
{"qr", 0, qr_cardinality, qr_enumerate_option, qr_valid},
{"gpu", 0, gpu_cardinality, gpu_enumerate_option, gpu_valid},
......
......@@ -110,6 +110,10 @@ module elpa_type
integer(kind=c_int) :: local_nrows = 0
integer(kind=c_int) :: local_ncols = 0
integer(kind=c_int) :: nblk = 0
real(kind=c_double), public :: time_evp_fwd
real(kind=c_double), public :: time_evp_solve
real(kind=c_double), public :: time_evp_back
contains
generic, public :: set => elpa_set_integer
generic, public :: get => elpa_get_integer
......@@ -406,12 +410,26 @@ module elpa_type
real(kind=c_double) :: a(self%local_nrows, self%local_ncols), q(self%local_nrows, self%local_ncols)
!#endif
real(kind=c_double) :: ev(self%na)
real(kind=c_double) :: time_evp_fwd, time_evp_solve, time_evp_back
integer, optional :: success
integer(kind=c_int) :: success_internal
logical :: success_l
logical :: success_l, summary_timings
logical :: useGPU
if (self%get("summary_timings",success_internal) .eq. 1) then
if (success_internal .ne. ELPA_OK) then
print *,"Could not querry summary timings"
stop
endif
summary_timings = .true.
else
summary_timings = .false.
endif
if (self%get("gpu",success_internal) .eq. 1) then
if (success_internal .ne. ELPA_OK) then
print *,"Could not querry gpu"
......@@ -431,7 +449,8 @@ module elpa_type
success_l = elpa_solve_evp_real_1stage_double_impl(self%na, self%nev, a, self%local_nrows, ev, q, &
self%local_nrows, self%nblk, self%local_ncols, &
self%mpi_comm_rows, self%mpi_comm_cols, &
self%mpi_comm_parent, useGPU)
self%mpi_comm_parent, useGPU, time_evp_fwd, &
time_evp_solve, time_evp_back, summary_timings)
else if (self%get("solver",success_internal) .eq. 2) then
if (success_internal .ne. ELPA_OK) then
......@@ -441,7 +460,8 @@ module elpa_type
success_l = elpa_solve_evp_real_2stage_double_impl(self%na, self%nev, a, self%local_nrows, ev, q, &
self%local_nrows, self%nblk, self%local_ncols, &
self%mpi_comm_rows, self%mpi_comm_cols, &
self%mpi_comm_parent, useGPU)
self%mpi_comm_parent, time_evp_fwd, &
time_evp_solve, time_evp_back, summary_timings, useGPU)
else
print *,"unknown solver"
stop
......@@ -457,6 +477,21 @@ module elpa_type
write(error_unit,'(a)') "ELPA: Error in solve() and you did not check for errors!"
endif
if (self%get("summary_timings",success_internal) .eq. 1) then
if (success_internal .ne. ELPA_OK) then
print *,"Could not querry summary timings"
stop
endif
self%time_evp_fwd = time_evp_fwd
self%time_evp_solve = time_evp_solve
self%time_evp_back = time_evp_back
else
self%time_evp_fwd = -1.0
self%time_evp_solve = -1.0
self%time_evp_back = -1.0
endif
end subroutine
subroutine elpa_solve_real_single(self, a, ev, q, success)
......@@ -473,13 +508,25 @@ module elpa_type
real(kind=c_float) :: a(self%local_nrows, self%local_ncols), q(self%local_nrows, self%local_ncols)
!#endif
real(kind=c_float) :: ev(self%na)
real(kind=c_double) :: time_evp_fwd, time_evp_solve, time_evp_back
integer, optional :: success
integer(kind=c_int) :: success_internal
logical :: success_l
logical :: success_l, summary_timings
logical :: useGPU
#ifdef WANT_SINGLE_PRECISION_REAL
if (self%get("timings",success_internal) .eq. 1) then
if (success_internal .ne. ELPA_OK) then
print *,"Could not querry summary timings"
stop
endif
summary_timings = .true.
else
summary_timings = .false.
endif
if (self%get("gpu",success_internal) .eq. 1) then
if (success_internal .ne. ELPA_OK) then
......@@ -500,7 +547,8 @@ module elpa_type
success_l = elpa_solve_evp_real_1stage_single_impl(self%na, self%nev, a, self%local_nrows, ev, q, &
self%local_nrows, self%nblk, self%local_ncols, &
self%mpi_comm_rows, self%mpi_comm_cols, &
self%mpi_comm_parent, useGPU)
self%mpi_comm_parent, useGPU, time_evp_fwd, &
time_evp_solve, time_evp_back, summary_timings)
else if (self%get("solver",success_internal) .eq. 2) then
if (success_internal .ne. ELPA_OK) then
......@@ -510,7 +558,8 @@ module elpa_type
success_l = elpa_solve_evp_real_2stage_single_impl(self%na, self%nev, a, self%local_nrows, ev, q, &
self%local_nrows, self%nblk, self%local_ncols, &
self%mpi_comm_rows, self%mpi_comm_cols, &
self%mpi_comm_parent, useGPU)
self%mpi_comm_parent, time_evp_fwd, &
time_evp_solve, time_evp_back, summary_timings, useGPU)
else
print *,"unknown solver"
stop
......@@ -525,6 +574,23 @@ module elpa_type
else if (.not. success_l) then
write(error_unit,'(a)') "ELPA: Error in solve() and you did not check for errors!"
endif
if (self%get("summary_timings",success_internal) .eq. 1) then
if (success_internal .ne. ELPA_OK) then
print *,"Could not querry summary timings"
stop
endif
self%time_evp_fwd = time_evp_fwd
self%time_evp_solve = time_evp_solve
self%time_evp_back = time_evp_back
else
self%time_evp_fwd = -1.0
self%time_evp_solve = -1.0
self%time_evp_back = -1.0
endif
#else
success = ELPA_ERROR
#endif
......@@ -548,11 +614,23 @@ module elpa_type
!#endif
real(kind=c_double) :: ev(self%na)
real(kind=c_double) :: time_evp_fwd, time_evp_solve, time_evp_back
integer, optional :: success
integer(kind=c_int) :: success_internal
logical :: success_l
logical :: success_l, summary_timings
logical :: useGPU
if (self%get("timings",success_internal) .eq. 1) then
if (success_internal .ne. ELPA_OK) then
print *,"Could not querry summary timings"
stop
endif
summary_timings = .true.
else
summary_timings = .false.
endif
if (self%get("gpu",success_internal) .eq. 1) then
if (success_internal .ne. ELPA_OK) then
......@@ -573,7 +651,8 @@ module elpa_type
success_l = elpa_solve_evp_complex_1stage_double_impl(self%na, self%nev, a, self%local_nrows, ev, q, &
self%local_nrows, self%nblk, self%local_ncols, &
self%mpi_comm_rows, self%mpi_comm_cols, &
self%mpi_comm_parent, useGPU)
self%mpi_comm_parent, useGPU, time_evp_fwd, &
time_evp_solve, time_evp_back, summary_timings)
else if (self%get("solver",success_internal) .eq. 2) then
if (success_internal .ne. ELPA_OK) then
......@@ -583,7 +662,8 @@ module elpa_type
success_l = elpa_solve_evp_complex_2stage_double_impl(self%na, self%nev, a, self%local_nrows, ev, q, &
self%local_nrows, self%nblk, self%local_ncols, &
self%mpi_comm_rows, self%mpi_comm_cols, &
self%mpi_comm_parent, useGPU)
self%mpi_comm_parent, time_evp_fwd, &
time_evp_solve, time_evp_back, summary_timings, useGPU)
else
print *,"unknown solver"
stop
......@@ -599,6 +679,21 @@ module elpa_type
write(error_unit,'(a)') "ELPA: Error in solve() and you did not check for errors!"
endif
if (self%get("summary_timings",success_internal) .eq. 1) then
if (success_internal .ne. ELPA_OK) then
print *,"Could not querry summary timings"
stop
endif
self%time_evp_fwd = time_evp_fwd
self%time_evp_solve = time_evp_solve
self%time_evp_back = time_evp_back
else
self%time_evp_fwd = -1.0
self%time_evp_solve = -1.0
self%time_evp_back = -1.0
endif
end subroutine
......@@ -618,13 +713,26 @@ module elpa_type
!#endif
real(kind=rk4) :: ev(self%na)
real(kind=c_double) :: time_evp_fwd, time_evp_solve, time_evp_back
integer, optional :: success
integer(kind=c_int) :: success_internal
logical :: success_l
logical :: success_l, summary_timings
logical :: useGPU
#ifdef WANT_SINGLE_PRECISION_COMPLEX
if (self%get("summary_timings",success_internal) .eq. 1) then
if (success_internal .ne. ELPA_OK) then
print *,"Could not querry summary timings"
stop
endif
summary_timings = .true.
else
summary_timings = .false.
endif
if (self%get("gpu",success_internal) .eq. 1) then
if (success_internal .ne. ELPA_OK) then
print *,"Could not querry gpu"
......@@ -644,7 +752,8 @@ module elpa_type
success_l = elpa_solve_evp_complex_1stage_single_impl(self%na, self%nev, a, self%local_nrows, ev, q, &
self%local_nrows, self%nblk, self%local_ncols, &
self%mpi_comm_rows, self%mpi_comm_cols, &
self%mpi_comm_parent, useGPU)
self%mpi_comm_parent, useGPU, time_evp_fwd, &
time_evp_solve, time_evp_back, summary_timings)
else if (self%get("solver",success_internal) .eq. 2) then
if (success_internal .ne. ELPA_OK) then
......@@ -654,7 +763,8 @@ module elpa_type
success_l = elpa_solve_evp_complex_2stage_single_impl(self%na, self%nev, a, self%local_nrows, ev, q, &
self%local_nrows, self%nblk, self%local_ncols, &
self%mpi_comm_rows, self%mpi_comm_cols, &
self%mpi_comm_parent, useGPU)
self%mpi_comm_parent, time_evp_fwd, &
time_evp_solve, time_evp_back, summary_timings, useGPU)
else
print *,"unknown solver"
stop
......@@ -669,6 +779,23 @@ module elpa_type
else if (.not. success_l) then
write(error_unit,'(a)') "ELPA: Error in solve() and you did not check for errors!"
endif
if (self%get("summary_timings",success_internal) .eq. 1) then
if (success_internal .ne. ELPA_OK) then
print *,"Could not querry summary timings"
stop
endif
self%time_evp_fwd = time_evp_fwd
self%time_evp_solve = time_evp_solve
self%time_evp_back = time_evp_back
else
self%time_evp_fwd = -1.0
self%time_evp_solve = -1.0
self%time_evp_back = -1.0
endif
#else
success = ELPA_ERROR
#endif
......@@ -689,7 +816,7 @@ module elpa_type
! real(kind=REAL_DATATYPE) :: a(lda,*), b(ldb,*), c(ldc,*)
!#else
real(kind=rk8) :: a(lda,ldaCols), b(ldb,ldbCols), c(ldc,ldcCols)
!#endif
!#endif
integer, optional :: success
logical :: success_l
......
......@@ -136,9 +136,6 @@ program test_interface
call e%set("real_kernel", ELPA_2STAGE_REAL_GENERIC, success)
assert(success == ELPA_OK)
call e%set("complex_kernel", ELPA_2STAGE_COMPLEX_GENERIC, success)
assert(success == ELPA_OK)
call e%solve(a, ev, z, success)
assert(success == ELPA_OK)
......
......@@ -245,7 +245,7 @@ program test_real_double_precision
#ifdef HAVE_DETAILED_TIMINGS
call timer%stop("set up matrix")
#endif
elpa_print_times = .true.
!-------------------------------------------------------------------------------
! Calculate eigenvalues/eigenvectors
......
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