LCOV - code coverage report
Current view: top level - io - eig66_mpi.F90 (source / functions) Hit Total Coverage
Test: combined.info Lines: 194 203 95.6 %
Date: 2019-09-08 04:53:50 Functions: 8 8 100.0 %

          Line data    Source code
       1             : MODULE m_eig66_mpi
       2             : #include "juDFT_env.h"
       3             :   USE m_eig66_data
       4             :   USE m_types
       5             :   USE m_judft
       6             : #ifdef CPP_MPI
       7             :   use mpi
       8             : #endif
       9             :   IMPLICIT NONE
      10             :   PRIVATE
      11             :   PUBLIC open_eig,read_eig,write_eig,close_eig,reset_eig
      12             : CONTAINS
      13             : 
      14        5211 :   SUBROUTINE priv_find_data(id,d)
      15             :     INTEGER,INTENT(IN)::id
      16             :     TYPE(t_data_mpi),POINTER,ASYNCHRONOUS:: d
      17             : 
      18             :     CLASS(t_data),POINTER   ::dp
      19        5211 :     CALL eig66_find_data(dp,id)
      20             :     SELECT TYPE(dp)
      21             :     TYPE is (t_data_mpi)
      22        5211 :        d=>dp
      23             :        CLASS default
      24           0 :        CALL judft_error("BUG: wrong datatype in eig66_mpi")
      25             :     END SELECT
      26        5211 :   END SUBROUTINE priv_find_data
      27             : 
      28             : 
      29          66 :   SUBROUTINE open_eig(id,mpi_comm,nmat,neig,nkpts,jspins,create,l_real,l_soc,l_noco,n_size_opt,filename)
      30             :     USE,INTRINSIC::iso_c_binding
      31             :     IMPLICIT NONE
      32             :     INTEGER, INTENT(IN) :: id,mpi_comm,nmat,neig,nkpts,jspins
      33             :     LOGICAL, INTENT(IN) :: l_noco,create,l_real,l_soc
      34             :     INTEGER,INTENT(IN),OPTIONAL:: n_size_opt
      35             :     CHARACTER(LEN=*),INTENT(IN),OPTIONAL :: filename
      36             : #ifdef CPP_MPI
      37             :     INTEGER:: isize,e,slot_size,local_slots
      38             :     INTEGER,PARAMETER::mcored=27 !there should not be more that 27 core states
      39             :     TYPE(t_data_MPI),POINTER,ASYNCHRONOUS :: d
      40             : 
      41          66 :     CALL priv_find_data(id,d)
      42          66 :     CALL eig66_data_storedefault(d,jspins,nkpts,nmat,neig,l_real.and..not.l_soc,l_soc)
      43             : 
      44          66 :     IF (PRESENT(n_size_opt)) d%n_size=n_size_opt
      45          66 :     IF (ALLOCATED(d%pe_ev)) THEN
      46           0 :        IF (create) CALL reset_eig(id,l_soc)
      47           0 :        IF (PRESENT(filename)) CALL judft_error("Storing of data not implemented for MPI case",calledby="eig66_mpi.F")
      48           0 :        RETURN !everything already done!
      49             :     ENDIF
      50             : 
      51          66 :     CALL timestart("create data spaces in ei66_mpi")
      52          66 :     CALL MPI_COMM_RANK(MPI_COMM,d%irank,e)
      53          66 :     CALL MPI_COMM_SIZE(MPI_COMM,isize,e)
      54             : 
      55          66 :     CALL create_maps(d,isize,nkpts,jspins,neig,d%n_size)
      56          66 :     local_slots=COUNT(d%pe_basis==d%irank)
      57             :     !Now create the windows
      58             : 
      59             :     !Window for neig
      60          66 :     slot_size=1
      61          66 :     CALL priv_create_memory(1,local_slots,d%neig_handle,d%neig_data)
      62          66 :     d%neig_data=0
      63             : 
      64             :     !The eigenvalues
      65          66 :     d%size_eig=neig
      66          66 :     CALL priv_create_memory(d%size_eig,local_slots,d%eig_handle,real_data_ptr=d%eig_data)
      67          66 :     d%eig_data=1E99
      68             :     !The w_iks
      69          66 :     CALL priv_create_memory(d%size_eig,local_slots,d%w_iks_handle,real_data_ptr=d%w_iks_data)
      70          66 :     d%w_iks_data=1E99
      71             : 
      72             :     !The eigenvectors
      73          66 :     local_slots=COUNT(d%pe_ev==d%irank)
      74          66 :     slot_size=nmat
      75          66 :     IF (l_real.AND..NOT.l_soc) THEN
      76          30 :        CALL priv_create_memory(slot_size,local_slots,d%zr_handle,real_data_ptr=d%zr_data)
      77             :     else
      78          36 :        CALL priv_create_memory(slot_size,local_slots,d%zc_handle,cmplx_data_ptr=d%zc_data)
      79             :     ENDIF
      80          66 :     IF (PRESENT(filename).AND..NOT.create) CALL judft_error("Storing of data not implemented for MPI case",calledby="eig66_mpi.F")
      81          66 :     CALL MPI_BARRIER(MPI_COMM,e)
      82          66 :     CALL timestop("create data spaces in ei66_mpi")
      83             :   CONTAINS
      84         264 :     SUBROUTINE priv_create_memory(slot_size,local_slots,handle,int_data_ptr,real_data_ptr,cmplx_data_ptr)
      85             :       IMPLICIT NONE
      86             :       INTEGER,INTENT(IN)           :: slot_size,local_slots
      87             :       INTEGER,POINTER,OPTIONAL,ASYNCHRONOUS  :: int_data_ptr(:)
      88             :       REAL   ,POINTER,OPTIONAL,ASYNCHRONOUS  :: real_data_ptr(:)
      89             :       COMPLEX,POINTER,OPTIONAL,ASYNCHRONOUS  :: cmplx_data_ptr(:)
      90             :       INTEGER,INTENT(OUT)          :: handle
      91             : #ifdef CPP_MPI
      92             :       TYPE(c_ptr)::ptr
      93             :       INTEGER:: e
      94             :       INTEGER(MPI_ADDRESS_KIND) :: length
      95             :       INTEGER                   :: type_size
      96             : 
      97         264 :       length=0   
      98         264 :       IF (present(real_data_ptr)) THEN
      99         162 :           length=length+1
     100         162 :           CALL MPI_TYPE_SIZE(MPI_DOUBLE_PRECISION,type_size,e)
     101             :       ENDIF
     102         264 :       IF (present(cmplx_data_ptr)) THEN
     103          36 :           length=length+1
     104          36 :           CALL MPI_TYPE_SIZE(MPI_DOUBLE_COMPLEX,type_size,e)
     105             :       ENDIF
     106         264 :       IF (present(int_data_ptr)) THEN 
     107          66 :           length=length+1
     108          66 :           CALL MPI_TYPE_SIZE(MPI_INTEGER,type_size,e)
     109             :       ENDIF
     110         264 :       if (length.ne.1) call judft_error("Bug in eig66_mpi:create_memory") 
     111         264 :       length=MAX(1,slot_size*local_slots)
     112             :  
     113             : #ifdef CPP_MPI_ALLOC      
     114             :       length=length*type_size
     115             :       CALL MPI_ALLOC_MEM(length,MPI_INFO_NULL,ptr,e)
     116             :       IF (e.NE.0) CPP_error("Could not allocated MPI-Data in eig66_mpi")
     117             : #endif  
     118         264 :       IF (PRESENT(real_data_ptr)) THEN
     119             : #ifdef CPP_MPI_ALLOC         
     120             :          CALL C_F_POINTER(ptr,real_data_ptr,(/length/type_size/))
     121             : #else
     122         162 :          ALLOCATE(real_data_ptr(length))
     123             : #endif         
     124         162 :         CALL MPI_WIN_CREATE(real_data_ptr, length*type_size,slot_size*type_size,Mpi_INFO_NULL, MPI_COMM,handle, e)
     125         102 :     ELSEIF(PRESENT(int_data_ptr)) THEN
     126             : #ifdef CPP_MPI_ALLOC
     127             :        CALL C_F_POINTER(ptr,int_data_ptr,(/length/type_size/))
     128             : #else
     129          66 :        ALLOCATE(int_data_ptr(length))
     130             : #endif         
     131          66 :         CALL MPI_WIN_CREATE(int_data_ptr, length*type_size,slot_size*type_size,Mpi_INFO_NULL, MPI_COMM,handle, e)
     132             :     ELSE
     133             : #ifdef CPP_MPI_ALLOC       
     134             :        CALL C_F_POINTER(ptr,cmplx_data_ptr,(/length/type_size/))
     135             : #else
     136          36 :        ALLOCATE(cmplx_data_ptr(length))
     137             : #endif   
     138          36 :        CALL MPI_WIN_CREATE(cmplx_data_ptr, length*type_size,slot_size*type_size,Mpi_INFO_NULL, MPI_COMM,handle, e)
     139             :     ENDIF
     140             : #endif
     141         264 :     END SUBROUTINE priv_create_memory
     142             : 
     143             : 
     144             : #endif
     145             :   END SUBROUTINE open_eig
     146          48 :   SUBROUTINE close_eig(id,delete,filename)
     147             :     INTEGER,INTENT(IN)         :: id
     148             :     LOGICAL,INTENT(IN),OPTIONAL:: delete
     149             :     CHARACTER(LEN=*),INTENT(IN),OPTIONAL::filename
     150             :     TYPE(t_data_MPI),POINTER,ASYNCHRONOUS :: d
     151          48 :     CALL priv_find_data(id,d)
     152             : 
     153          48 :     IF (PRESENT(delete)) THEN
     154           0 :        IF (delete) WRITE(*,*) "No deallocation of memory implemented in eig66_mpi"
     155             :     ENDIF
     156          48 :     IF (PRESENT(filename)) CALL judft_error("Storing of data not implemented for MPI case",calledby="eig66_mpi.F")
     157          48 :   END SUBROUTINE close_eig
     158             : 
     159        2750 :   SUBROUTINE read_eig(id,nk,jspin,neig,eig,w_iks,list,zmat)
     160             :     IMPLICIT NONE
     161             :     INTEGER, INTENT(IN)            :: id,nk,jspin
     162             :     INTEGER, INTENT(OUT),OPTIONAL  :: neig
     163             :     REAL,    INTENT(OUT),OPTIONAL  :: eig(:),w_iks(:)
     164             :     INTEGER, INTENT(IN),OPTIONAL   :: list(:)
     165             :     TYPE(t_mat),OPTIONAL  :: zmat
     166             : 
     167             : #ifdef CPP_MPI
     168             :     INTEGER                   :: pe,tmp_size,e
     169             :     INTEGER(MPI_ADDRESS_KIND) :: slot
     170             :     INTEGER                   :: n1,n2,n3,n
     171             :     INTEGER,ALLOCATABLE,ASYNCHRONOUS       :: tmp_int(:)
     172        2750 :     REAL,ALLOCATABLE,ASYNCHRONOUS          :: tmp_real(:)
     173        2750 :     COMPLEX,ALLOCATABLE,ASYNCHRONOUS       :: tmp_cmplx(:)
     174             :     TYPE(t_data_MPI),POINTER,ASYNCHRONOUS :: d
     175        2750 :     CALL priv_find_data(id,d)
     176        2750 :     pe=d%pe_basis(nk,jspin)
     177        2750 :     slot=d%slot_basis(nk,jspin)
     178        2750 :     IF (PRESENT(neig))THEN
     179        2674 :        CALL MPI_WIN_LOCK(MPI_LOCK_SHARED,pe,0,d%neig_handle,e)
     180             :        ! Get current values
     181        2674 :        CALL  MPI_GET(neig,1,MPI_INTEGER,pe,slot,1,MPI_INTEGER,d%neig_handle,e)
     182        2674 :        CALL MPI_WIN_UNLOCK(pe,d%neig_handle,e)
     183             :     ENDIF
     184        2750 :     IF (PRESENT(eig).or.PRESENT(w_iks)) THEN
     185         822 :        ALLOCATE(tmp_real(MIN(SIZE(eig),d%size_eig)))
     186         822 :        IF (PRESENT(eig)) THEN
     187         822 :           CALL MPI_WIN_LOCK(MPI_LOCK_SHARED,pe,0,d%eig_handle,e)
     188         822 :           CALL MPI_GET(tmp_real,SIZE(tmp_real),MPI_DOUBLE_PRECISION,pe,slot,size(tmp_real),MPI_DOUBLE_PRECISION,d%eig_handle,e)
     189         822 :           CALL MPI_WIN_UNLOCK(pe,d%eig_handle,e)
     190         822 :           eig(:size(tmp_real))=tmp_real
     191             :        END IF
     192         822 :        IF (PRESENT(w_iks)) THEN
     193           0 :           CALL MPI_WIN_LOCK(MPI_LOCK_SHARED,pe,0,d%w_iks_handle,e)
     194           0 :           CALL MPI_GET(tmp_real,size(tmp_real),MPI_DOUBLE_PRECISION,pe,slot,size(tmp_real),MPI_DOUBLE_PRECISION,d%w_iks_handle,e)
     195           0 :           CALL MPI_WIN_UNLOCK(pe,d%w_iks_handle,e)
     196           0 :           w_iks(:SIZE(tmp_real))=tmp_real
     197             :        END IF
     198         822 :        DEALLOCATE(tmp_real)
     199             :     ENDIF
     200             : 
     201        2750 :     IF (PRESENT(zmat)) THEN
     202        1928 :        tmp_size=zmat%matsize1
     203        1928 :        ALLOCATE(tmp_real(tmp_size))
     204        1928 :        ALLOCATE(tmp_cmplx(tmp_size))
     205       27996 :        DO n=1,zmat%matsize2
     206       26068 :           n1=n
     207       26068 :           IF (PRESENT(list)) THEN
     208       26068 :              IF (n>SIZE(list)) CYCLE
     209       26068 :              n1=list(n)
     210             :           END IF
     211       26068 :           slot=d%slot_ev(nk,jspin,n1)
     212       26068 :           pe=d%pe_ev(nk,jspin,n1)
     213             :           
     214       27996 :           if (zmat%l_real) THEN
     215        9236 :              if (.not.d%l_real) THEN
     216         128 :                 CALL MPI_WIN_LOCK(MPI_LOCK_SHARED,pe,0,d%zc_handle,e)
     217         128 :                 CALL MPI_GET(tmp_cmplx,tmp_size,MPI_DOUBLE_COMPLEX,pe,slot,tmp_size,MPI_DOUBLE_COMPLEX,d%zc_handle,e)
     218         128 :                 CALL MPI_WIN_UNLOCK(pe,d%zc_handle,e)
     219             :                 !print *, nk,jspin,n1,"r PE:",pe," Slot: ",slot," Size:",tmp_size,tmp_cmplx(1)
     220         128 :                 zmat%data_r(:,n)=REAL(tmp_cmplx)
     221             :              else
     222        9108 :                 CALL MPI_WIN_LOCK(MPI_LOCK_SHARED,pe,0,d%zr_handle,e)
     223        9108 :                 CALL MPI_GET(tmp_real,tmp_size,MPI_DOUBLE_PRECISION,pe,slot,tmp_size,MPI_DOUBLE_PRECISION,d%zr_handle,e)
     224        9108 :                 CALL MPI_WIN_UNLOCK(pe,d%zr_handle,e)
     225             :                 !print *, nk,jspin,n1,"r PE:",pe," Slot: ",slot," Size:",tmp_size,tmp_real(1)
     226        9108 :                 zmat%data_r(:,n)=tmp_real
     227             :              endif
     228             :           ELSE
     229       16832 :              if (d%l_real) call judft_error("Could not read complex data, only real data is stored",calledby="eig66_mpi%read_eig")
     230       16832 :              CALL MPI_WIN_LOCK(MPI_LOCK_SHARED,pe,0,d%zc_handle,e)
     231       16832 :              CALL MPI_GET(tmp_cmplx,tmp_size,MPI_DOUBLE_COMPLEX,pe,slot,tmp_size,MPI_DOUBLE_COMPLEX,d%zc_handle,e)
     232       16832 :              CALL MPI_WIN_UNLOCK(pe,d%zc_handle,e)
     233             :              !print *, nk,jspin,n1,"r PE:",pe," Slot: ",slot," Size:",tmp_size,tmp_cmplx(1)
     234       16832 :              zmat%data_c(:,n)=tmp_cmplx
     235             :           ENDIF
     236             :        ENDDO
     237             :     ENDIF
     238             : 
     239             : #endif
     240        2750 :   END SUBROUTINE read_eig
     241             : 
     242        2007 :   SUBROUTINE write_eig(id,nk,jspin,neig,neig_total,eig,w_iks,n_size,n_rank,zmat)
     243             :     INTEGER, INTENT(IN)          :: id,nk,jspin
     244             :     INTEGER, INTENT(IN),OPTIONAL :: n_size,n_rank
     245             :     INTEGER, INTENT(IN),OPTIONAL :: neig,neig_total
     246             :     REAL,    INTENT(IN),OPTIONAL :: eig(:),w_iks(:)
     247             :     TYPE(t_mat),INTENT(IN),OPTIONAL :: zmat
     248             : 
     249             : #ifdef CPP_MPI
     250             :     INTEGER                   :: pe,tmp_size,e
     251             :     INTEGER(MPI_ADDRESS_KIND) :: slot
     252             :     INTEGER                   :: n1,n2,n3,n,nn
     253        2007 :     INTEGER,ALLOCATABLE,ASYNCHRONOUS       :: tmp_int(:)
     254        2007 :     REAL,ALLOCATABLE,ASYNCHRONOUS          :: tmp_real(:)
     255        2007 :     COMPLEX,ALLOCATABLE,ASYNCHRONOUS       :: tmp_cmplx(:)
     256             :     LOGICAL                   :: acc
     257             :     TYPE(t_data_MPI),POINTER,ASYNCHRONOUS :: d
     258             : 
     259             :     INTEGER:: irank,ierr
     260             : 
     261        2007 :     CALL priv_find_data(id,d)
     262             : 
     263        2007 :     CALL MPI_COMM_RANK(MPI_COMM_WORLD,irank,ierr)
     264             : 
     265        2007 :     pe=d%pe_basis(nk,jspin)
     266        2007 :     slot=d%slot_basis(nk,jspin)
     267             :     !write the number of eigenvalues 
     268             :     !only one process needs to do it
     269        2007 :     IF (PRESENT(neig_total)) THEN
     270         819 :        CALL MPI_WIN_LOCK(MPI_LOCK_EXCLUSIVE,pe,0,d%neig_handle,e)
     271         819 :        ALLOCATE(tmp_int(1))
     272         819 :        tmp_int(1)=neig_total
     273         819 :        CALL MPI_PUT(tmp_int,1,MPI_INTEGER,pe,slot,1,MPI_INTEGER,d%neig_handle,e)
     274         819 :        CALL MPI_WIN_UNLOCK(pe,d%neig_handle,e)
     275         819 :        DEALLOCATE(tmp_int)
     276             :     ENDIF
     277             : 
     278             :     !write the eigenvalues 
     279             :     !only one process needs to do it
     280        2007 :     IF (PRESENT(eig).OR.PRESENT(w_iks)) THEN
     281        1565 :        ALLOCATE(tmp_real(d%size_eig))
     282       73305 :        tmp_real=1E99
     283        1565 :        if (PRESENT(EIG)) THEN
     284         819 :           tmp_real(:SIZE(eig)) = eig(:SIZE(eig))
     285         819 :           CALL MPI_WIN_LOCK(MPI_LOCK_EXCLUSIVE,pe,0,d%eig_handle,e)
     286         819 :           CALL MPI_PUT(tmp_real,d%size_eig,MPI_DOUBLE_PRECISION,pe,slot,d%size_eig,MPI_DOUBLE_PRECISION,d%eig_handle,e)
     287         819 :           CALL MPI_WIN_UNLOCK(pe,d%eig_handle,e)
     288             :        END if
     289        1565 :        IF (PRESENT(w_iks)) THEN
     290       30322 :           tmp_real(:size(w_iks))=w_iks
     291         746 :           CALL MPI_WIN_LOCK(MPI_LOCK_EXCLUSIVE,pe,0,d%w_iks_handle,e)
     292         746 :           CALL MPI_PUT(tmp_real,d%size_eig,MPI_DOUBLE_PRECISION,pe,slot,d%size_eig,MPI_DOUBLE_PRECISION,d%w_iks_handle,e)
     293         746 :           CALL MPI_WIN_UNLOCK(pe,d%w_iks_handle,e)
     294             :        END IF
     295        1565 :        DEALLOCATE(tmp_real)
     296             :     ENDIF
     297             : 
     298             :     !write the eigenvectors
     299             :     !all procceses participate 
     300        2007 :     IF (PRESENT(zmat)) THEN
     301        1261 :        tmp_size=zmat%matsize1
     302        1261 :        ALLOCATE(tmp_real(tmp_size))
     303        1261 :        ALLOCATE(tmp_cmplx(tmp_size))
     304       37245 :        DO n=1,zmat%matsize2
     305       36868 :           n1=n-1
     306       36868 :           IF (PRESENT(n_size)) n1=n_size*n1
     307       36868 :           IF (PRESENT(n_rank)) n1=n1+n_rank
     308       36868 :           IF (n1+1>size(d%slot_ev,3)) EXIT
     309       35984 :           slot=d%slot_ev(nk,jspin,n1+1)
     310       35984 :           pe=d%pe_ev(nk,jspin,n1+1)
     311       37245 :           IF (zmat%l_real) THEN
     312       12762 :              if (.not.d%l_real) THEN
     313         188 :                 tmp_cmplx=zmat%data_r(:,n)
     314         188 :                 CALL MPI_WIN_LOCK(MPI_LOCK_EXCLUSIVE,pe,0,d%zc_handle,e)
     315         188 :                 CALL MPI_PUT(tmp_cmplx,tmp_size,MPI_DOUBLE_COMPLEX,pe,slot,tmp_size,MPI_DOUBLE_COMPLEX,d%zc_handle,e)
     316         188 :                 CALL MPI_WIN_UNLOCK(pe,d%zc_handle,e)
     317             :                else
     318       12574 :                 tmp_real=zmat%data_r(:,n)
     319       12574 :                 CALL MPI_WIN_LOCK(MPI_LOCK_EXCLUSIVE,pe,0,d%zr_handle,e)
     320       12574 :                 CALL MPI_PUT(tmp_real,tmp_size,MPI_DOUBLE_PRECISION,pe,slot,tmp_size,MPI_DOUBLE_PRECISION,d%zr_handle,e)
     321       12574 :                 CALL MPI_WIN_UNLOCK(pe,d%zr_handle,e)
     322             :              endif
     323             :           ELSE
     324       23222 :              if (d%l_real) CALL juDFT_error("Could not write complex data to file prepared for real data",calledby="eig66_mpi%write_eig")
     325       23222 :              tmp_cmplx=zmat%data_c(:,n)
     326       23222 :              CALL MPI_WIN_LOCK(MPI_LOCK_EXCLUSIVE,pe,0,d%zc_handle,e)
     327       23222 :              CALL MPI_PUT(tmp_cmplx,tmp_size,MPI_DOUBLE_COMPLEX,pe,slot,tmp_size,MPI_DOUBLE_COMPLEX,d%zc_handle,e)
     328       23222 :              CALL MPI_WIN_UNLOCK(pe,d%zc_handle,e)
     329             :           ENDIF
     330             :        ENDDO
     331             :     ENDIF
     332             : 
     333             : #endif
     334        2007 :   END SUBROUTINE write_eig
     335             : 
     336         340 :   SUBROUTINE reset_eig(id,l_soc)
     337             :     INTEGER, INTENT(IN)        :: id
     338             :     LOGICAL, INTENT(IN)        :: l_soc
     339             : #ifdef CPP_MPI
     340             :     TYPE(t_data_MPI),POINTER,ASYNCHRONOUS :: d
     341         340 :     CALL priv_find_data(id,d)
     342             : 
     343         340 :     d%neig_data=0
     344         340 :     d%eig_data=1E99
     345         340 :     d%w_iks_data=1E99
     346         340 :     if (d%l_real.and..not.l_soc) THEN
     347     6785956 :        d%zr_data=0.0
     348             :     else
     349     7404748 :        d%zc_data=0.0
     350             :     endif
     351             : #endif
     352         340 :   END SUBROUTINE reset_eig
     353             : 
     354             : 
     355             : #ifdef CPP_MPI
     356          66 :   SUBROUTINE create_maps(d,isize,nkpts,jspins,neig,n_size)
     357             :     IMPLICIT NONE
     358             :     TYPE(t_data_MPI),INTENT(INOUT),ASYNCHRONOUS:: d
     359             :     INTEGER,INTENT(IN):: isize,nkpts,jspins,neig,n_size
     360             : 
     361             :     INTEGER:: nk,j,n1,n2,n,pe,n_members
     362         132 :     INTEGER::used(0:isize)
     363             : 
     364          66 :     ALLOCATE(d%pe_basis(nkpts,jspins),d%slot_basis(nkpts,jspins))
     365          66 :     ALLOCATE(d%pe_ev(nkpts,jspins,neig),d%slot_ev(nkpts,jspins,neig))
     366             : 
     367             :     !basis contains a total of nkpts*jspins entries
     368         160 :     d%pe_basis=-1
     369        2566 :     d%pe_ev=-1
     370         264 :     used=0
     371          66 :     n_members=isize/n_size !no of k-points in parallel
     372         160 :     DO j=1,jspins
     373         646 :        DO nk=1,nkpts
     374         580 :           n1=nk+(j-1)*nkpts-1
     375         580 :           pe=MOD(n1,n_members)*n_size
     376         580 :           d%pe_basis(nk,j)=pe
     377         580 :           d%slot_basis(nk,j)=used(pe)
     378         674 :           used(pe)=used(pe)+1
     379             :        ENDDO
     380             :     ENDDO
     381         264 :     used=0
     382        5066 :     DO n=1,neig
     383       10106 :        DO j=1,jspins
     384       53542 :           DO nk=1,nkpts
     385       23636 :              n1=nk+(j-1)*nkpts-1
     386             :              !eigenvectors have more entries
     387             :              !pe=MOD(n1,n_members)*n_size+MOD(n,n_size)
     388       23636 :              pe=MOD(n1,n_members)*n_size+MOD(n-1,n_size)
     389       23636 :              d%pe_ev(nk,j,n)=pe
     390       23636 :              d%slot_ev(nk,j,n)=used(pe)
     391       27406 :              used(pe)=used(pe)+1
     392             :           ENDDO
     393             :        ENDDO
     394             :     ENDDO
     395             : 
     396          66 :   END SUBROUTINE create_maps
     397             : #endif
     398             : 
     399       10422 : END MODULE m_eig66_mpi

Generated by: LCOV version 1.13