Commit 3c7e1972 authored by Andreas Marek's avatar Andreas Marek
Browse files

New interface: add cholesky routines

parent bfaa9da5
......@@ -32,6 +32,23 @@ typedef struct {
/** OPTIONS **/
/* wantDebug */
int wantDebug_cardinality() {
return 2;
}
const int wantDebug_enumerate_option(unsigned int n) {
return n;
}
int wantDebug_valid(elpa_options_t options, int value) {
if (value >= 0 && value < wantDebug_cardinality()) {
return ELPA_OK;
} else {
return ELPA_ERROR;
}
}
/* QR */
int qr_cardinality() {
return 2;
......@@ -123,6 +140,7 @@ int complex_kernel_valid(elpa_options_t options, int value) {
elpa_int_option_t elpa_int_options[] = {
{"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},
{"solver", ELPA_SOLVER_1STAGE, solver_cardinality, solver_enumerate_option, solver_valid},
......
......@@ -81,6 +81,10 @@ module elpa_type
elpa_multiply_ah_b_double, &
elpa_multiply_at_b_single, &
elpa_multiply_ah_b_single
generic, public :: cholesky => elpa_cholesky_real_double, &
elpa_cholesky_real_single, &
elpa_cholesky_complex_double, &
elpa_cholesky_complex_single
......@@ -89,15 +93,21 @@ module elpa_type
! privates:
procedure, private :: elpa_set_integer
procedure, private :: elpa_get_integer
procedure, private :: elpa_solve_real_double
procedure, private :: elpa_solve_real_single
procedure, private :: elpa_solve_complex_double
procedure, private :: elpa_solve_complex_single
procedure, private :: elpa_multiply_at_b_double
procedure, private :: elpa_multiply_at_b_single
procedure, private :: elpa_multiply_ah_b_double
procedure, private :: elpa_multiply_ah_b_single
procedure, private :: elpa_cholesky_real_double
procedure, private :: elpa_cholesky_real_single
procedure, private :: elpa_cholesky_complex_double
procedure, private :: elpa_cholesky_complex_single
end type elpa_t
logical :: initDone = .false.
......@@ -729,6 +739,172 @@ module elpa_type
#endif
end subroutine
subroutine elpa_cholesky_real_double (self, a, success)
use iso_c_binding
use elpa1_auxiliary_new
use precision
implicit none
class(elpa_t) :: self
!#ifdef USE_ASSUMED_SIZE
! real(kind=REAL_DATATYPE) :: a(lda,*)
!#else
real(kind=rk8) :: a(self%local_nrows,self%local_ncols)
!#endif
integer, optional :: success
logical :: success_l
integer(kind=c_int) :: success_internal
logical :: wantDebugIntern
if (self%get("wantDebug",success_internal) .eq. 1) then
if (success_internal .ne. ELPA_OK) then
print *,"Could not querry wantDebug"
stop
endif
wantDebugIntern = .true.
else
wantDebugIntern = .false.
endif
success_l = elpa_cholesky_real_double_new (self%na, a, self%local_nrows, self%nblk, &
self%local_ncols, self%mpi_comm_rows, self%mpi_comm_cols, &
wantDebugIntern)
if (present(success)) then
if (success_l) then
success = ELPA_OK
else
success = ELPA_ERROR
endif
else if (.not. success_l) then
write(error_unit,'(a)') "ELPA: Error in cholesky() and you did not check for errors!"
endif
end subroutine
subroutine elpa_cholesky_real_single (self, a, success)
use iso_c_binding
use elpa1_auxiliary_new
use precision
implicit none
class(elpa_t) :: self
!#ifdef USE_ASSUMED_SIZE
! real(kind=REAL_DATATYPE) :: a(lda,*)
!#else
real(kind=rk4) :: a(self%local_nrows,self%local_ncols)
!#endif
integer, optional :: success
logical :: success_l
integer(kind=c_int) :: success_internal
logical :: wantDebugIntern
if (self%get("wantDebug",success_internal) .eq. 1) then
if (success_internal .ne. ELPA_OK) then
print *,"Could not querry wantDebug"
stop
endif
wantDebugIntern = .true.
else
wantDebugIntern = .false.
endif
#if WANT_SINGLE_PRECISION_REAL
success_l = elpa_cholesky_real_single_new (self%na, a, self%local_nrows, self%nblk, &
self%local_ncols, self%mpi_comm_rows, self%mpi_comm_cols, &
wantDebugIntern)
#endif
if (present(success)) then
if (success_l) then
success = ELPA_OK
else
success = ELPA_ERROR
endif
else if (.not. success_l) then
write(error_unit,'(a)') "ELPA: Error in cholesky() and you did not check for errors!"
endif
end subroutine
subroutine elpa_cholesky_complex_double (self, a, success)
use iso_c_binding
use elpa1_auxiliary_new
use precision
implicit none
class(elpa_t) :: self
!#ifdef USE_ASSUMED_SIZE
! real(kind=REAL_DATATYPE) :: a(lda,*)
!#else
complex(kind=ck8) :: a(self%local_nrows,self%local_ncols)
!#endif
integer, optional :: success
logical :: success_l
integer(kind=c_int) :: success_internal
logical :: wantDebugIntern
if (self%get("wantDebug",success_internal) .eq. 1) then
if (success_internal .ne. ELPA_OK) then
print *,"Could not querry wantDebug"
stop
endif
wantDebugIntern = .true.
else
wantDebugIntern = .false.
endif
success_l = elpa_cholesky_complex_double_new (self%na, a, self%local_nrows, self%nblk, &
self%local_ncols, self%mpi_comm_rows, self%mpi_comm_cols, &
wantDebugIntern)
if (present(success)) then
if (success_l) then
success = ELPA_OK
else
success = ELPA_ERROR
endif
else if (.not. success_l) then
write(error_unit,'(a)') "ELPA: Error in cholesky() and you did not check for errors!"
endif
end subroutine
subroutine elpa_cholesky_complex_single (self, a, success)
use iso_c_binding
use elpa1_auxiliary_new
use precision
implicit none
class(elpa_t) :: self
!#ifdef USE_ASSUMED_SIZE
! real(kind=REAL_DATATYPE) :: a(lda,*)
!#else
complex(kind=ck4) :: a(self%local_nrows,self%local_ncols)
!#endif
integer, optional :: success
logical :: success_l
integer(kind=c_int) :: success_internal
logical :: wantDebugIntern
if (self%get("wantDebug",success_internal) .eq. 1) then
if (success_internal .ne. ELPA_OK) then
print *,"Could not querry wantDebug"
stop
endif
wantDebugIntern = .true.
else
wantDebugIntern = .false.
endif
#if WANT_SINGLE_PRECISION_REAL
success_l = elpa_cholesky_complex_single_new (self%na, a, self%local_nrows, self%nblk, &
self%local_ncols, self%mpi_comm_rows, self%mpi_comm_cols, &
wantDebugIntern)
#endif
if (present(success)) then
if (success_l) then
success = ELPA_OK
else
success = ELPA_ERROR
endif
else if (.not. success_l) then
write(error_unit,'(a)') "ELPA: Error in cholesky() and you did not check for errors!"
endif
end subroutine
......
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