patch for FORD comments

This commit is contained in:
Oscar Baseggio 2021-11-10 10:44:54 +01:00
parent 993f7297f1
commit 430bff52a2
17 changed files with 1083 additions and 562 deletions

View File

@ -13,29 +13,39 @@
SUBROUTINE laxlib_cdiaghg( n, m, h, s, ldh, e, v, me_bgrp, root_bgrp, intra_bgrp_comm )
!----------------------------------------------------------------------------
!
! ... calculates eigenvalues and eigenvectors of the generalized problem
! ... Hv=eSv, with H hermitean matrix, S overlap matrix.
! ... On output both matrix are unchanged
!
! ... LAPACK version - uses both ZHEGV and ZHEGVX
!! Called by diaghg interface.
!! Calculates eigenvalues and eigenvectors of the generalized problem.
!! Solve Hv = eSv, with H symmetric matrix, S overlap matrix.
!! complex matrices version.
!! On output both matrix are unchanged.
!!
!! LAPACK version - uses both ZHEGV and ZHEGVX
!!
!
USE laxlib_parallel_include
IMPLICIT NONE
INCLUDE 'laxlib_kinds.fh'
include 'laxlib_kinds.fh'
!
INTEGER, INTENT(IN) :: n, m, ldh
! dimension of the matrix to be diagonalized
! number of eigenstates to be calculate
! leading dimension of h, as declared in the calling pgm unit
COMPLEX(DP), INTENT(INOUT) :: h(ldh,n), s(ldh,n)
! actually intent(in) but compilers don't know and complain
! matrix to be diagonalized
! overlap matrix
INTEGER, INTENT(IN) :: n
!! dimension of the matrix to be diagonalized
INTEGER, INTENT(IN) :: m
!! number of eigenstates to be calculated
INTEGER, INTENT(IN) :: ldh
!! leading dimension of h, as declared in the calling pgm unit
COMPLEX(DP), INTENT(INOUT) :: h(ldh,n)
!! matrix to be diagonalized
COMPLEX(DP), INTENT(INOUT) :: s(ldh,n)
!! overlap matrix
REAL(DP), INTENT(OUT) :: e(n)
! eigenvalues
!! eigenvalues
COMPLEX(DP), INTENT(OUT) :: v(ldh,m)
! eigenvectors (column-wise)
INTEGER, INTENT(IN) :: me_bgrp, root_bgrp, intra_bgrp_comm
!! eigenvectors (column-wise)
INTEGER, INTENT(IN) :: me_bgrp
!! index of the processor within a band group
INTEGER, INTENT(IN) :: root_bgrp
!! index of the root processor within a band group
INTEGER, INTENT(IN) :: intra_bgrp_comm
!! intra band group communicator
!
INTEGER :: lwork, nb, mm, info, i, j
! mm = number of calculated eigenvectors
@ -197,11 +207,14 @@ END SUBROUTINE laxlib_cdiaghg
!----------------------------------------------------------------------------
SUBROUTINE laxlib_cdiaghg_gpu( n, m, h_d, s_d, ldh, e_d, v_d, me_bgrp, root_bgrp, intra_bgrp_comm)
!----------------------------------------------------------------------------
!
! ... calculates eigenvalues and eigenvectors of the generalized problem
! ... Hv=eSv, with H hermitean matrix, S overlap matrix.
! ... On output both matrix are unchanged
!
!!
!! Called by diaghg interface.
!! Calculates eigenvalues and eigenvectors of the generalized problem
!! Solve Hv = eSv, with H symmetric matrix, S overlap matrix.
!! complex matrices version.
!! On output both matrix are unchanged.
!!
!! GPU VERSION.
!
#if defined(_OPENMP)
USE omp_lib
@ -231,25 +244,32 @@ SUBROUTINE laxlib_cdiaghg_gpu( n, m, h_d, s_d, ldh, e_d, v_d, me_bgrp, root_bgrp
#endif
!
IMPLICIT NONE
INCLUDE 'laxlib_kinds.fh'
include 'laxlib_kinds.fh'
!
INTEGER, INTENT(IN) :: n, m, ldh
! dimension of the matrix to be diagonalized
! number of eigenstates to be calculate
! leading dimension of h, as declared in the calling pgm unit
COMPLEX(DP), INTENT(INOUT) :: h_d(ldh,n), s_d(ldh,n)
! actually intent(in) but compilers don't know and complain
! matrix to be diagonalized, allocated on the GPU
! overlap matrix, allocated on the GPU
INTEGER, INTENT(IN) :: n
!! dimension of the matrix to be diagonalized
INTEGER, INTENT(IN) :: m
!! number of eigenstates to be calculated
INTEGER, INTENT(IN) :: ldh
!! leading dimension of h, as declared in the calling pgm unit
COMPLEX(DP), INTENT(INOUT) :: h_d(ldh,n)
!! matrix to be diagonalized, allocated on the GPU
COMPLEX(DP), INTENT(INOUT) :: s_d(ldh,n)
!! overlap matrix, allocated on the GPU
REAL(DP), INTENT(OUT) :: e_d(n)
! eigenvalues, , allocated on the GPU
!! eigenvalues, , allocated on the GPU
COMPLEX(DP), INTENT(OUT) :: v_d(ldh,n)
! eigenvectors (column-wise), , allocated on the GPU
! NB: the dimension of v_d this is different from cdiaghg !!
!! eigenvectors (column-wise), , allocated on the GPU
INTEGER, INTENT(IN) :: me_bgrp
!! index of the processor within a band group
INTEGER, INTENT(IN) :: root_bgrp
!! index of the root processor within a band group
INTEGER, INTENT(IN) :: intra_bgrp_comm
!! intra band group communicator
!
#if defined(__CUDA)
ATTRIBUTES(DEVICE) :: h_d, s_d, e_d, v_d
#endif
INTEGER, INTENT(IN) :: me_bgrp, root_bgrp, intra_bgrp_comm
!
INTEGER :: lwork, info
!
@ -506,11 +526,14 @@ END SUBROUTINE laxlib_cdiaghg_gpu
SUBROUTINE laxlib_pcdiaghg( n, h, s, ldh, e, v, idesc )
!----------------------------------------------------------------------------
!
! ... calculates eigenvalues and eigenvectors of the generalized problem
! ... Hv=eSv, with H hermitean matrix, S overlap matrix.
! ... On output both matrix are unchanged
!
! ... Parallel version, with full data distribution
!! Called by pdiaghg interface.
!! Calculates eigenvalues and eigenvectors of the generalized problem.
!! Solve Hv = eSv, with H symmetric matrix, S overlap matrix.
!! complex matrices version.
!! On output both matrix are unchanged.
!!
!! Parallel version with full data distribution
!!
!
USE laxlib_parallel_include
USE laxlib_descriptor, ONLY : la_descriptor, laxlib_intarray_to_desc
@ -522,24 +545,26 @@ SUBROUTINE laxlib_pcdiaghg( n, h, s, ldh, e, v, idesc )
!
IMPLICIT NONE
!
INCLUDE 'laxlib_kinds.fh'
include 'laxlib_kinds.fh'
include 'laxlib_param.fh'
include 'laxlib_mid.fh'
include 'laxlib_low.fh'
!
INTEGER, INTENT(IN) :: n, ldh
! dimension of the matrix to be diagonalized
! leading dimension of h, as declared in the calling pgm unit
COMPLEX(DP), INTENT(INOUT) :: h(ldh,ldh), s(ldh,ldh)
! actually intent(in) but compilers don't know and complain
! matrix to be diagonalized
! overlap matrix
INTEGER, INTENT(IN) :: n
!! dimension of the matrix to be diagonalized and number of eigenstates to be calculated
INTEGER, INTENT(IN) :: ldh
!! leading dimension of h, as declared in the calling pgm unit
COMPLEX(DP), INTENT(INOUT) :: h(ldh,ldh)
!! matrix to be diagonalized
COMPLEX(DP), INTENT(INOUT) :: s(ldh,ldh)
!! overlap matrix
REAL(DP), INTENT(OUT) :: e(n)
! eigenvalues
!! eigenvalues
COMPLEX(DP), INTENT(OUT) :: v(ldh,ldh)
! eigenvectors (column-wise)
!! eigenvectors (column-wise)
INTEGER, INTENT(IN) :: idesc(LAX_DESC_SIZE)
!
!! laxlib descriptor
!
TYPE(la_descriptor) :: desc
!
INTEGER, PARAMETER :: root = 0

View File

@ -24,11 +24,13 @@ MODULE LAXlib
SUBROUTINE cdiaghg_cpu_( n, m, h, s, ldh, e, v, me_bgrp, root_bgrp, intra_bgrp_comm, offload )
!----------------------------------------------------------------------------
!
! ... calculates eigenvalues and eigenvectors of the generalized problem
! ... Hv=eSv, with H hermitean matrix, S overlap matrix.
! ... On output both matrix are unchanged
!
! ... LAPACK version - uses both ZHEGV and ZHEGVX
!! Called by diaghg interface.
!! Calculates eigenvalues and eigenvectors of the generalized problem.
!! Solve Hv = eSv, with H symmetric matrix, S overlap matrix.
!! complex matrices version.
!! On output both matrix are unchanged.
!!
!! LAPACK version - uses both ZHEGV and ZHEGVX
!
#if defined (__CUDA)
USE cudafor
@ -37,22 +39,28 @@ MODULE LAXlib
IMPLICIT NONE
include 'laxlib_kinds.fh'
!
INTEGER, INTENT(IN) :: n, m, ldh
! dimension of the matrix to be diagonalized
! number of eigenstates to be calculate
! leading dimension of h, as declared in the calling pgm unit
COMPLEX(DP), INTENT(INOUT) :: h(ldh,n), s(ldh,n)
! actually intent(in) but compilers don't know and complain
! matrix to be diagonalized
! overlap matrix
INTEGER, INTENT(IN) :: n
!! dimension of the matrix to be diagonalized
INTEGER, INTENT(IN) :: m
!! number of eigenstates to be calculated
INTEGER, INTENT(IN) :: ldh
!! leading dimension of h, as declared in the calling pgm unit
COMPLEX(DP), INTENT(INOUT) :: h(ldh,n)
!! matrix to be diagonalized
COMPLEX(DP), INTENT(INOUT) :: s(ldh,n)
!! overlap matrix
REAL(DP), INTENT(OUT) :: e(n)
! eigenvalues
!! eigenvalues
COMPLEX(DP), INTENT(OUT) :: v(ldh,m)
! eigenvectors (column-wise)
INTEGER, INTENT(IN) :: me_bgrp, root_bgrp, intra_bgrp_comm
!
!! eigenvectors (column-wise)
INTEGER, INTENT(IN) :: me_bgrp
!! index of the processor within a band group
INTEGER, INTENT(IN) :: root_bgrp
!! index of the root processor within a band group
INTEGER, INTENT(IN) :: intra_bgrp_comm
!! intra band group communicator
LOGICAL, OPTIONAL :: offload
! optionally solve the eigenvalue problem on the GPU
!! optionally solve the eigenvalue problem on the GPU
LOGICAL :: loffload
!
#if defined(__CUDA)
@ -96,33 +104,42 @@ MODULE LAXlib
SUBROUTINE cdiaghg_gpu_( n, m, h_d, s_d, ldh, e_d, v_d, me_bgrp, root_bgrp, intra_bgrp_comm, onhost )
!----------------------------------------------------------------------------
!
! ... calculates eigenvalues and eigenvectors of the generalized problem
! ... Hv=eSv, with H hermitean matrix, S overlap matrix.
! ... On output both matrix are unchanged
!
! ... LAPACK version - uses both ZHEGV and ZHEGVX
!! Called by diaghg interface.
!! Calculates eigenvalues and eigenvectors of the generalized problem.
!! Solve Hv = eSv, with H symmetric matrix, S overlap matrix.
!! complex matrices version.
!! On output both matrix are unchanged.
!!
!! GPU version
!!
!
USE cudafor
!
IMPLICIT NONE
include 'laxlib_kinds.fh'
!
INTEGER, INTENT(IN) :: n, m, ldh
! dimension of the matrix to be diagonalized
! number of eigenstates to be calculate
! leading dimension of h, as declared in the calling pgm unit
COMPLEX(DP), DEVICE, INTENT(INOUT) :: h_d(ldh,n), s_d(ldh,n)
! actually intent(in) but compilers don't know and complain
! matrix to be diagonalized
! overlap matrix
INTEGER, INTENT(IN) :: n
!! dimension of the matrix to be diagonalized
INTEGER, INTENT(IN) :: m
!! number of eigenstates to be calculate
INTEGER, INTENT(IN) :: ldh
!! leading dimension of h, as declared in the calling pgm unit
COMPLEX(DP), DEVICE, INTENT(INOUT) :: h_d(ldh,n)
!! matrix to be diagonalized
COMPLEX(DP), DEVICE, INTENT(INOUT) :: s_d(ldh,n)
!! overlap matrix
REAL(DP), DEVICE, INTENT(OUT) :: e_d(n)
! eigenvalues
!! eigenvalues
COMPLEX(DP), DEVICE, INTENT(OUT) :: v_d(ldh,n)
! eigenvectors (column-wise)
INTEGER, INTENT(IN) :: me_bgrp, root_bgrp, intra_bgrp_comm
! communicators
!! eigenvectors (column-wise)
INTEGER, INTENT(IN) :: me_bgrp
!! index of the processor within a band group
INTEGER, INTENT(IN) :: root_bgrp
!! index of the root processor within a band group
INTEGER, INTENT(IN) :: intra_bgrp_comm
!! intra band group communicator
LOGICAL, OPTIONAL :: onhost
! optionally solve the eigenvalue problem on the CPU
!! optionally solve the eigenvalue problem on the CPU
LOGICAL :: lonhost
!
COMPLEX(DP), ALLOCATABLE :: v(:,:), h(:,:), s(:,:)
@ -159,7 +176,14 @@ MODULE LAXlib
SUBROUTINE rdiaghg_cpu_( n, m, h, s, ldh, e, v, me_bgrp, root_bgrp, intra_bgrp_comm, offload )
!----------------------------------------------------------------------------
!
! ... general interface for rdiaghg
!! Called by diaghg interface.
!! Calculates eigenvalues and eigenvectors of the generalized problem.
!! Solve Hv = eSv, with H symmetric matrix, S overlap matrix.
!! real matrices version.
!! On output both matrix are unchanged.
!!
!! LAPACK version - uses both DSYGV and DSYGVX
!!
!
#if defined(__CUDA)
USE cudafor
@ -168,22 +192,28 @@ MODULE LAXlib
IMPLICIT NONE
include 'laxlib_kinds.fh'
!
INTEGER, INTENT(IN) :: n, m, ldh
! dimension of the matrix to be diagonalized
! number of eigenstates to be calculate
! leading dimension of h, as declared in the calling pgm unit
REAL(DP), INTENT(INOUT) :: h(ldh,n), s(ldh,n)
! actually intent(in) but compilers don't know and complain
! matrix to be diagonalized
! overlap matrix
INTEGER, INTENT(IN) :: n
!! dimension of the matrix to be diagonalized
INTEGER, INTENT(IN) :: m
!! number of eigenstates to be calculate
INTEGER, INTENT(IN) :: ldh
!! leading dimension of h, as declared in the calling pgm unit
REAL(DP), INTENT(INOUT) :: h(ldh,n)
!! matrix to be diagonalized
REAL(DP), INTENT(INOUT) :: s(ldh,n)
!! overlap matrix
REAL(DP), INTENT(OUT) :: e(n)
! eigenvalues
!! eigenvalues
REAL(DP), INTENT(OUT) :: v(ldh,m)
! eigenvectors (column-wise)
INTEGER, INTENT(IN) :: me_bgrp, root_bgrp, intra_bgrp_comm
! communicators
!! eigenvectors (column-wise)
INTEGER, INTENT(IN) :: me_bgrp
!! index of the processor within a band group
INTEGER, INTENT(IN) :: root_bgrp
!! index of the root processor within a band group
INTEGER, INTENT(IN) :: intra_bgrp_comm
!! intra band group communicator
LOGICAL, OPTIONAL :: offload
! optionally solve the eigenvalue problem on the GPU
!! optionally solve the eigenvalue problem on the GPU
LOGICAL :: loffload
!
#if defined(__CUDA)
@ -227,31 +257,44 @@ MODULE LAXlib
SUBROUTINE rdiaghg_gpu_( n, m, h_d, s_d, ldh, e_d, v_d, me_bgrp, root_bgrp, intra_bgrp_comm, onhost )
!----------------------------------------------------------------------------
!
! ... General interface to rdiaghg_gpu
!! Called by diaghg interface.
!! Calculates eigenvalues and eigenvectors of the generalized problem.
!! Solve Hv = eSv, with H symmetric matrix, S overlap matrix.
!! real matrices version.
!! On output both matrix are unchanged.
!!
!! GPU version
!!
!
USE cudafor
!
IMPLICIT NONE
include 'laxlib_kinds.fh'
!
INTEGER, INTENT(IN) :: n, m, ldh
! dimension of the matrix to be diagonalized
! number of eigenstates to be calculate
! leading dimension of h, as declared in the calling pgm unit
REAL(DP), DEVICE, INTENT(INOUT) :: h_d(ldh,n), s_d(ldh,n)
! actually intent(in) but compilers don't know and complain
! matrix to be diagonalized
! overlap matrix
INTEGER, INTENT(IN) :: n
!! dimension of the matrix to be diagonalized
INTEGER, INTENT(IN) :: m
!! number of eigenstates to be calculate
INTEGER, INTENT(IN) :: ldh
!! leading dimension of h, as declared in the calling pgm unit
REAL(DP), DEVICE, INTENT(INOUT) :: h_d(ldh,n)
!! matrix to be diagonalized
REAL(DP), DEVICE, INTENT(INOUT) :: s_d(ldh,n)
!! overlap matrix
REAL(DP), DEVICE, INTENT(OUT) :: e_d(n)
! eigenvalues
!! eigenvalues
REAL(DP), DEVICE, INTENT(OUT) :: v_d(ldh,n)
! eigenvectors (column-wise)
INTEGER, INTENT(IN) :: me_bgrp, root_bgrp, intra_bgrp_comm
! communicators
!! eigenvectors (column-wise)
INTEGER, INTENT(IN) :: me_bgrp
!! index of the processor within a band group
INTEGER, INTENT(IN) :: root_bgrp
!! index of the root processor within a band group
INTEGER, INTENT(IN) :: intra_bgrp_comm
!! intra band group communicator
LOGICAL, OPTIONAL :: onhost
! optionally solve the eigenvalue problem on the CPU
!! optionally solve the eigenvalue problem on the CPU
LOGICAL :: lonhost
!
!
REAL(DP), ALLOCATABLE :: v(:,:), h(:,:), s(:,:)
REAL(DP), ALLOCATABLE :: e(:)
!
@ -289,31 +332,35 @@ MODULE LAXlib
SUBROUTINE prdiaghg_( n, h, s, ldh, e, v, idesc, offload )
!----------------------------------------------------------------------------
!
! ... calculates eigenvalues and eigenvectors of the generalized problem
! ... Hv=eSv, with H symmetric matrix, S overlap matrix.
! ... On output both matrix are unchanged
!
! ... Parallel version with full data distribution
!! Called by pdiaghg interface.
!! Calculates eigenvalues and eigenvectors of the generalized problem.
!! Solve Hv = eSv, with H symmetric matrix, S overlap matrix.
!! real matrices version.
!! On output both matrix are unchanged.
!!
!! Parallel version with full data distribution
!!
!
IMPLICIT NONE
include 'laxlib_kinds.fh'
include 'laxlib_param.fh'
!
INTEGER, INTENT(IN) :: n, ldh
! dimension of the matrix to be diagonalized and number of eigenstates to be calculated
! leading dimension of h, as declared in the calling pgm unit
REAL(DP), INTENT(INOUT) :: h(ldh,ldh), s(ldh,ldh)
! matrix to be diagonalized
! overlap matrix
!
INTEGER, INTENT(IN) :: n
!! dimension of the matrix to be diagonalized and number of eigenstates to be calculated
INTEGER, INTENT(IN) :: ldh
!! leading dimension of h, as declared in the calling pgm unit
REAL(DP), INTENT(INOUT) :: h(ldh,ldh)
!! matrix to be diagonalized
REAL(DP), INTENT(INOUT) :: s(ldh,ldh)
!! overlap matrix
REAL(DP), INTENT(OUT) :: e(n)
! eigenvalues
!! eigenvalues
REAL(DP), INTENT(OUT) :: v(ldh,ldh)
! eigenvectors (column-wise)
!! eigenvectors (column-wise)
INTEGER, INTENT(IN) :: idesc(LAX_DESC_SIZE)
!
!! laxlib descriptor
LOGICAL, OPTIONAL :: offload
! place-holder, offloading on GPU not implemented yet
!! place-holder, offloading on GPU not implemented yet
LOGICAL :: loffload
CALL laxlib_prdiaghg( n, h, s, ldh, e, v, idesc)
@ -323,32 +370,35 @@ MODULE LAXlib
SUBROUTINE pcdiaghg_( n, h, s, ldh, e, v, idesc, offload )
!----------------------------------------------------------------------------
!
! ... calculates eigenvalues and eigenvectors of the generalized problem
! ... Hv=eSv, with H symmetric matrix, S overlap matrix.
! ... On output both matrix are unchanged
!
! ... Parallel version with full data distribution
!
!! Called by pdiaghg interface.
!! Calculates eigenvalues and eigenvectors of the generalized problem.
!! Solve Hv = eSv, with H symmetric matrix, S overlap matrix.
!! complex matrices version.
!! On output both matrix are unchanged.
!!
!! Parallel version with full data distribution
!!
!
IMPLICIT NONE
include 'laxlib_kinds.fh'
include 'laxlib_param.fh'
!
INTEGER, INTENT(IN) :: n, ldh
! dimension of the matrix to be diagonalized and number of eigenstates to be calculated
! leading dimension of h, as declared in the calling pgm unit
COMPLEX(DP), INTENT(INOUT) :: h(ldh,ldh), s(ldh,ldh)
! matrix to be diagonalized
! overlap matrix
!
INTEGER, INTENT(IN) :: n
!! dimension of the matrix to be diagonalized and number of eigenstates to be calculated
INTEGER, INTENT(IN) :: ldh
!! leading dimension of h, as declared in the calling pgm unit
COMPLEX(DP), INTENT(INOUT) :: h(ldh,ldh)
!! matrix to be diagonalized
COMPLEX(DP), INTENT(INOUT) :: s(ldh,ldh)
!! overlap matrix
REAL(DP), INTENT(OUT) :: e(n)
! eigenvalues
!! eigenvalues
COMPLEX(DP), INTENT(OUT) :: v(ldh,ldh)
! eigenvectors (column-wise)
!! eigenvectors (column-wise)
INTEGER, INTENT(IN) :: idesc(LAX_DESC_SIZE)
!
!! laxlib descriptor
LOGICAL, OPTIONAL :: offload
! place-holder, offloading on GPU not implemented yet
!! place-holder, offloading on GPU not implemented yet
LOGICAL :: loffload
CALL laxlib_pcdiaghg( n, h, s, ldh, e, v, idesc)
@ -360,33 +410,37 @@ MODULE LAXlib
SUBROUTINE prdiaghg__gpu( n, h_d, s_d, ldh, e_d, v_d, idesc, onhost )
!----------------------------------------------------------------------------
!
! ... calculates eigenvalues and eigenvectors of the generalized problem
! ... Hv=eSv, with H symmetric matrix, S overlap matrix.
! ... On output both matrix are unchanged
!
! ... Parallel version with full data distribution
!! Called by pdiaghg interface.
!! Calculates eigenvalues and eigenvectors of the generalized problem.
!! Solve Hv = eSv, with H symmetric matrix, S overlap matrix.
!! real matrices version.
!! On output both matrix are unchanged.
!!
!! Parallel GPU version with full data distribution
!!
!
IMPLICIT NONE
include 'laxlib_kinds.fh'
include 'laxlib_param.fh'
!
INTEGER, INTENT(IN) :: n, ldh
! dimension of the matrix to be diagonalized and number of eigenstates to be calculated
! leading dimension of h, as declared in the calling pgm unit
REAL(DP), INTENT(INOUT), DEVICE :: h_d(ldh,ldh), s_d(ldh,ldh)
! matrix to be diagonalized
! overlap matrix
!
INTEGER, INTENT(IN) :: n
!! dimension of the matrix to be diagonalized and number of eigenstates to be calculated
INTEGER, INTENT(IN) :: ldh
!! leading dimension of h, as declared in the calling pgm unit
REAL(DP), INTENT(INOUT), DEVICE :: h_d(ldh,ldh)
!! matrix to be diagonalized
REAL(DP), INTENT(INOUT), DEVICE :: s_d(ldh,ldh)
!! overlap matrix
REAL(DP), INTENT(OUT), DEVICE :: e_d(n)
! eigenvalues
!! eigenvalues
REAL(DP), INTENT(OUT), DEVICE :: v_d(ldh,ldh)
! eigenvectors (column-wise)
!! eigenvectors (column-wise)
INTEGER, INTENT(IN) :: idesc(LAX_DESC_SIZE)
!
!! laxlib descriptor
LOGICAL, OPTIONAL :: onhost
! place-holder, prdiaghg on GPU not implemented yet
!! place-holder, prdiaghg on GPU not implemented yet
LOGICAL :: lonhost
!
!
REAL(DP), ALLOCATABLE :: v(:,:), h(:,:), s(:,:)
REAL(DP), ALLOCATABLE :: e(:)
@ -401,31 +455,34 @@ MODULE LAXlib
SUBROUTINE pcdiaghg__gpu( n, h_d, s_d, ldh, e_d, v_d, idesc, onhost )
!----------------------------------------------------------------------------
!
! ... calculates eigenvalues and eigenvectors of the generalized problem
! ... Hv=eSv, with H symmetric matrix, S overlap matrix.
! ... On output both matrix are unchanged
!
! ... Parallel version with full data distribution
!! Called by pdiaghg interface.
!! Calculates eigenvalues and eigenvectors of the generalized problem.
!! Solve Hv = eSv, with H symmetric matrix, S overlap matrix.
!! complex matrices version.
!! On output both matrix are unchanged.
!!
!! Parallel GPU version with full data distribution
!
IMPLICIT NONE
include 'laxlib_kinds.fh'
include 'laxlib_param.fh'
!
INTEGER, INTENT(IN) :: n, ldh
! dimension of the matrix to be diagonalized and number of eigenstates to be calculated
! leading dimension of h, as declared in the calling pgm unit
COMPLEX(DP), INTENT(INOUT), DEVICE :: h_d(ldh,ldh), s_d(ldh,ldh)
! matrix to be diagonalized
! overlap matrix
!
INTEGER, INTENT(IN) :: n
!! dimension of the matrix to be diagonalized and number of eigenstates to be calculated
INTEGER, INTENT(IN) :: ldh
!! leading dimension of h, as declared in the calling pgm unit
COMPLEX(DP), INTENT(INOUT), DEVICE :: h_d(ldh,ldh)
!! matrix to be diagonalized
COMPLEX(DP), INTENT(INOUT), DEVICE :: s_d(ldh,ldh)
!! overlap matrix
REAL(DP), INTENT(OUT), DEVICE :: e_d(n)
! eigenvalues
!! eigenvalues
COMPLEX(DP), INTENT(OUT), DEVICE :: v_d(ldh,ldh)
! eigenvectors (column-wise)
!! eigenvectors (column-wise)
INTEGER, INTENT(IN) :: idesc(LAX_DESC_SIZE)
!
!! laxlib descriptor
LOGICAL, OPTIONAL :: onhost
! place-holder, pcdiaghg on GPU not implemented yet
!! place-holder, pcdiaghg on GPU not implemented yet
LOGICAL :: lonhost
!
COMPLEX(DP), ALLOCATABLE :: v(:,:), h(:,:), s(:,:)

View File

@ -14,7 +14,7 @@ MODULE laxlib_parallel_include
#if defined (__MPI_MODULE)
USE mpi
#else
INCLUDE 'mpif.h'
include 'mpif.h'
#endif
#else
! dummy world and null communicator

View File

@ -19,23 +19,40 @@
! Remember here we use square matrixes block distributed on a square grid of processors
!
TYPE la_descriptor
INTEGER :: ir = 0 ! global index of the first row in the local block of the distributed matrix
INTEGER :: nr = 0 ! number of row in the local block of the distributed matrix
INTEGER :: ic = 0 ! global index of the first column in the local block of the distributed matrix
INTEGER :: nc = 0 ! number of column in the local block of the distributed matrix
INTEGER :: nrcx = 0 ! leading dimension of the distribute matrix (greather than nr and nc)
INTEGER :: active_node = 0 ! if > 0 the proc holds a block of the lambda matrix
INTEGER :: n = 0 ! global dimension of the matrix
INTEGER :: nx = 0 ! global leading dimension ( >= n )
INTEGER :: npr = 0 ! number of row processors
INTEGER :: npc = 0 ! number of column processors
INTEGER :: myr = 0 ! processor row index
INTEGER :: myc = 0 ! processor column index
INTEGER :: comm = 0 ! communicator
INTEGER :: cntx =-1 ! scalapack context
INTEGER :: mype = 0 ! processor index ( from 0 to desc( la_npr_ ) * desc( la_npc_ ) - 1 )
INTEGER :: nrl = 0 ! number of local rows, when the matrix rows are cyclically distributed across proc
INTEGER :: nrlx = 0 ! leading dimension, when the matrix is distributed by row
INTEGER :: ir = 0
!! global index of the first row in the local block of the distributed matrix
INTEGER :: nr = 0
!! number of row in the local block of the distributed matrix
INTEGER :: ic = 0
!! global index of the first column in the local block of the distributed matrix
INTEGER :: nc = 0
!! number of column in the local block of the distributed matrix
INTEGER :: nrcx = 0
!! leading dimension of the distribute matrix (greather than nr and nc)
INTEGER :: active_node = 0
!! if > 0 the proc holds a block of the lambda matrix
INTEGER :: n = 0
!! global dimension of the matrix
INTEGER :: nx = 0
!! global leading dimension ( >= n )
INTEGER :: npr = 0
!! number of row processors
INTEGER :: npc = 0
!! number of column processors
INTEGER :: myr = 0
!! processor row index
INTEGER :: myc = 0
!! processor column index
INTEGER :: comm = 0
!! communicator
INTEGER :: cntx =-1
!! scalapack context
INTEGER :: mype = 0
!! processor index ( from 0 to desc( la_npr_ ) * desc( la_npc_ ) - 1 )
INTEGER :: nrl = 0
!! number of local rows, when the matrix rows are cyclically distributed across proc
INTEGER :: nrlx = 0
!! leading dimension, when the matrix is distributed by row
END TYPE
!
CONTAINS

File diff suppressed because it is too large Load Diff

View File

@ -8,30 +8,41 @@
!
!----------------------------------------------------------------------------
SUBROUTINE laxlib_rdiaghg( n, m, h, s, ldh, e, v, me_bgrp, root_bgrp, intra_bgrp_comm )
!----------------------------------------------------------------------------
! ... Hv=eSv, with H symmetric matrix, S overlap matrix.
! ... On output both matrix are unchanged
!
! ... LAPACK version - uses both DSYGV and DSYGVX
!!----------------------------------------------------------------------------
!!
!! Called by diaghg interface.
!! Calculates eigenvalues and eigenvectors of the generalized problem.
!! Solve Hv = eSv, with H symmetric matrix, S overlap matrix.
!! real matrices version.
!! On output both matrix are unchanged.
!!
!! LAPACK version - uses both DSYGV and DSYGVX
!
USE laxlib_parallel_include
!
IMPLICIT NONE
INCLUDE 'laxlib_kinds.fh'
!
INTEGER, INTENT(IN) :: n, m, ldh
! dimension of the matrix to be diagonalized
! number of eigenstates to be calculated
! leading dimension of h, as declared in the calling pgm unit
REAL(DP), INTENT(INOUT) :: h(ldh,n), s(ldh,n)
! matrix to be diagonalized
! overlap matrix
include 'laxlib_kinds.fh'
!
INTEGER, INTENT(IN) :: n
!! dimension of the matrix to be diagonalized
INTEGER, INTENT(IN) :: m
!! number of eigenstates to be calculated
INTEGER, INTENT(IN) :: ldh
!! leading dimension of h, as declared in the calling pgm unit
REAL(DP), INTENT(INOUT) :: h(ldh,n)
!! matrix to be diagonalized
REAL(DP), INTENT(INOUT) :: s(ldh,n)
!! overlap matrix
REAL(DP), INTENT(OUT) :: e(n)
! eigenvalues
!! eigenvalues
REAL(DP), INTENT(OUT) :: v(ldh,m)
! eigenvectors (column-wise)
INTEGER, INTENT(IN) :: me_bgrp, root_bgrp, intra_bgrp_comm
!! eigenvectors (column-wise)
INTEGER, INTENT(IN) :: me_bgrp
!! index of the processor within a band group
INTEGER, INTENT(IN) :: root_bgrp
!! index of the root processor within a band group
INTEGER, INTENT(IN) :: intra_bgrp_comm
!! intra band group communicator
!
INTEGER :: lwork, nb, mm, info, i, j
! mm = number of calculated eigenvectors
@ -177,8 +188,14 @@ END SUBROUTINE laxlib_rdiaghg
!----------------------------------------------------------------------------
SUBROUTINE laxlib_rdiaghg_gpu( n, m, h_d, s_d, ldh, e_d, v_d, me_bgrp, root_bgrp, intra_bgrp_comm )
!----------------------------------------------------------------------------
! ... Hv=eSv, with H symmetric matrix, S overlap matrix.
! ... On output both matrix are unchanged
!!
!! Called by diaghg interface.
!! Calculates eigenvalues and eigenvectors of the generalized problem
!! Solve Hv = eSv, with H symmetric matrix, S overlap matrix.
!! real matrices version.
!! On output both matrix are unchanged.
!!
!! GPU VERSION.
!
#if defined(_OPENMP)
USE omp_lib
@ -205,24 +222,31 @@ SUBROUTINE laxlib_rdiaghg_gpu( n, m, h_d, s_d, ldh, e_d, v_d, me_bgrp, root_bgrp
#endif
!
IMPLICIT NONE
INCLUDE 'laxlib_kinds.fh'
!
INTEGER, INTENT(IN) :: n, m, ldh
! dimension of the matrix to be diagonalized
! number of eigenstates to be calculated
! leading dimension of h, as declared in the calling pgm unit
REAL(DP), INTENT(INOUT) :: h_d(ldh,n), s_d(ldh,n)
! matrix to be diagonalized, allocated on the device
! overlap matrix, allocated on the device
include 'laxlib_kinds.fh'
!
INTEGER, INTENT(IN) :: n
!! dimension of the matrix to be diagonalized
INTEGER, INTENT(IN) :: m
!! number of eigenstates to be calculated
INTEGER, INTENT(IN) :: ldh
!! leading dimension of h, as declared in the calling pgm unit
REAL(DP), INTENT(INOUT) :: h_d(ldh,n)
!! matrix to be diagonalized, allocated on the device
REAL(DP), INTENT(INOUT) :: s_d(ldh,n)
!! overlap matrix, allocated on the device
REAL(DP), INTENT(OUT) :: e_d(n)
! eigenvalues, allocated on the device
!! eigenvalues, allocated on the device
REAL(DP), INTENT(OUT) :: v_d(ldh, n)
! eigenvectors (column-wise), allocated on the device
!! eigenvectors (column-wise), allocated on the device
INTEGER, INTENT(IN) :: me_bgrp
!! index of the processor within a band group
INTEGER, INTENT(IN) :: root_bgrp
!! index of the root processor within a band group
INTEGER, INTENT(IN) :: intra_bgrp_comm
!! intra band group communicator
#if defined(__CUDA)
ATTRIBUTES(DEVICE) :: h_d, s_d, e_d, v_d
#endif
INTEGER, INTENT(IN) :: me_bgrp, root_bgrp, intra_bgrp_comm
!
INTEGER :: lwork, nb, mm, info, i, j
! mm = number of calculated eigenvectors
@ -438,11 +462,14 @@ END SUBROUTINE laxlib_rdiaghg_gpu
SUBROUTINE laxlib_prdiaghg( n, h, s, ldh, e, v, idesc )
!----------------------------------------------------------------------------
!
! ... calculates eigenvalues and eigenvectors of the generalized problem
! ... Hv=eSv, with H symmetric matrix, S overlap matrix.
! ... On output both matrix are unchanged
!
! ... Parallel version with full data distribution
!! Called by pdiaghg interface.
!! Calculates eigenvalues and eigenvectors of the generalized problem.
!! Solve Hv = eSv, with H symmetric matrix, S overlap matrix.
!! real matrices version.
!! On output both matrix are unchanged.
!!
!! Parallel version with full data distribution
!!
!
USE laxlib_parallel_include
USE laxlib_descriptor, ONLY : la_descriptor, laxlib_intarray_to_desc
@ -454,24 +481,25 @@ SUBROUTINE laxlib_prdiaghg( n, h, s, ldh, e, v, idesc )
!
IMPLICIT NONE
!
INCLUDE 'laxlib_kinds.fh'
include 'laxlib_kinds.fh'
include 'laxlib_param.fh'
include 'laxlib_low.fh'
include 'laxlib_mid.fh'
!
INTEGER, INTENT(IN) :: n, ldh
! dimension of the matrix to be diagonalized and number of eigenstates to be calculated
! leading dimension of h, as declared in the calling pgm unit
REAL(DP), INTENT(INOUT) :: h(ldh,ldh), s(ldh,ldh)
! matrix to be diagonalized
! overlap matrix
!
INTEGER, INTENT(IN) :: n
!! dimension of the matrix to be diagonalized and number of eigenstates to be calculated
INTEGER, INTENT(IN) :: ldh
!! leading dimension of h, as declared in the calling pgm unit
REAL(DP), INTENT(INOUT) :: h(ldh,ldh)
!! matrix to be diagonalized
REAL(DP), INTENT(INOUT) :: s(ldh,ldh)
!! overlap matrix
REAL(DP), INTENT(OUT) :: e(n)
! eigenvalues
!! eigenvalues
REAL(DP), INTENT(OUT) :: v(ldh,ldh)
! eigenvectors (column-wise)
!! eigenvectors (column-wise)
INTEGER, INTENT(IN) :: idesc(LAX_DESC_SIZE)
!
!! laxlib descriptor
INTEGER, PARAMETER :: root = 0
INTEGER :: nx, info
! local block size

View File

@ -8,7 +8,7 @@ program test_diaghg
USE mp_bands_util, ONLY : me_bgrp, root_bgrp, intra_bgrp_comm
USE tester
IMPLICIT NONE
INCLUDE 'laxlib_kinds.fh'
include 'laxlib_kinds.fh'
!
TYPE(tester_t) :: test
INTEGER :: world_group = 0

View File

@ -8,7 +8,7 @@ program test_diaghg_2
USE mp_bands_util, ONLY : me_bgrp, root_bgrp, intra_bgrp_comm
USE tester
IMPLICIT NONE
INCLUDE 'laxlib_kinds.fh'
include 'laxlib_kinds.fh'
!
TYPE(tester_t) :: test
INTEGER :: world_group = 0

View File

@ -8,7 +8,7 @@ program test_diaghg_3
USE mp_bands_util, ONLY : me_bgrp, root_bgrp, intra_bgrp_comm
USE tester
IMPLICIT NONE
INCLUDE 'laxlib_kinds.fh'
include 'laxlib_kinds.fh'
!
TYPE(tester_t) :: test
INTEGER :: world_group = 0

View File

@ -21,8 +21,8 @@ program test_diaghg_4
USE mp_bands_util, ONLY : me_bgrp, root_bgrp, intra_bgrp_comm
USE tester
IMPLICIT NONE
INCLUDE 'laxlib_kinds.fh'
INCLUDE 'laxlib_param.fh'
include 'laxlib_kinds.fh'
include 'laxlib_param.fh'
!
TYPE(tester_t) :: test
INTEGER :: world_group = 0

View File

@ -9,7 +9,7 @@ program test_diaghg_gpu
USE mp_bands_util, ONLY : me_bgrp, root_bgrp, intra_bgrp_comm
USE tester
IMPLICIT NONE
INCLUDE 'laxlib_kinds.fh'
include 'laxlib_kinds.fh'
!
TYPE(tester_t) :: test
INTEGER :: world_group = 0

View File

@ -9,7 +9,7 @@ program test_diaghg_gpu_2
USE mp_bands_util, ONLY : me_bgrp, root_bgrp, intra_bgrp_comm
USE tester
IMPLICIT NONE
INCLUDE 'laxlib_kinds.fh'
include 'laxlib_kinds.fh'
!
TYPE(tester_t) :: test
INTEGER :: world_group = 0

View File

@ -9,7 +9,7 @@ program test_diaghg_gpu_3
USE mp_bands_util, ONLY : me_bgrp, root_bgrp, intra_bgrp_comm
USE tester
IMPLICIT NONE
INCLUDE 'laxlib_kinds.fh'
include 'laxlib_kinds.fh'
!
TYPE(tester_t) :: test
INTEGER :: world_group = 0

View File

@ -21,8 +21,8 @@ program test_diaghg_gpu_4
USE mp_bands_util, ONLY : me_bgrp, root_bgrp, intra_bgrp_comm
USE tester
IMPLICIT NONE
INCLUDE 'laxlib_kinds.fh'
INCLUDE 'laxlib_param.fh'
include 'laxlib_kinds.fh'
include 'laxlib_param.fh'
!
TYPE(tester_t) :: test
INTEGER :: world_group = 0

View File

@ -1,7 +1,7 @@
!
SUBROUTINE solve_with_zhegvd(n, v, s, ldh, e)
IMPLICIT NONE
INCLUDE 'laxlib_kinds.fh'
include 'laxlib_kinds.fh'
!
complex(DP) :: v(ldh,n)
complex(DP) :: s(ldh,n)
@ -38,7 +38,7 @@ END SUBROUTINE solve_with_zhegvd
!
SUBROUTINE solve_with_dsygvd(n, v, s, ldh, e)
IMPLICIT NONE
INCLUDE 'laxlib_kinds.fh'
include 'laxlib_kinds.fh'
!
REAL(DP) :: v(ldh,n)
REAL(DP) :: s(ldh,n)

View File

@ -1,7 +1,7 @@
MODULE test_io
!
IMPLICIT NONE
INCLUDE 'laxlib_kinds.fh'
include 'laxlib_kinds.fh'
!
INTERFACE read_problem
MODULE PROCEDURE read_cmplx_problem, read_real_problem

View File

@ -23,7 +23,7 @@
! y output matrix (m by n), the transpose of x
!
IMPLICIT NONE
INCLUDE 'laxlib_kinds.fh'
include 'laxlib_kinds.fh'
INTEGER :: ldx, ldy, n, m, what
REAL(DP) :: x(ldx, m), y(ldy, n)
@ -151,7 +151,7 @@
!
IMPLICIT NONE
INCLUDE 'laxlib_kinds.fh'
include 'laxlib_kinds.fh'
INTEGER :: ldx, ldy, n, m, what
@ -280,7 +280,7 @@
! y output matrix (m by n), the transpose of x
!
IMPLICIT NONE
INCLUDE 'laxlib_kinds.fh'
include 'laxlib_kinds.fh'
INTEGER :: ldx, ldy, n, m, what
REAL(SP) :: x(ldx, m), y(ldy, n)