GPU variables moved ordinary modules

This commit is contained in:
Andrea Ferretti 2021-02-15 18:34:07 +01:00
parent d140ff04b5
commit 4c3ea7646f
2 changed files with 20 additions and 11 deletions

View File

@ -24,6 +24,20 @@ MODULE upf_spinorb
!! transform real spherical harmonics into complex ones
COMPLEX (DP), ALLOCATABLE :: fcoef(:,:,:,:,:)
!! function needed to account for spinors.
!
! GPU vars
COMPLEX(DP), ALLOCATABLE :: fcoef_d(:,:,:,:,:)
#if defined(__CUDA)
attributes (DEVICE) :: fcoef_d
#endif
CONTAINS
SUBROUTINE deallocate_spinorb
IMPLICIT NONE
IF( ALLOCATED( fcoef ) ) DEALLOCATE( fcoef )
IF( ALLOCATED( fcoef_d ) ) DEALLOCATE( fcoef_d )
END SUBROUTINE deallocate_spinorb
END MODULE upf_spinorb

View File

@ -12,8 +12,10 @@
#if defined(__CUDA)
USE cudafor
#endif
use upf_spinorb, ONLY: fcoef_d
IMPLICIT NONE
SAVE
!
INTEGER, PARAMETER :: DP = selected_real_kind(14,200)
INTEGER, PARAMETER :: sgl = selected_real_kind(6,30)
INTEGER, PARAMETER :: i4b = selected_int_kind(9)
@ -23,12 +25,6 @@
iverbosity = 1
#endif
!
COMPLEX(DP), ALLOCATABLE :: fcoef_d(:, :, :, :, :)
!
#if defined(__CUDA)
attributes (DEVICE) :: fcoef_d
#endif
LOGICAL :: fcoef_ood = .false. ! used to flag out of date variables
LOGICAL :: fcoef_d_ood = .false. ! used to flag out of date variables
!
@ -41,7 +37,7 @@
! 1 -> inout , the variable needs to be synchronized AND will be changed
! 2 -> out , NO NEED to synchronize the variable, everything will be overwritten
!
USE upf_spinorb, ONLY : fcoef
USE upf_spinorb, ONLY : fcoef, fcoef_d
implicit none
INTEGER, INTENT(IN) :: intento
CHARACTER(len=*), INTENT(IN), OPTIONAL :: debug_info
@ -75,7 +71,7 @@
!
SUBROUTINE using_fcoef_d(intento, debug_info)
!
USE upf_spinorb, ONLY : fcoef
USE upf_spinorb, ONLY : fcoef, fcoef_d
implicit none
INTEGER, INTENT(IN) :: intento
CHARACTER(len=*), INTENT(IN), OPTIONAL :: debug_info
@ -110,10 +106,9 @@
#endif
END SUBROUTINE using_fcoef_d
!
SUBROUTINE deallocate_spin_orb_gpu
IF( ALLOCATED( fcoef_d ) ) DEALLOCATE( fcoef_d )
SUBROUTINE deallocate_spinorb_gpu
fcoef_d_ood = .false.
END SUBROUTINE deallocate_spin_orb_gpu
END SUBROUTINE deallocate_spinorb_gpu
!=----------------------------------------------------------------------------=!
END MODULE upf_spinorb_gpum
!=----------------------------------------------------------------------------=!