Commit f6ded0c5 authored by Pavel Kus's avatar Pavel Kus Committed by Andreas Marek
Browse files

checking only part of eigenvalues for scalapack p???evr

unlike elpa 2stage, scalapack computes only part of eigenvalues
if only part of eigenvectors are required. Check only those.
parent 68d112f5
...@@ -143,6 +143,8 @@ program test ...@@ -143,6 +143,8 @@ program test
! eigenvalues ! eigenvalues
EV_TYPE, allocatable :: ev(:), ev_analytic(:) EV_TYPE, allocatable :: ev(:), ev_analytic(:)
logical :: check_all_evals
#if defined(TEST_EIGENVALUES) || defined(TEST_SOLVE_TRIDIAGONAL) || defined(TEST_EIGENVECTORS) || defined(TEST_QR_DECOMPOSITION) || defined(TEST_HERMITIAN_MULTIPLY) #if defined(TEST_EIGENVALUES) || defined(TEST_SOLVE_TRIDIAGONAL) || defined(TEST_EIGENVECTORS) || defined(TEST_QR_DECOMPOSITION) || defined(TEST_HERMITIAN_MULTIPLY)
EV_TYPE, allocatable :: d(:), sd(:), ds(:), sds(:) EV_TYPE, allocatable :: d(:), sd(:), ds(:), sds(:)
EV_TYPE :: diagonalELement, subdiagonalElement EV_TYPE :: diagonalELement, subdiagonalElement
...@@ -187,7 +189,7 @@ program test ...@@ -187,7 +189,7 @@ program test
#endif #endif
#endif #endif
check_all_evals = .true.
if (elpa_init(CURRENT_API_VERSION) /= ELPA_OK) then if (elpa_init(CURRENT_API_VERSION) /= ELPA_OK) then
print *, "ELPA API version not supported" print *, "ELPA API version not supported"
...@@ -436,6 +438,7 @@ program test ...@@ -436,6 +438,7 @@ program test
call solve_scalapack_all(na, a, sc_desc, ev, z) call solve_scalapack_all(na, a, sc_desc, ev, z)
#elif TEST_SCALAPACK_PART #elif TEST_SCALAPACK_PART
call solve_scalapack_part(na, a, sc_desc, nev, ev, z) call solve_scalapack_part(na, a, sc_desc, nev, ev, z)
check_all_evals = .false. ! scalapack does not compute all eigenvectors
#else #else
call e%eigenvectors(a, ev, z, error) call e%eigenvectors(a, ev, z, error)
#endif #endif
...@@ -498,7 +501,7 @@ program test ...@@ -498,7 +501,7 @@ program test
#if defined(TEST_EIGENVECTORS) || defined(TEST_QR_DECOMPOSITION) #if defined(TEST_EIGENVECTORS) || defined(TEST_QR_DECOMPOSITION)
#ifdef TEST_MATRIX_ANALYTIC #ifdef TEST_MATRIX_ANALYTIC
status = check_correctness_analytic(na, nev, ev, z, nblk, myid, np_rows, np_cols, my_prow, my_pcol) status = check_correctness_analytic(na, nev, ev, z, nblk, myid, np_rows, np_cols, my_prow, my_pcol, check_all_evals)
#else #else
if (nev .ge. 1) then if (nev .ge. 1) then
status = check_correctness(na, nev, as, z, ev, sc_desc, nblk, myid, np_rows,np_cols, my_prow, my_pcol) status = check_correctness(na, nev, as, z, ev, sc_desc, nblk, myid, np_rows,np_cols, my_prow, my_pcol)
......
...@@ -85,13 +85,14 @@ ...@@ -85,13 +85,14 @@
&MATH_DATATYPE& &MATH_DATATYPE&
&_& &_&
&PRECISION& &PRECISION&
&(na, nev, ev, z, nblk, myid, np_rows, np_cols, my_prow, my_pcol) result(status) &(na, nev, ev, z, nblk, myid, np_rows, np_cols, my_prow, my_pcol, check_all_evals) result(status)
implicit none implicit none
#include "../../src/general/precision_kinds.F90" #include "../../src/general/precision_kinds.F90"
integer(kind=ik), intent(in) :: na, nev, nblk, myid, np_rows, np_cols, my_prow, my_pcol integer(kind=ik), intent(in) :: na, nev, nblk, myid, np_rows, np_cols, my_prow, my_pcol
integer(kind=ik) :: status, mpierr integer(kind=ik) :: status, mpierr
MATH_DATATYPE(kind=rck), intent(inout) :: z(:,:) MATH_DATATYPE(kind=rck), intent(inout) :: z(:,:)
real(kind=rk), intent(inout) :: ev(:) real(kind=rk), intent(inout) :: ev(:)
logical, intent(in) :: check_all_evals
integer(kind=ik) :: globI, globJ, locI, locJ, levels(num_primes) integer(kind=ik) :: globI, globJ, locI, locJ, levels(num_primes)
real(kind=rk) :: diff, max_z_diff, max_ev_diff, glob_max_z_diff, max_curr_z_diff real(kind=rk) :: diff, max_z_diff, max_ev_diff, glob_max_z_diff, max_curr_z_diff
...@@ -109,7 +110,7 @@ ...@@ -109,7 +110,7 @@
MATH_DATATYPE(kind=rck) :: computed_z, expected_z MATH_DATATYPE(kind=rck) :: computed_z, expected_z
MATH_DATATYPE(kind=rck) :: max_value_for_normalization, computed_z_on_max_position, normalization_quotient MATH_DATATYPE(kind=rck) :: max_value_for_normalization, computed_z_on_max_position, normalization_quotient
integer(kind=ik) :: max_value_idx, rank_with_max, rank_with_max_reduced integer(kind=ik) :: max_value_idx, rank_with_max, rank_with_max_reduced, num_checked_evals
if(.not. decompose(na, levels)) then if(.not. decompose(na, levels)) then
...@@ -117,10 +118,15 @@ ...@@ -117,10 +118,15 @@
stop 1 stop 1
end if end if
if(check_all_evals) then
num_checked_evals = na
else
num_checked_evals = nev
endif
!call print_matrix(myid, na, z, "z") !call print_matrix(myid, na, z, "z")
max_z_diff = 0.0_rk max_z_diff = 0.0_rk
max_ev_diff = 0.0_rk max_ev_diff = 0.0_rk
do globJ = 1, na do globJ = 1, num_checked_evals
computed_ev = ev(globJ) computed_ev = ev(globJ)
expected_ev = analytic_eigenvalues_real_& expected_ev = analytic_eigenvalues_real_&
&PRECISION& &PRECISION&
......
...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
! any derivatives of ELPA under the same license that we chose for ! any derivatives of ELPA under the same license that we chose for
! the original distribution, the GNU Lesser General Public License. ! the original distribution, the GNU Lesser General Public License.
! compute all eigenvectores ! compute all eigenvectors
subroutine solve_p& subroutine solve_p&
&BLAS_CHAR_AND_SY_OR_HE& &BLAS_CHAR_AND_SY_OR_HE&
&evd(na, a, sc_desc, ev, z) &evd(na, a, sc_desc, ev, z)
...@@ -97,7 +97,7 @@ ...@@ -97,7 +97,7 @@
end subroutine end subroutine
! compute part of eigenvectores ! compute part of eigenvectors
subroutine solve_p& subroutine solve_p&
&BLAS_CHAR_AND_SY_OR_HE& &BLAS_CHAR_AND_SY_OR_HE&
&evr(na, a, sc_desc, nev, ev, z) &evr(na, a, sc_desc, nev, ev, z)
......
Supports Markdown
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