LCOV - code coverage report
Current view: top level - diagonalization - elpa_20180525_onenode.F90 (source / functions) Hit Total Coverage
Test: combined.info Lines: 0 2 0.0 %
Date: 2019-09-08 04:53:50 Functions: 0 1 0.0 %

          Line data    Source code
       1             : !-------------------------------------------------------------------------------
       2             : ! Copyright (c) 2016 Peter Grünberg Institut, Forschungszentrum Jülich, Germany
       3             : ! This file is part of FLEUR and available as free software under the conditions
       4             : ! of the MIT license as expressed in the LICENSE file in more detail.
       5             : !--------------------------------------------------------------------------------
       6             : 
       7             : MODULE m_elpa_onenode
       8             : CONTAINS
       9           0 :   SUBROUTINE elpa_diag_onenode(hmat,smat,ne,eig,ev)
      10             :     !
      11             :     !----------------------------------------------------
      12             :     ! Sigensystem solver 
      13             :     !  Uses the ELPA (1 node version)
      14             :     !
      15             :     !
      16             :     ! hmat ..... Hamiltonian matrix
      17             :     ! smat ..... overlap matrix
      18             :     ! ne ....... number of ev's searched (and found) on this node
      19             :     !            On input, overall number of ev's searched,
      20             :     !            On output, local number of ev's found
      21             :     ! eig ...... eigenvalues, output
      22             :     ! ev ....... eigenvectors, output
      23             :     !
      24             :     ! U.Alekseeva     Nov. 2018
      25             :     !----------------------------------------------------
      26             :     USE m_juDFT
      27             :     USE m_types_mat
      28             : #ifdef CPP_ELPA_ONENODE
      29             :     USE elpa
      30             : #endif
      31             : #ifdef CPP_GPU
      32             :     USE nvtx
      33             : #endif
      34             :     IMPLICIT NONE
      35             : 
      36             :     CLASS(t_mat),INTENT(INOUT)    :: hmat,smat
      37             :     CLASS(t_mat),ALLOCATABLE,INTENT(OUT)::ev
      38             :     REAL,INTENT(OUT)              :: eig(:)
      39             :     INTEGER,INTENT(INOUT)         :: ne
      40             :     
      41             : #ifdef CPP_ELPA_ONENODE
      42             :     !...  Local variables
      43             :     !
      44             :     INTEGER           :: err
      45             :     REAL,ALLOCATABLE  :: eig2(:)
      46             :     TYPE(t_mat)       :: ev_dist
      47             :     INTEGER           :: kernel
      48             :     CLASS(elpa_t),pointer :: elpa_obj
      49             : 
      50             : #ifdef CPP_GPU
      51             :     call nvtxStartRange("ELPA",5)    
      52             : #endif
      53             :     err = elpa_init(20180525)
      54             :     elpa_obj => elpa_allocate()
      55             :        
      56             :     ALLOCATE ( eig2(hmat%matsize1), stat=err ) ! The eigenvalue array
      57             :     IF (err.NE.0) CALL juDFT_error('Failed to allocated "eig2"', calledby ='elpa')
      58             : 
      59             :     CALL ev_dist%init(hmat)! Eigenvectors
      60             :     IF (err.NE.0) CALL juDFT_error('Failed to allocated "ev_dist"',calledby ='elpa')
      61             :        
      62             :     CALL elpa_obj%set("na", hmat%matsize1, err)
      63             :     CALL elpa_obj%set("nev", ne, err)
      64             :     CALL elpa_obj%set("local_nrows", hmat%matsize1, err)
      65             :     CALL elpa_obj%set("local_ncols", hmat%matsize2, err)
      66             :     CALL elpa_obj%set("nblk",hmat%matsize1, err)
      67             :     CALL elpa_obj%set("blacs_context", -1, err)
      68             : #ifdef CPP_GPU
      69             :     CALL elpa_obj%set("gpu",1,err)
      70             : #endif
      71             :     err = elpa_obj%setup()
      72             :     call elpa_obj%get("solver", kernel)
      73             :     print *, "elpa uses " // elpa_int_value_to_string("solver", kernel) // " solver"
      74             : 
      75             :     CALL hmat%add_transpose(hmat)       
      76             :     CALL smat%add_transpose(smat)       
      77             : 
      78             : #ifdef CPP_GPU
      79             :     call nvtxStartRange("EigVec",7)    
      80             : #endif
      81             :     IF (hmat%l_real) THEN
      82             :         CALL elpa_obj%generalized_eigenvectors(hmat%data_r,smat%data_r,eig2, ev_dist%data_r, .FALSE.,err)
      83             :     ELSE
      84             :         CALL elpa_obj%generalized_eigenvectors(hmat%data_c,smat%data_c,eig2, ev_dist%data_c, .FALSE., err)
      85             :     ENDIF
      86             : #ifdef CPP_GPU
      87             :     call nvtxEndRange!("EigVec",8)    
      88             : #endif
      89             :        
      90             :     CALL elpa_deallocate(elpa_obj)
      91             :     CALL elpa_uninit()
      92             :     ! END of ELPA stuff
      93             : 
      94             :     eig(1:ne) = eig2(1:ne)
      95             :     DEALLOCATE(eig2)
      96             :        
      97             :     ALLOCATE(t_mat::ev)
      98             :     CALL ev%alloc(hmat%l_real,hmat%matsize1,ne)
      99             :     CALL ev%copy(ev_dist,1,1)
     100             : 
     101             : #ifdef CPP_GPU
     102             :     call nvtxEndRange!("ELPA",7)    
     103             : #endif
     104             : #endif
     105             :  
     106           0 : END SUBROUTINE elpa_diag_onenode
     107             : END MODULE m_elpa_onenode

Generated by: LCOV version 1.13