mirror of https://gitlab.com/QEF/q-e.git
ireduce => mp_sum
git-svn-id: http://qeforge.qe-forge.org/svn/q-e/trunk/espresso@2985 c92efa57-630b-4861-b058-cf58834340f0
This commit is contained in:
parent
1572664412
commit
65907aafde
|
@ -59,6 +59,8 @@ SUBROUTINE electrons()
|
|||
USE exx, ONLY : exxinit, init_h_wfc, exxenergy, exxenergy2
|
||||
USE funct, ONLY : dft_is_hybrid, exx_is_active
|
||||
#endif
|
||||
USE mp_global, ONLY : intra_pool_comm
|
||||
USE mp, ONLY : mp_sum
|
||||
!
|
||||
IMPLICIT NONE
|
||||
!
|
||||
|
@ -445,7 +447,7 @@ SUBROUTINE electrons()
|
|||
!
|
||||
ngkp(1:nks) = ngk(1:nks)
|
||||
!
|
||||
CALL ireduce( nks, ngkp )
|
||||
CALL mp_sum( ngkp(1:nks), intra_pool_comm )
|
||||
CALL ipoolrecover( ngkp, 1, nkstot, nks )
|
||||
CALL poolrecover( et, nbnd, nkstot, nks )
|
||||
!
|
||||
|
@ -906,8 +908,8 @@ SUBROUTINE electrons()
|
|||
magtot = magtot * omega / ( nr1 * nr2 * nr3 )
|
||||
absmag = absmag * omega / ( nr1 * nr2 * nr3 )
|
||||
!
|
||||
CALL reduce( 1, magtot )
|
||||
CALL reduce( 1, absmag )
|
||||
CALL mp_sum ( magtot, intra_pool_comm )
|
||||
CALL mp_sum ( absmag, intra_pool_comm )
|
||||
!
|
||||
ELSE IF ( noncolin ) THEN
|
||||
!
|
||||
|
@ -928,8 +930,8 @@ SUBROUTINE electrons()
|
|||
!
|
||||
END DO
|
||||
!
|
||||
CALL reduce( 3, magtot_nc )
|
||||
CALL reduce( 1, absmag )
|
||||
CALL mp_sum( magtot_nc, intra_pool_comm )
|
||||
CALL mp_sum( absmag, intra_pool_comm )
|
||||
!
|
||||
DO i = 1, 3
|
||||
!
|
||||
|
@ -1005,7 +1007,7 @@ SUBROUTINE electrons()
|
|||
!
|
||||
delta_e = omega * delta_e / ( nr1 * nr2 * nr3 )
|
||||
!
|
||||
CALL reduce( 1, delta_e )
|
||||
CALL mp_sum( delta_e, intra_pool_comm )
|
||||
!
|
||||
RETURN
|
||||
!
|
||||
|
@ -1038,7 +1040,7 @@ SUBROUTINE electrons()
|
|||
!
|
||||
delta_escf = omega * delta_escf / ( nr1 * nr2 * nr3 )
|
||||
!
|
||||
CALL reduce( 1, delta_escf )
|
||||
CALL mp_sum ( delta_escf, intra_pool_comm )
|
||||
!
|
||||
RETURN
|
||||
!
|
||||
|
|
|
@ -31,6 +31,8 @@ subroutine mix_potential (ndim, vout, vin, alphamix, dr2, tr2, &
|
|||
! conv true if dr2.le.tr2
|
||||
#include "f_defs.h"
|
||||
USE kinds, only : DP
|
||||
USE mp_global, ONLY : intra_pool_comm
|
||||
USE mp, ONLY : mp_sum
|
||||
implicit none
|
||||
!
|
||||
! First the dummy variables
|
||||
|
@ -75,8 +77,8 @@ subroutine mix_potential (ndim, vout, vin, alphamix, dr2, tr2, &
|
|||
dr2 = DNRM2 (ndim, vout, 1) **2
|
||||
ndimtot = ndim
|
||||
#ifdef __PARA
|
||||
call reduce (1, dr2)
|
||||
call ireduce (1, ndimtot)
|
||||
call mp_sum (dr2, intra_pool_comm)
|
||||
call mp_sum (ndimtot, intra_pool_comm)
|
||||
#endif
|
||||
dr2 = (sqrt (dr2) / ndimtot) **2
|
||||
|
||||
|
@ -138,7 +140,7 @@ subroutine mix_potential (ndim, vout, vin, alphamix, dr2, tr2, &
|
|||
enddo
|
||||
norm = (DNRM2 (ndim, df (1, ipos), 1) ) **2
|
||||
#ifdef __PARA
|
||||
call reduce (1, norm)
|
||||
call mp_sum (norm, intra_pool_comm)
|
||||
#endif
|
||||
norm = sqrt (norm)
|
||||
call DSCAL (ndim, 1.d0 / norm, df (1, ipos), 1)
|
||||
|
@ -166,7 +168,7 @@ subroutine mix_potential (ndim, vout, vin, alphamix, dr2, tr2, &
|
|||
do j = i + 1, iter_used
|
||||
beta (i, j) = w (i) * w (j) * DDOT (ndim, df (1, j), 1, df (1, i), 1)
|
||||
#ifdef __PARA
|
||||
call reduce (1, beta (i, j) )
|
||||
call mp_sum ( beta (i, j), intra_pool_comm )
|
||||
#endif
|
||||
enddo
|
||||
beta (i, i) = w0**2 + w (i) **2
|
||||
|
@ -187,7 +189,7 @@ subroutine mix_potential (ndim, vout, vin, alphamix, dr2, tr2, &
|
|||
work (i) = DDOT (ndim, df (1, i), 1, vout, 1)
|
||||
enddo
|
||||
#ifdef __PARA
|
||||
call reduce (iter_used, work)
|
||||
call mp_sum ( work(1:iter_used), intra_pool_comm )
|
||||
#endif
|
||||
!
|
||||
do n = 1, ndim
|
||||
|
|
59
PW/para.f90
59
PW/para.f90
|
@ -218,65 +218,6 @@ SUBROUTINE reduce( dim, ps )
|
|||
!
|
||||
END SUBROUTINE reduce
|
||||
!
|
||||
!----------------------------------------------------------------------------
|
||||
SUBROUTINE ireduce( dim, is )
|
||||
!----------------------------------------------------------------------------
|
||||
!
|
||||
! ... sums a distributed variable is(dim) over the processors.
|
||||
!
|
||||
USE mp_global, ONLY : intra_pool_comm, nproc_pool, npool
|
||||
USE mp, ONLY : mp_barrier
|
||||
USE parallel_include
|
||||
!
|
||||
IMPLICIT NONE
|
||||
!
|
||||
INTEGER :: dim, is(dim)
|
||||
!
|
||||
#if defined (__PARA)
|
||||
!
|
||||
INTEGER :: info, n, m, nbuf
|
||||
INTEGER, PARAMETER :: maxi = 500
|
||||
INTEGER :: buff(maxi)
|
||||
!
|
||||
!
|
||||
IF ( dim <= 0 .OR. nproc_pool <= 1 ) RETURN
|
||||
!
|
||||
! ... syncronize processes
|
||||
!
|
||||
CALL mp_barrier( intra_pool_comm )
|
||||
!
|
||||
nbuf = dim / maxi
|
||||
!
|
||||
DO n = 1, nbuf
|
||||
!
|
||||
CALL MPI_ALLREDUCE( is(1+(n-1)*maxi), buff, maxi, MPI_INTEGER, &
|
||||
MPI_SUM, intra_pool_comm, info )
|
||||
!
|
||||
CALL errore( 'ireduce', 'error in allreduce 1', info )
|
||||
!
|
||||
is((1+(n-1)*maxi):(n*maxi)) = buff(1:maxi)
|
||||
!
|
||||
END DO
|
||||
!
|
||||
! ... possible remaining elements < maxi
|
||||
!
|
||||
IF ( ( dim - nbuf * maxi ) > 0 ) THEN
|
||||
!
|
||||
CALL MPI_ALLREDUCE( is(1+nbuf*maxi), buff, (dim-nbuf*maxi), MPI_INTEGER, &
|
||||
MPI_SUM, intra_pool_comm, info )
|
||||
!
|
||||
CALL errore( 'reduce', 'error in allreduce 2', info )
|
||||
!
|
||||
is((1+nbuf*maxi):dim) = buff(1:(dim-nbuf*maxi))
|
||||
!
|
||||
END IF
|
||||
!
|
||||
#endif
|
||||
!
|
||||
RETURN
|
||||
!
|
||||
END SUBROUTINE ireduce
|
||||
!
|
||||
!------------------------------------------------------------------------
|
||||
SUBROUTINE poolreduce( dim, ps )
|
||||
!-----------------------------------------------------------------------
|
||||
|
|
|
@ -45,6 +45,8 @@ SUBROUTINE summary()
|
|||
USE fixed_occ, ONLY : f_inp, tfixed_occ
|
||||
USE wvfct, ONLY : nbnd
|
||||
USE lsda_mod, ONLY : nspin
|
||||
USE mp_global, ONLY : intra_pool_comm
|
||||
USE mp, ONLY : mp_sum
|
||||
!
|
||||
IMPLICIT NONE
|
||||
!
|
||||
|
@ -361,16 +363,14 @@ SUBROUTINE summary()
|
|||
ENDDO
|
||||
ENDIF
|
||||
ngmtot = ngm
|
||||
#ifdef __PARA
|
||||
CALL ireduce (1, ngmtot)
|
||||
#endif
|
||||
CALL mp_sum (ngmtot, intra_pool_comm)
|
||||
WRITE( stdout, '(/5x,"G cutoff =",f10.4," (", &
|
||||
& i7," G-vectors)"," FFT grid: (",i3, &
|
||||
& ",",i3,",",i3,")")') gcutm, ngmtot, nr1, nr2, nr3
|
||||
IF (doublegrid) THEN
|
||||
ngmtot = ngms
|
||||
!
|
||||
CALL ireduce (1, ngmtot)
|
||||
ngmtot = ngms
|
||||
CALL mp_sum (ngmtot, intra_pool_comm)
|
||||
!
|
||||
WRITE( stdout, '(5x,"G cutoff =",f10.4," (", &
|
||||
& i7," G-vectors)"," smooth grid: (",i3, &
|
||||
|
|
Loading…
Reference in New Issue