Commit 7802ce06 authored by Uliana Alekseeva's avatar Uliana Alekseeva

RMA synchronization added for k-point parallelization

parent 26b370bd
......@@ -134,6 +134,7 @@ CONTAINS
#ifdef CPP_MPI
INCLUDE 'mpif.h'
logical :: mpi_flag, mpi_status
#endif
! .. Local Scalars ..
TYPE(t_lapw):: lapw
......@@ -199,6 +200,7 @@ CONTAINS
TYPE (t_lo21), ALLOCATABLE :: lo21(:,:)
TYPE (t_usdus) :: usdus
TYPE (t_zMat) :: zMat
integer :: nkpt_extended
zmat%l_real=sym%invs.AND.(.NOT.noco%l_soc).AND.(.NOT.noco%l_noco)
! ..
......@@ -349,6 +351,10 @@ CONTAINS
mpi%irank,mpi%isize,jspin,dimension%jspd,&
noco%l_noco,&
ello,evac,epar,bkpt,wk,n_bands,n_size)!keep
#ifdef CPP_MPI
! Sinchronizes the RMA operations
CALL MPI_BARRIER(mpi%mpi_comm,ie)
#endif
!+lo
!---> if local orbitals are used, the eigenvector has a higher
......@@ -475,9 +481,18 @@ CONTAINS
END IF
ALLOCATE ( we(dimension%neigd) )
i_rec = 0 ; n_rank = 0
DO ikpt = 1,kpts%nkpt
! For k-point paralelization:
! the number of iterations is adjusted to the number of MPI processes to synchronize RMA operations
if (l_evp) then
nkpt_extended = kpts%nkpt
else
nkpt_extended = (kpts%nkpt / mpi%isize + 1) * mpi%isize
endif
DO ikpt = 1,nkpt_extended
i_rec = i_rec + 1
IF ((mod(i_rec-1,mpi%isize).EQ.mpi%irank).OR.l_evp) THEN
IF ( ikpt < kpts%nkpt + 1) THEN
!-t3e
we=0.0
!---> determine number of occupied bands and set weights (we)
......@@ -556,8 +571,9 @@ CONTAINS
lapw%nmat,lapw%nv,ello,evdu,epar,kveclo,&
lapw%k1,lapw%k2,lapw%k3,bkpt,wk,nbands,eig,zMat)
#ifdef CPP_MPI
! Sinchronizes the RMA operations
if (l_evp) CALL MPI_BARRIER(mpi%mpi_comm,ie)
! Synchronizes the RMA operations
!if (l_evp) CALL MPI_BARRIER(mpi%mpi_comm,ie)
CALL MPI_BARRIER(mpi%mpi_comm,ie)
#endif
!IF (l_evp.AND.(isize.GT.1)) THEN
! eig(1:noccbd) = eig(n_start:n_end)
......@@ -873,6 +889,12 @@ CONTAINS
ELSE
DEALLOCATE (zMat%z_c)
END IF
ELSE !(ikpt < nkpt + 1)
#ifdef CPP_MPI
! Synchronizes the RMA operations
CALL MPI_BARRIER(mpi%mpi_comm,ie)
#endif
END IF
END IF ! --> end "IF ((mod(i_rec-1,mpi%isize).EQ.mpi%irank).OR.l_evp) THEN"
END DO !---> end of k-point loop
DEALLOCATE (we,f,g,usdus%us,usdus%dus,usdus%duds,usdus%uds,usdus%ddn)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment