Merge branch 'ofsbeta' into 'develop'

[skip-CI] Removal of "device" variable ofsbeta_d

See merge request QEF/q-e!2220
This commit is contained in:
giannozz 2024-01-09 08:34:26 +00:00
commit 556b45ecf3
7 changed files with 18 additions and 23 deletions

View File

@ -965,7 +965,7 @@ SUBROUTINE sum_bec_gpu ( ik, current_spin, ibnd_start, ibnd_end, this_bgrp_nbnd
USE control_flags, ONLY : gamma_only, tqr, offload_type
USE ions_base, ONLY : nat, ntyp => nsp, ityp
USE uspp, ONLY : nkb, becsum, ebecsum, ofsbeta, &
becsum_d, ebecsum_d, ofsbeta_d, vkb
becsum_d, ebecsum_d, vkb
USE uspp_param, ONLY : upf, nh, nhm
USE wvfct, ONLY : nbnd, wg, et, current_k
USE klist, ONLY : ngk, nkstot
@ -993,7 +993,7 @@ SUBROUTINE sum_bec_gpu ( ik, current_spin, ibnd_start, ibnd_end, this_bgrp_nbnd
attributes(DEVICE) :: auxg_d, aux_gk_d, aux_egk_d
#endif
INTEGER :: ibnd, kbnd, ibnd_loc, nbnd_loc, ibnd_begin ! counters on bands
INTEGER :: npw, ikb, jkb, ih, jh, ijh, na, np, is, js, nhnt
INTEGER :: npw, ikb, jkb, ih, jh, ijh, na, np, is, js, nhnt, offset
! counters on beta functions, atoms, atom types, spin, and auxiliary vars
!
REAL(DP), ALLOCATABLE :: becp_d_r_d(:,:)
@ -1093,12 +1093,13 @@ SUBROUTINE sum_bec_gpu ( ik, current_spin, ibnd_start, ibnd_end, this_bgrp_nbnd
! sum over bands: \sum_i <psi_i|beta_l><beta_m|psi_i> w_i
! copy into aux1, aux2 the needed data to perform a GEMM
!
offset = ofsbeta(na)
IF ( noncolin ) THEN
!
!$cuf kernel do(2)
DO is = 1, npol
DO ih = 1, nhnt
ikb = ofsbeta_d(na) + ih
ikb = offset + ih
DO kbnd = 1, this_bgrp_nbnd
ibnd = ibnd_start + kbnd -1
auxk1_d(ibnd,ih+(is-1)*nhnt)= becp_d_nc_d(ikb,is,kbnd)
@ -1118,27 +1119,27 @@ SUBROUTINE sum_bec_gpu ( ik, current_spin, ibnd_start, ibnd_end, this_bgrp_nbnd
!$cuf kernel do(2)
DO ih = 1, nhnt
DO ibnd_loc = 1, nbnd_loc
ikb = ofsbeta_d(na) + ih
ikb = offset + ih
ibnd = (ibnd_start -1) + ibnd_loc + ibnd_begin - 1
auxg_d(ibnd_loc,ih) = becp_d_r_d(ikb,ibnd_loc) * wg_d(ibnd,ik)
END DO
END DO
CALL cublasDgemm ( 'N', 'N', nhnt, nhnt, nbnd_loc, &
1.0_dp, becp_d_r_d(ofsbeta(na)+1,1), nkb, &
1.0_dp, becp_d_r_d(offset+1,1), nkb, &
auxg_d, nbnd_loc, 0.0_dp, aux_gk_d, nhnt )
!
if (tqr) then
CALL using_et_d(0)
!$cuf kernel do(1)
DO ih = 1, nhnt
ikb = ofsbeta_d(na) + ih
ikb = offset + ih
DO ibnd_loc = 1, nbnd_loc
auxg_d(ibnd_loc,ih) = et_d(ibnd_loc,ik) * auxg_d(ibnd_loc,ih)
END DO
END DO
CALL cublasDgemm ( 'N', 'N', nhnt, nhnt, nbnd_loc, &
1.0_dp, becp_d_r_d(ofsbeta(na)+1,1), nkb, &
1.0_dp, becp_d_r_d(offset+1,1), nkb, &
auxg_d, nbnd_loc, 0.0_dp, aux_egk_d, nhnt )
end if
!
@ -1148,7 +1149,7 @@ SUBROUTINE sum_bec_gpu ( ik, current_spin, ibnd_start, ibnd_end, this_bgrp_nbnd
DO ih = 1, nhnt
DO kbnd = 1, this_bgrp_nbnd ! ibnd_start, ibnd_end
ibnd = ibnd_start + kbnd -1
ikb = ofsbeta_d(na) + ih
ikb = offset + ih
auxk1_d(ibnd,ih) = becp_d_k_d(ikb,kbnd)
auxk2_d(ibnd,ih) = wg_d(ibnd,ik)*becp_d_k_d(ikb,kbnd)
END DO
@ -1165,7 +1166,7 @@ SUBROUTINE sum_bec_gpu ( ik, current_spin, ibnd_start, ibnd_end, this_bgrp_nbnd
!$cuf kernel do(2)
DO ih = 1, nhnt
DO ibnd = ibnd_start, ibnd_end
ikb = ofsbeta_d(na) + ih
ikb = offset + ih
auxk2_d(ibnd,ih) = et_d(ibnd,ik)*auxk2_d(ibnd,ih)
END DO
END DO

View File

@ -30,7 +30,7 @@ subroutine init_us_1( nat, ityp, omega, qmax, intra_bgrp_comm )
USE uspp, ONLY : nhtol, nhtoj, nhtolm, ijtoh, dvan, qq_at, qq_nt, indv, &
ap, aainit, qq_so, dvan_so, okvan, ofsbeta, &
nhtol_d, nhtoj_d, ijtoh_d, dvan_d, &
qq_nt_d, indv_d, dvan_so_d, ofsbeta_d
qq_nt_d, indv_d, dvan_so_d
USE uspp_param, ONLY : upf, lmaxq, nh, nhm, lmaxkb, nsp
USE upf_spinorb, ONLY : is_spinorbit, rot_ylm, fcoef, lmaxx, &
transform_qq_so
@ -274,7 +274,6 @@ subroutine init_us_1( nat, ityp, omega, qmax, intra_bgrp_comm )
dvan_d=dvan
endif
endif
ofsbeta_d=ofsbeta
!
#endif
call stop_clock ('init_us_1')

View File

@ -51,7 +51,7 @@ CONTAINS
!! MPI communicator, to split the workload
INTEGER, INTENT(OUT) :: ierr
!! error code: ierr = 0 if interpolation table (IT) was allocated
!! ierr =-1 if IT had insufficent dimension and was re-allocated
!! ierr =-1 if IT had insufficient dimension and was re-allocated
!! ierr =-2 if IT was already present and nothing is done
!! ierr =-3 if IT not needed and nothing is done
REAL(dp), INTENT(IN) :: omega

View File

@ -53,7 +53,7 @@ CONTAINS
!! MPI communicator, to split the workload
INTEGER, INTENT(OUT) :: ierr
!! return code: ierr = 0 if interpolation table (IT) was allocated
!! ierr =-1 if IT had insufficent dimension and was re-allocated
!! ierr =-1 if IT had insufficient dimension and was re-allocated
!! ierr =-2 if IT was already present and nothing is done
REAL(dp), INTENT(IN) :: qmax_
!! Interpolate q up to qmax_ (sqrt(Ry), q^2 is an energy)

View File

@ -54,7 +54,7 @@ CONTAINS
!! MPI communicator, to split the workload
INTEGER, INTENT(OUT) :: ierr
!! return code: ierr = 0 if interpolation table (IT) was allocated
!! ierr =-1 if IT had insufficent dimension and was re-allocated
!! ierr =-1 if IT had insufficient dimension and was re-allocated
!! ierr =-2 if IT was already present and nothing is done
REAL(dp), INTENT(IN) :: qmax_
!! Interpolate q up to qmax_ (sqrt(Ry), q^2 is an energy)

View File

@ -29,8 +29,7 @@ MODULE uspp
PUBLIC :: nlx, lpx, lpl, ap, aainit, indv, nhtol, nhtolm, ofsbeta, &
nkb, nkbus, vkb, dvan, deeq, qq_at, qq_nt, nhtoj, ijtoh, beta, &
becsum, ebecsum
PUBLIC :: indv_d, nhtol_d, ofsbeta_d, &
dvan_d, qq_nt_d, nhtoj_d, ijtoh_d, becsum_d, ebecsum_d
PUBLIC :: indv_d, nhtol_d, dvan_d, qq_nt_d, nhtoj_d, ijtoh_d, becsum_d, ebecsum_d
PUBLIC :: okvan, nlcc_any
PUBLIC :: qq_so, dvan_so, deeq_nc, fcoef
PUBLIC :: dvan_so_d
@ -65,9 +64,8 @@ MODULE uspp
INTEGER, ALLOCATABLE :: indv_d(:,:)
INTEGER, ALLOCATABLE :: nhtol_d(:,:)
INTEGER, ALLOCATABLE :: ijtoh_d(:,:,:)
INTEGER, ALLOCATABLE :: ofsbeta_d(:)
#if defined (__CUDA)
attributes(DEVICE) :: indv_d, nhtol_d, ijtoh_d, ofsbeta_d
attributes(DEVICE) :: indv_d, nhtol_d, ijtoh_d
#endif
LOGICAL :: &
@ -379,7 +377,6 @@ CONTAINS
endif
!
endif
allocate( ofsbeta_d(nat) )
!
endif
!
@ -432,7 +429,6 @@ CONTAINS
IF( ALLOCATED( indv_d ) ) DEALLOCATE( indv_d )
IF( ALLOCATED( nhtol_d ) ) DEALLOCATE( nhtol_d )
IF( ALLOCATED( ijtoh_d ) ) DEALLOCATE( ijtoh_d )
IF( ALLOCATED( ofsbeta_d)) DEALLOCATE( ofsbeta_d )
IF( ALLOCATED( becsum_d ) ) DEALLOCATE( becsum_d )
IF( ALLOCATED( ebecsum_d ) ) DEALLOCATE( ebecsum_d )
IF( ALLOCATED( dvan_d ) ) DEALLOCATE( dvan_d )

View File

@ -1,5 +1,5 @@
!
! Copyright (C) 2023 Quantum ESPRESSO group
! Copyright (C) 2023 Quantum ESPRESSO Foundation
! This file is distributed under the terms of the
! GNU General Public License. See the file `License'
! in the root directory of the present distribution,
@ -52,7 +52,6 @@ CONTAINS
!! correct G=0 limit, is stored into tab_vloc(0,n)
!! Atomic Ry units everywhere.
!
USE upf_const, ONLY : fpi, e2
USE atom, ONLY : rgrid, msh
USE uspp_param, ONLY : upf, nsp
USE mp, ONLY : mp_sum
@ -67,7 +66,7 @@ CONTAINS
INTEGER, INTENT(OUT) :: ierr
!! error code: ierr = 1 if modified Coulomb not implemented
!! ierr = 0 if interpolation table (IT) was allocated
!! ierr =-1 if IT had insufficent dimension and was re-allocated
!! ierr =-1 if IT had insufficient dimension and was re-allocated
!! ierr =-2 if IT was already present and nothing is done
REAL(dp), INTENT(IN) :: omega
!! Unit-cell volume