Commit b680e94d authored by Pavel Kus's avatar Pavel Kus

scalapack descriptor not a parameter of gneralized evp routines

instead, blacs context has to be set beforehand
parent bf2adee4
......@@ -70,11 +70,10 @@
* \param ev on return: float/double pointer to eigenvalues
* \param q on return: float/double float complex/double complex pointer to eigenvectors
* \param is_already_decomposed set to 1, if b already decomposed by previous call to elpa_generalized
* \param sc_desc scalapack descriptor
* \param error on return the error code, which can be queried with elpa_strerr()
* \result void
*/
#define elpa_generalized_eigenvectors(handle, a, b, ev, q, sc_desc, is_already_decomposed, error) _Generic((a), \
#define elpa_generalized_eigenvectors(handle, a, b, ev, q, is_already_decomposed, error) _Generic((a), \
double*: \
elpa_generalized_eigenvectors_d, \
\
......@@ -86,7 +85,7 @@
\
float complex*: \
elpa_generalized_eigenvectors_fc \
)(handle, a, b, ev, q, sc_desc, is_already_decomposed, error)
)(handle, a, b, ev, q, is_already_decomposed, error)
/*! \brief generic C method for elpa_eigenvalues
......
......@@ -824,7 +824,7 @@ module elpa_api
!> \param is_already_decomposed logical, input: is it repeated call with the same b (decomposed in the fist call)?
!> \result error integer, optional : error code, which can be queried with elpa_strerr
abstract interface
subroutine elpa_generalized_eigenvectors_d_i(self, a, b, ev, q, sc_desc, is_already_decomposed, error)
subroutine elpa_generalized_eigenvectors_d_i(self, a, b, ev, q, is_already_decomposed, error)
use iso_c_binding
use elpa_constants
import elpa_t
......@@ -837,7 +837,6 @@ module elpa_api
q(self%local_nrows, self%local_ncols)
#endif
real(kind=c_double) :: ev(self%na)
integer :: sc_desc(SC_DESC_LEN)
logical :: is_already_decomposed
integer, optional :: error
end subroutine
......@@ -862,7 +861,7 @@ module elpa_api
!> \param is_already_decomposed logical, input: is it repeated call with the same b (decomposed in the fist call)?
!> \result error integer, optional : error code, which can be queried with elpa_strerr
abstract interface
subroutine elpa_generalized_eigenvectors_f_i(self, a, b, ev, q, sc_desc, is_already_decomposed, error)
subroutine elpa_generalized_eigenvectors_f_i(self, a, b, ev, q, is_already_decomposed, error)
use iso_c_binding
use elpa_constants
import elpa_t
......@@ -875,7 +874,6 @@ module elpa_api
q(self%local_nrows, self%local_ncols)
#endif
real(kind=c_float) :: ev(self%na)
integer :: sc_desc(SC_DESC_LEN)
logical :: is_already_decomposed
integer, optional :: error
......@@ -901,7 +899,7 @@ module elpa_api
!> \param is_already_decomposed logical, input: is it repeated call with the same b (decomposed in the fist call)?
!> \result error integer, optional : error code, which can be queried with elpa_strerr
abstract interface
subroutine elpa_generalized_eigenvectors_dc_i(self, a, b, ev, q, sc_desc, is_already_decomposed, error)
subroutine elpa_generalized_eigenvectors_dc_i(self, a, b, ev, q, is_already_decomposed, error)
use iso_c_binding
use elpa_constants
import elpa_t
......@@ -915,7 +913,6 @@ module elpa_api
q(self%local_nrows, self%local_ncols)
#endif
real(kind=c_double) :: ev(self%na)
integer :: sc_desc(SC_DESC_LEN)
logical :: is_already_decomposed
integer, optional :: error
......@@ -941,7 +938,7 @@ module elpa_api
!> \param is_already_decomposed logical, input: is it repeated call with the same b (decomposed in the fist call)?
!> \result error integer, optional : error code, which can be queried with elpa_strerr
abstract interface
subroutine elpa_generalized_eigenvectors_fc_i(self, a, b, ev, q, sc_desc, is_already_decomposed, error)
subroutine elpa_generalized_eigenvectors_fc_i(self, a, b, ev, q, is_already_decomposed, error)
use iso_c_binding
use elpa_constants
import elpa_t
......@@ -954,7 +951,6 @@ module elpa_api
q(self%local_nrows, self%local_ncols)
#endif
real(kind=c_float) :: ev(self%na)
integer :: sc_desc(SC_DESC_LEN)
logical :: is_already_decomposed
integer, optional :: error
......
This diff is collapsed.
#if 0
subroutine elpa_transform_generalized_&
&ELPA_IMPL_SUFFIX&
&(self, a, b, sc_desc, is_already_decomposed, error)
&(self, a, b, is_already_decomposed, error)
implicit none
#include "general/precision_kinds.F90"
class(elpa_impl_t) :: self
......@@ -12,7 +12,7 @@
#endif
integer :: error
logical :: is_already_decomposed
integer :: sc_desc(9)
integer :: sc_desc(SC_DESC_LEN)
! using elpa internal Hermitian multiply is faster then scalapack multiply, but we need an extra
! temporary variable. Therefore both options are provided and at the moment controled by this switch
......@@ -24,6 +24,9 @@
call self%timer_start("transform_generalized()")
error = self%construct_scalapack_descriptor(sc_desc)
if(error .NE. ELPA_OK) return
if (.not. is_already_decomposed) then
! B = U^T*U, B<-U
call self%elpa_cholesky_&
......@@ -85,7 +88,7 @@
subroutine elpa_transform_back_generalized_&
&ELPA_IMPL_SUFFIX&
&(self, b, q, sc_desc, error)
&(self, b, q, error)
implicit none
#include "general/precision_kinds.F90"
class(elpa_impl_t) :: self
......@@ -95,10 +98,13 @@
MATH_DATATYPE(kind=rck) :: b(self%local_nrows, self%local_ncols), q(self%local_nrows, self%local_ncols)
#endif
integer :: error
integer :: sc_desc(9)
integer :: sc_desc(SC_DESC_LEN)
call self%timer_start("transform_back_generalized()")
error = self%construct_scalapack_descriptor(sc_desc)
if(error .NE. ELPA_OK) return
!todo: part of eigenvectors only
call self%timer_start("scalapack multiply inv(U) * Q")
#ifdef WITH_MPI
......
......@@ -139,6 +139,7 @@ static const elpa_index_int_entry_t int_entries[] = {
INT_ANY_ENTRY("mpi_comm_rows", "Communicator for inter-row communication"),
INT_ANY_ENTRY("mpi_comm_cols", "Communicator for inter-column communication"),
INT_ANY_ENTRY("mpi_comm_parent", "Parent communicator"),
INT_ANY_ENTRY("blacs_context", "BLACS context"),
INT_ENTRY("solver", "Solver to use", ELPA_SOLVER_1STAGE, ELPA_AUTOTUNE_FAST, ELPA_AUTOTUNE_DOMAIN_ANY, \
number_of_solvers, solver_enumerate, solver_is_valid, elpa_solver_name),
INT_ENTRY("gpu", "Use GPU acceleration", 0, ELPA_AUTOTUNE_NOT_TUNABLE, ELPA_AUTOTUNE_DOMAIN_ANY,
......
......@@ -229,6 +229,10 @@ int main(int argc, char** argv) {
elpa_set(handle, "process_col", my_pcol, &error);
assert_elpa_ok(error);
#endif
#ifdef TEST_GENERALIZED_EIGENPROBLEM
elpa_set(handle, "blacs_context", my_blacs_ctxt, &error);
assert_elpa_ok(error);
#endif
/* Setup */
assert_elpa_ok(elpa_setup(handle));
......@@ -259,11 +263,11 @@ int main(int argc, char** argv) {
}
#if defined(TEST_GENERALIZED_EIGENPROBLEM)
elpa_generalized_eigenvectors(handle, a, b, ev, z, sc_desc, 0, &error);
elpa_generalized_eigenvectors(handle, a, b, ev, z, 0, &error);
#if defined(TEST_GENERALIZED_DECOMP_EIGENPROBLEM)
//a = as, so that the problem can be solved again
memcpy(a, as, na_rows * na_cols * sizeof(MATRIX_TYPE));
elpa_generalized_eigenvectors(handle, a, b, ev, z, sc_desc, 1, &error);
elpa_generalized_eigenvectors(handle, a, b, ev, z, 1, &error);
#endif
#else
/* Solve EV problem */
......
......@@ -529,6 +529,10 @@ program test
assert_elpa_ok(error)
call e%set("process_col", my_pcol, error)
assert_elpa_ok(error)
#endif
#ifdef TEST_GENERALIZED_EIGENPROBLEM
call e%set("blacs_context", my_blacs_ctxt, error)
assert_elpa_ok(error)
#endif
call e%set("timings",1,error)
assert_elpa_ok(e%setup())
......@@ -631,12 +635,12 @@ program test
#if defined(TEST_GENERALIZED_DECOMP_EIGENPROBLEM)
call e%timer_start("is_already_decomposed=.false.")
#endif
call e%generalized_eigenvectors(a, b, ev, z, sc_desc, .false., error)
call e%generalized_eigenvectors(a, b, ev, z, .false., error)
#if defined(TEST_GENERALIZED_DECOMP_EIGENPROBLEM)
call e%timer_stop("is_already_decomposed=.false.")
a = as
call e%timer_start("is_already_decomposed=.true.")
call e%generalized_eigenvectors(a, b, ev, z, sc_desc, .true., error)
call e%generalized_eigenvectors(a, b, ev, z, .true., error)
call e%timer_stop("is_already_decomposed=.true.")
#endif
call e%timer_stop("e%generalized_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