Skip to content

Commit

Permalink
Merge pull request #133 from muralidhar-nalabothula/master
Browse files Browse the repository at this point in the history
Change default ELPA solver when running on GPUs
  • Loading branch information
sangallidavide authored Sep 9, 2024
2 parents 3ac7e23 + cef1182 commit 58e3770
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/bse/K_diago_driver.F
Original file line number Diff line number Diff line change
Expand Up @@ -252,8 +252,8 @@ subroutine K_diago_driver(iq,W,X_static)
! SL and diagonalize entire hamilitonian
! NM : BS_V_left are only referenced in non-hermitian case
! Note that in coupling case, if the user requested n values,
! This means that the we compute the first n posive and n
! negative, making it a total of 2n.
! This means that the we compute the first min(n,BS_H_dim/2) positive and
! min(n,BS_ham/2) negative eigvals and eigvectors, making it a total of 2*min(n,BS_ham/2)
!
if (.not. l_eval_range) then
! Use index range
Expand Down
18 changes: 15 additions & 3 deletions src/bse/K_diagonalize.F
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,11 @@ subroutine K_diagonalize(i_BS_mat, BS_energies, BS_VR, &
!
! Local variables
type(c_ptr) :: mpicxt, diago_mat, evecs
integer :: nProcs, my_rank, blacs_blk_size
integer :: nProcs, my_rank
integer(YDIAGO_INT) :: SL_H_dim, ProcX, ProcY, elpa_nthreads
integer(ERROR_INT) :: error_diago ! diagonalization error code
integer :: ierr, i_c, i_r !! mpi error code
integer(YDIAGO_INT) :: neig_found
integer :: ierr !! mpi error code
integer(YDIAGO_INT) :: neig_found, i_c, i_r, blacs_blk_size
integer(YDIAGO_LL_INT) :: nelements
! optional local vars with their defaults
character :: solver_type_aux = 's'
Expand Down Expand Up @@ -103,6 +103,14 @@ subroutine K_diagonalize(i_BS_mat, BS_energies, BS_VR, &
call set_elpa_gpu_str(gpu_device_elpa)
if (gpu_device_elpa(1:3) /= c_char_"not") then
gpu_str = c_loc(gpu_device_elpa)
! NM: ELPA GPU for now does not support solver type =2,
! in this case we force the solver to be type=1 (i.e standard QR)
! In future, if it works, we need to remove this.
! See https://github.com/marekandreas/elpa/blob/master/src/elpa2/elpa2_template.F90#L1742
if (elpa_solver_aux .eq. 2) then
call msg("s", 'Warning : ELPA Solver 2 is not GPU Ported. Switching to QR Solver.')
elpa_solver_aux = 1
endif
else
call msg("s", 'Warning : Ydiago not compiled with GPU. using CPU version')
gpu_str = c_null_ptr
Expand Down Expand Up @@ -187,6 +195,7 @@ subroutine K_diagonalize(i_BS_mat, BS_energies, BS_VR, &
!
endif
!
#if defined _ELPA
if (solver_type_aux .eq. 'e') then
!
call section('=','ELPA Diagonalization')
Expand All @@ -196,6 +205,9 @@ subroutine K_diagonalize(i_BS_mat, BS_energies, BS_VR, &
call section('=','Scalapack Diagonalization')
!
endif
#else
call section('=','Scalapack Diagonalization')
#endif
!
! Call the solvers
!
Expand Down

0 comments on commit 58e3770

Please sign in to comment.