mirror of https://gitlab.com/QEF/q-e.git
Calls to poolbcast replaced by calls to mp_bcast(*,MPI_COMM_ROW).
PW/broadcast.f90 PW/poolbcast.f90 removed. C.S. git-svn-id: http://qeforge.qe-forge.org/svn/q-e/trunk/espresso@707 c92efa57-630b-4861-b058-cf58834340f0
This commit is contained in:
parent
cabbea8cda
commit
492f080ce3
|
@ -192,7 +192,6 @@ PWOBJS = \
|
|||
../PW/bp_ylm_q.o \
|
||||
../PW/bp_zgedi.o \
|
||||
../PW/bp_zgefa.o \
|
||||
../PW/broadcast.o \
|
||||
../PW/c_bands.o \
|
||||
../PW/c_gemm.o \
|
||||
../PW/ccalbec.o \
|
||||
|
@ -305,7 +304,6 @@ PWOBJS = \
|
|||
../PW/ortho.o \
|
||||
../PW/orthoatwfc.o \
|
||||
../PW/para.o \
|
||||
../PW/poolbcast.o \
|
||||
../PW/poolextreme.o \
|
||||
../PW/poolrecover.o \
|
||||
../PW/poolreduce.o \
|
||||
|
|
|
@ -20,6 +20,8 @@ subroutine d3_exc
|
|||
use d3com
|
||||
#ifdef __PARA
|
||||
use para
|
||||
USE io_global, ONLY : ionode_id
|
||||
USE mp, ONLY : mp_bcast
|
||||
#endif
|
||||
implicit none
|
||||
integer :: errcode, ir, ipert, jpert, kpert, npert1, npert2
|
||||
|
@ -72,7 +74,7 @@ subroutine d3_exc
|
|||
enddo
|
||||
#ifdef __PARA
|
||||
100 continue
|
||||
call poolbcast (2 * 27 * nat * nat * nat, d3dyn1)
|
||||
CALL mp_bcast( d3dyn1, ionode_id, MPI_COMM_ROW )
|
||||
#endif
|
||||
|
||||
d3dyn = d3dyn + d3dyn1
|
||||
|
|
|
@ -29,7 +29,6 @@ PWOBJS = \
|
|||
../PW/bp_ylm_q.o \
|
||||
../PW/bp_zgedi.o \
|
||||
../PW/bp_zgefa.o \
|
||||
../PW/broadcast.o \
|
||||
../PW/c_bands.o \
|
||||
../PW/ccalbec.o \
|
||||
../PW/ccgdiagg.o \
|
||||
|
@ -140,7 +139,6 @@ PWOBJS = \
|
|||
../PW/orthoatwfc.o \
|
||||
../PW/output_tau.o \
|
||||
../PW/para.o \
|
||||
../PW/poolbcast.o \
|
||||
../PW/poolextreme.o \
|
||||
../PW/poolrecover.o \
|
||||
../PW/poolreduce.o \
|
||||
|
|
|
@ -137,7 +137,6 @@ PWOBJS = \
|
|||
../PW/bp_ylm_q.o \
|
||||
../PW/bp_zgedi.o \
|
||||
../PW/bp_zgefa.o \
|
||||
../PW/broadcast.o \
|
||||
../PW/c_bands.o \
|
||||
../PW/c_gemm.o \
|
||||
../PW/ccalbec.o \
|
||||
|
@ -250,7 +249,6 @@ PWOBJS = \
|
|||
../PW/ortho.o \
|
||||
../PW/orthoatwfc.o \
|
||||
../PW/para.o \
|
||||
../PW/poolbcast.o \
|
||||
../PW/poolextreme.o \
|
||||
../PW/poolrecover.o \
|
||||
../PW/poolreduce.o \
|
||||
|
|
|
@ -50,7 +50,6 @@ PWOBJS = \
|
|||
../PW/bp_ylm_q.o \
|
||||
../PW/bp_zgedi.o \
|
||||
../PW/bp_zgefa.o \
|
||||
../PW/broadcast.o \
|
||||
../PW/c_bands.o \
|
||||
../PW/c_gemm.o \
|
||||
../PW/ccalbec.o \
|
||||
|
@ -167,7 +166,6 @@ PWOBJS = \
|
|||
../PW/orthoatwfc.o \
|
||||
../PW/para.o \
|
||||
../PW/paw.o \
|
||||
../PW/poolbcast.o \
|
||||
../PW/poolextreme.o \
|
||||
../PW/poolrecover.o \
|
||||
../PW/poolreduce.o \
|
||||
|
|
|
@ -29,7 +29,6 @@ bp_strings.o \
|
|||
bp_ylm_q.o \
|
||||
bp_zgedi.o \
|
||||
bp_zgefa.o \
|
||||
broadcast.o \
|
||||
c_bands.o \
|
||||
c_gemm.o \
|
||||
ccalbec.o \
|
||||
|
@ -153,7 +152,6 @@ orthoatwfc.o \
|
|||
output_tau.o \
|
||||
para.o \
|
||||
paw.o \
|
||||
poolbcast.o \
|
||||
poolextreme.o \
|
||||
poolrecover.o \
|
||||
poolreduce.o \
|
||||
|
|
|
@ -1,41 +0,0 @@
|
|||
!
|
||||
! Copyright (C) 2001 PWSCF group
|
||||
! This file is distributed under the terms of the
|
||||
! GNU General Public License. See the file `License'
|
||||
! in the root directory of the present distribution,
|
||||
! or http://www.gnu.org/copyleft/gpl.txt .
|
||||
!
|
||||
!
|
||||
!-----------------------------------------------------------------------
|
||||
subroutine broadcast (ndata, data)
|
||||
!-----------------------------------------------------------------------
|
||||
!
|
||||
! this routine broadcasts the real*8 vector 'data' from the first proces
|
||||
! of each pool to all the other processors of the pool
|
||||
!
|
||||
USE kinds, only : DP
|
||||
#ifdef __PARA
|
||||
use para
|
||||
#endif
|
||||
implicit none
|
||||
! on INPUT
|
||||
integer :: ndata
|
||||
real (kind=DP) :: data (ndata)
|
||||
#ifdef __PARA
|
||||
#include "machine.h"
|
||||
include 'mpif.h'
|
||||
|
||||
integer :: root, ierr
|
||||
if (nprocp <= 1) return
|
||||
!
|
||||
! root is the "broadcasting" processors.
|
||||
! N.B. in MPI the processors are labeled from 0 to nproc-1
|
||||
!
|
||||
root = 0
|
||||
call mpi_barrier (MPI_COMM_POOL, ierr)
|
||||
call mpi_bcast (data, ndata, MPI_REAL8, root, MPI_COMM_POOL, ierr)
|
||||
call errore ('broadcast', 'info<>0', ierr)
|
||||
#endif
|
||||
return
|
||||
end subroutine broadcast
|
||||
|
170
PW/io_pot.f90
170
PW/io_pot.f90
|
@ -1,81 +1,123 @@
|
|||
!
|
||||
! Copyright (C) 2001 PWSCF group
|
||||
! Copyright (C) 2001-2004 PWSCF group
|
||||
! This file is distributed under the terms of the
|
||||
! GNU General Public License. See the file `License'
|
||||
! in the root directory of the present distribution,
|
||||
! or http://www.gnu.org/copyleft/gpl.txt .
|
||||
!
|
||||
!-----------------------------------------------------------------------
|
||||
subroutine io_pot (iop, filename, pot, nc)
|
||||
!-----------------------------------------------------------------------
|
||||
!
|
||||
! This routine reads (iop=-1) or write (iop=1) the potential
|
||||
! in real space onto a file
|
||||
!
|
||||
#include "machine.h"
|
||||
USE kinds, ONLY: DP
|
||||
USE gvect, ONLY: nrxx, nrx1, nrx2, nrx3
|
||||
#ifdef __PARA
|
||||
use para
|
||||
!
|
||||
!----------------------------------------------------------------------------
|
||||
SUBROUTINE io_pot( iop, filename, pot, nc )
|
||||
!----------------------------------------------------------------------------
|
||||
!
|
||||
! ... This routine reads (iop=-1) or write (iop=1) the potential
|
||||
! ... in real space onto a file
|
||||
!
|
||||
USE kinds, ONLY : DP
|
||||
USE gvect, ONLY : nrxx, nrx1, nrx2, nrx3
|
||||
#if defined (__PARA)
|
||||
USE para, ONLY : me, mypool, MPI_COMM_ROW
|
||||
USE io_global, ONLY : ionode_id
|
||||
USE mp, ONLY : mp_bcast
|
||||
#endif
|
||||
implicit none
|
||||
integer :: iop, nc, ic
|
||||
! option: write if +1, read if -1
|
||||
! number of components and index for them
|
||||
character (len=*) :: filename
|
||||
|
||||
real(kind=DP) :: pot (nrxx, nc)
|
||||
#ifdef __PARA
|
||||
real(kind=DP), allocatable :: allv (:,:)
|
||||
!
|
||||
IMPLICIT NONE
|
||||
!
|
||||
INTEGER :: iop, nc, ic
|
||||
! option: write if +1, read if -1
|
||||
! number of components and index for them
|
||||
CHARACTER (LEN=*) :: filename
|
||||
REAL(KIND=DP) :: pot(nrxx,nc)
|
||||
LOGICAL :: exst
|
||||
#if defined (__PARA)
|
||||
REAL(KIND=DP), ALLOCATABLE :: allv(:,:)
|
||||
#endif
|
||||
|
||||
logical :: exst
|
||||
#ifdef __PARA
|
||||
if (me.eq.1) allocate( allv(nrx1*nrx2*nrx3, nc) )
|
||||
!
|
||||
! On writing: gather the potential on the first node of each pool
|
||||
!
|
||||
if (iop.eq.1) then
|
||||
do ic = 1, nc
|
||||
call gather (pot (1, ic), allv (1, ic) )
|
||||
enddo
|
||||
endif
|
||||
if (me.eq.1.and.mypool.eq.1) then
|
||||
#if defined (__PARA)
|
||||
!
|
||||
! ... parallel case
|
||||
!
|
||||
IF ( me == 1 ) ALLOCATE( allv( nrx1*nrx2*nrx3, nc ) )
|
||||
!
|
||||
! ... On writing: gather the potential on the first node of each pool
|
||||
!
|
||||
IF ( iop == 1 ) THEN
|
||||
!
|
||||
! Only the first node of the first pool reads or writes the file
|
||||
DO ic = 1, nc
|
||||
!
|
||||
CALL gather( pot(1,ic), allv(1,ic) )
|
||||
!
|
||||
END DO
|
||||
!
|
||||
call seqopn (4, filename, 'unformatted', exst)
|
||||
if (iop.eq.1) then
|
||||
write (4, err = 10) allv
|
||||
else
|
||||
read (4, err = 20) allv
|
||||
endif
|
||||
close (unit = 4)
|
||||
endif
|
||||
END IF
|
||||
!
|
||||
! On reading: copy the potential on the first node of all pools
|
||||
! scatter the potential on all nodes of each pool
|
||||
IF ( me == 1 .AND. mypool == 1 ) THEN
|
||||
!
|
||||
! ... Only the first node of the first pool reads or writes the file
|
||||
!
|
||||
CALL seqopn( 4, filename, 'UNFORMATTED', exst )
|
||||
!
|
||||
IF ( iop == 1 ) THEN
|
||||
!
|
||||
WRITE( 4, err = 10 ) allv
|
||||
!
|
||||
ELSE
|
||||
!
|
||||
READ( 4, err = 20 ) allv
|
||||
!
|
||||
END IF
|
||||
!
|
||||
CLOSE( UNIT = 4 )
|
||||
!
|
||||
END IF
|
||||
!
|
||||
! ... On reading: copy the potential on the first node of all pools
|
||||
! ... scatter the potential on all nodes of each pool
|
||||
!
|
||||
IF ( iop == -1 ) THEN
|
||||
!
|
||||
IF ( me == 1 ) CALL mp_bcast( allv, ionode_id, MPI_COMM_ROW )
|
||||
!
|
||||
DO ic = 1, nc
|
||||
!
|
||||
CALL scatter( allv(1,ic), pot(1,ic) )
|
||||
!
|
||||
END DO
|
||||
!
|
||||
END IF
|
||||
!
|
||||
IF ( me == 1 ) DEALLOCATE( allv )
|
||||
!
|
||||
if (iop.eq. - 1) then
|
||||
if (me.eq.1) call poolbcast (nrx1 * nrx2 * nrx3 * nc, allv)
|
||||
do ic = 1, nc
|
||||
call scatter (allv (1, ic), pot (1, ic) )
|
||||
enddo
|
||||
endif
|
||||
if (me.eq.1) deallocate(allv)
|
||||
#else
|
||||
call seqopn (4, filename, 'unformatted', exst)
|
||||
if (iop.eq.1) then
|
||||
write (4, err = 10) pot
|
||||
else
|
||||
read (4, err = 20) pot
|
||||
endif
|
||||
close (unit = 4)
|
||||
!
|
||||
! ... serial case
|
||||
!
|
||||
CALL seqopn( 4, filename, 'UNFORMATTED', exst )
|
||||
!
|
||||
IF ( iop == 1 ) THEN
|
||||
!
|
||||
WRITE( 4, err = 10 ) pot
|
||||
!
|
||||
ELSE
|
||||
!
|
||||
READ( 4, err = 20 ) pot
|
||||
!
|
||||
END IF
|
||||
!
|
||||
CLOSE( UNIT = 4 )
|
||||
!
|
||||
#endif
|
||||
return
|
||||
10 call errore ('io_pot', 'error writing '//filename, 1)
|
||||
return
|
||||
20 call errore ('io_pot', 'error reading '//filename, 2)
|
||||
return
|
||||
end subroutine io_pot
|
||||
|
||||
!
|
||||
RETURN
|
||||
!
|
||||
10 CALL errore( 'io_pot', 'error writing '//filename, 1 )
|
||||
!
|
||||
RETURN
|
||||
!
|
||||
20 CALL errore( 'io_pot', 'error reading '//filename, 2 )
|
||||
!
|
||||
RETURN
|
||||
!
|
||||
END SUBROUTINE io_pot
|
||||
|
|
|
@ -51,14 +51,14 @@ SUBROUTINE move_ions()
|
|||
USE relax, ONLY : epse, epsf, starting_scf_threshold
|
||||
USE cellmd, ONLY : lmovecell, calc
|
||||
#if defined (__PARA)
|
||||
USE para, ONLY : me, mypool, MPI_COMM_POOL
|
||||
USE para, ONLY : me, mypool, MPI_COMM_POOL, MPI_COMM_ROW
|
||||
USE io_global, ONLY : ionode_id
|
||||
USE mp, ONLY : mp_bcast
|
||||
#endif
|
||||
!
|
||||
! ... external procedures
|
||||
!
|
||||
USE constraints_module, ONLY : dist_constrain, check_constrain, &
|
||||
USE constraints_module, ONLY : dist_constrain, check_constrain, &
|
||||
new_force, compute_penalty
|
||||
USE basic_algebra_routines, ONLY : norm
|
||||
!
|
||||
|
@ -223,13 +223,12 @@ SUBROUTINE move_ions()
|
|||
CALL mp_bcast( tr2, ionode_id )
|
||||
CALL mp_bcast( conv_ions, ionode_id )
|
||||
!
|
||||
IF ( me == 1 ) CALL poolbcast( 1, alpha0 )
|
||||
IF ( me == 1 ) CALL poolbcast( 1, beta0 )
|
||||
IF ( me == 1 ) CALL mp_bcast( alpha0, ionode_id, MPI_COMM_ROW )
|
||||
IF ( me == 1 ) CALL mp_bcast( beta0, ionode_id, MPI_COMM_ROW )
|
||||
!
|
||||
CALL mp_bcast( alpha0, ionode_id, MPI_COMM_POOL )
|
||||
CALL mp_bcast( beta0, ionode_id, MPI_COMM_POOL )
|
||||
!
|
||||
!
|
||||
#endif
|
||||
!
|
||||
RETURN
|
||||
|
|
|
@ -1,41 +0,0 @@
|
|||
!
|
||||
! Copyright (C) 2001 PWSCF group
|
||||
! This file is distributed under the terms of the
|
||||
! GNU General Public License. See the file `License'
|
||||
! in the root directory of the present distribution,
|
||||
! or http://www.gnu.org/copyleft/gpl.txt .
|
||||
!
|
||||
!
|
||||
!-----------------------------------------------------------------------
|
||||
subroutine poolbcast (ndata, data)
|
||||
!-----------------------------------------------------------------------
|
||||
!
|
||||
! this routine broadcasts the (distributed) real*8 vector 'data'
|
||||
! from each node of the first pool to each node of all other pools
|
||||
!
|
||||
USE kinds, only : DP
|
||||
#ifdef __PARA
|
||||
use para
|
||||
#endif
|
||||
implicit none
|
||||
! on INPUT
|
||||
integer :: ndata
|
||||
real (kind=DP) :: data (ndata)
|
||||
#ifdef __PARA
|
||||
#include "machine.h"
|
||||
include 'mpif.h'
|
||||
integer :: root, ierr
|
||||
!
|
||||
if (npool == 1) return
|
||||
!
|
||||
! root is the "broadcasting" processor.
|
||||
!
|
||||
! rank of the MPI_COMM_ROW
|
||||
root = 0
|
||||
call mpi_barrier (MPI_COMM_ROW, ierr)
|
||||
call mpi_bcast (data, ndata, MPI_REAL8, root, MPI_COMM_ROW, ierr)
|
||||
call errore ('poolbcast', 'info<>0', ierr)
|
||||
#endif
|
||||
return
|
||||
end subroutine poolbcast
|
||||
|
|
@ -19,7 +19,7 @@ SUBROUTINE poolscatter( nsize, nkstot, f_in, nks, f_out )
|
|||
#if defined (__PARA)
|
||||
!
|
||||
USE kinds, ONLY : DP
|
||||
USE para, ONLY : me, mypool, npool, kunit, MPI_COMM_POOL
|
||||
USE para, ONLY : me, mypool, npool, kunit, MPI_COMM_POOL, MPI_COMM_ROW
|
||||
USE io_global, ONLY : ionode_id
|
||||
USE mp, ONLY : mp_bcast
|
||||
!
|
||||
|
@ -40,7 +40,7 @@ SUBROUTINE poolscatter( nsize, nkstot, f_in, nks, f_out )
|
|||
! ... copy from the first node of the first pool
|
||||
! ... to the first node of all the other pools
|
||||
!
|
||||
IF ( me == 1 ) CALL poolbcast( nsize * nkstot, f_in )
|
||||
IF ( me == 1 ) CALL mp_bcast( f_in, ionode_id, MPI_COMM_ROW )
|
||||
!
|
||||
! ... distribute the vector on the first node of each pool
|
||||
!
|
||||
|
@ -62,4 +62,3 @@ SUBROUTINE poolscatter( nsize, nkstot, f_in, nks, f_out )
|
|||
RETURN
|
||||
!
|
||||
END SUBROUTINE poolscatter
|
||||
|
||||
|
|
|
@ -79,7 +79,6 @@ SUBROUTINE reduce( size, ps )
|
|||
#endif
|
||||
!
|
||||
ps((1+(n-1)*MAXB):(n*MAXB)) = buff(1:MAXB)
|
||||
!CALL DCOPY( MAXB, buff, 1, ps(1+(n-1)*MAXB), 1 )
|
||||
!
|
||||
END DO
|
||||
!
|
||||
|
@ -99,7 +98,6 @@ SUBROUTINE reduce( size, ps )
|
|||
#endif
|
||||
!
|
||||
ps((1+nbuf*MAXB):(1+size)) = buff(1:(size-nbuf*MAXB))
|
||||
!CALL DCOPY( (size-nbuf*MAXB), buff, 1, ps(1+nbuf*MAXB), 1 )
|
||||
!
|
||||
END IF
|
||||
!
|
||||
|
@ -151,9 +149,6 @@ SUBROUTINE ireduce( size, is )
|
|||
CALL errore( 'ireduce', 'error in allreduce 1', info )
|
||||
!
|
||||
is((1+(n-1)*MAXI):(n*MAXI)) = buff(1:MAXI)
|
||||
!do m = 1, MAXI
|
||||
! is (m + (n - 1) * MAXI) = buff (m)
|
||||
!enddo
|
||||
!
|
||||
END DO
|
||||
!
|
||||
|
@ -167,9 +162,6 @@ SUBROUTINE ireduce( size, is )
|
|||
CALL errore( 'reduce', 'error in allreduce 2', info )
|
||||
!
|
||||
is((1+nbuf*MAXB):(1+size)) = buff(1:(size-nbuf*MAXB))
|
||||
!do m = 1, size-nbuf * MAXI
|
||||
! is (m + nbuf * MAXI) = buff (m)
|
||||
!enddo
|
||||
!
|
||||
END IF
|
||||
!
|
||||
|
|
|
@ -36,7 +36,7 @@ SUBROUTINE sum_band()
|
|||
USE wavefunctions_module, ONLY : evc, psic
|
||||
USE wvfct, ONLY : nbnd, npwx, npw, igk, wg, et
|
||||
#if defined (__PARA)
|
||||
USE para, ONLY : me, mypool, MPI_COMM_POOL
|
||||
USE para, ONLY : me, mypool, MPI_COMM_POOL, MPI_COMM_ROW
|
||||
USE io_global, ONLY : ionode_id
|
||||
USE mp, ONLY : mp_bcast
|
||||
#endif
|
||||
|
@ -85,7 +85,7 @@ SUBROUTINE sum_band()
|
|||
!
|
||||
CALL poolscatter( nbnd, nkstot, wg, nks, wg )
|
||||
!
|
||||
IF ( me == 1 ) CALL poolbcast( 1, ef )
|
||||
IF ( me == 1 ) CALL mp_bcast( ef, ionode_id, MPI_COMM_ROW )
|
||||
!
|
||||
CALL mp_bcast( ef, ionode_id, MPI_COMM_POOL )
|
||||
!
|
||||
|
|
|
@ -70,7 +70,6 @@ PWOBJS = \
|
|||
../PW/bp_ylm_q.o \
|
||||
../PW/bp_zgedi.o \
|
||||
../PW/bp_zgefa.o \
|
||||
../PW/broadcast.o \
|
||||
../PW/c_bands.o \
|
||||
../PW/c_gemm.o \
|
||||
../PW/ccalbec.o \
|
||||
|
@ -183,7 +182,6 @@ PWOBJS = \
|
|||
../PW/ortho.o \
|
||||
../PW/orthoatwfc.o \
|
||||
../PW/para.o \
|
||||
../PW/poolbcast.o \
|
||||
../PW/poolextreme.o \
|
||||
../PW/poolrecover.o \
|
||||
../PW/poolreduce.o \
|
||||
|
|
Loading…
Reference in New Issue