- small boxes fft variables placed in a separate datatype, and removed from fft type

git-svn-id: http://qeforge.qe-forge.org/svn/q-e/trunk/espresso@12671 c92efa57-630b-4861-b058-cf58834340f0
This commit is contained in:
ccavazzoni 2016-08-06 09:09:42 +00:00
parent e813685cbc
commit 92503eb2cd
18 changed files with 43 additions and 142 deletions

View File

@ -1001,7 +1001,7 @@ SUBROUTINE drhov(irb,eigrb,rhovan,drhovan,rhog,rhor,drhog,drhor)
END DO
ENDIF
!
CALL invfft( 'Box', qv, dfftb, isa )
CALL invfft( qv, dfftb, isa )
!
! qv = US contribution in real space on box grid
! for atomic species is, real(qv)=atom ia, imag(qv)=atom ia+1
@ -1084,7 +1084,7 @@ SUBROUTINE drhov(irb,eigrb,rhovan,drhovan,rhog,rhor,drhog,drhor)
& + ci*CONJG(eigrb(ig,isa)*dqgbt(ig,2))
END DO
CALL invfft('Box',qv, dfftb, isa )
CALL invfft(qv, dfftb, isa )
!
! qv is the now the US augmentation charge for atomic species is
! and atom ia: real(qv)=spin up, imag(qv)=spin down
@ -1294,7 +1294,7 @@ SUBROUTINE rhov(irb,eigrb,rhovan,rhog,rhor)
ENDIF
CALL invfft( 'Box', qv, dfftb, isa )
CALL invfft( qv, dfftb, isa )
!
! qv = US augmentation charge in real space on box grid
! for atomic species is, real(qv)=atom ia, imag(qv)=atom ia+1
@ -1404,7 +1404,7 @@ SUBROUTINE rhov(irb,eigrb,rhovan,rhog,rhor)
& + ci* CONJG(eigrb(ig,isa)*qgbt(ig,2))
END DO
!
CALL invfft('Box',qv,dfftb,isa)
CALL invfft( qv,dfftb,isa)
!
! qv is the now the US augmentation charge for atomic species is
! and atom ia: real(qv)=spin up, imag(qv)=spin down

View File

@ -29,7 +29,7 @@ SUBROUTINE deallocate_modules_var()
USE wavefunctions_module, ONLY : deallocate_wavefunctions
USE wannier_module, ONLY : deallocate_wannier
USE fft_types, ONLY : fft_dlay_descriptor, fft_dlay_deallocate
USE fft_types, ONLY : fft_box_deallocate
USE fft_smallbox_type, ONLY : fft_box_deallocate
USE fft_base, ONLY : dfftp, dffts, dfftb
USE stick_base, ONLY : sticks_deallocate
USE electrons_module, ONLY : deallocate_electrons

View File

@ -256,7 +256,7 @@
USE ions_positions, ONLY: allocate_ions_positions, tau0, taus
use cp_restart, only: cp_read_cell
USE fft_base, ONLY: dfftb
USE fft_types, ONLY: fft_box_allocate
USE fft_smallbox_type, ONLY: fft_box_allocate
USE cp_main_variables,ONLY: ht0, htm, taub
USE cp_interfaces, ONLY: newinit
USE constants, ONLY: amu_au

View File

@ -243,6 +243,7 @@ cprstart.o : ../../Modules/mp_global.o
cprstart.o : ../../Modules/mp_images.o
cprstart.o : ../../Modules/read_input.o
cprstart.o : input.o
dealloc.o : ../../FFTXlib/fft_smallbox_type.o
dealloc.o : ../../FFTXlib/fft_types.o
dealloc.o : ../../FFTXlib/stick_base.o
dealloc.o : ../../Modules/electrons_base.o
@ -492,7 +493,7 @@ gtable.o : ../../Modules/parallel_include.o
gtable.o : ../../Modules/recvec.o
gtable.o : efield.o
init.o : ../../FFTXlib/fft_smallbox.o
init.o : ../../FFTXlib/fft_types.o
init.o : ../../FFTXlib/fft_smallbox_type.o
init.o : ../../FFTXlib/stick_set.o
init.o : ../../Modules/cell_base.o
init.o : ../../Modules/constants.o
@ -1037,11 +1038,12 @@ sic.o : ../../Modules/kind.o
smallbox.o : ../../Modules/constants.o
smallbox.o : ../../Modules/io_global.o
smallbox.o : ../../Modules/kind.o
smallbox_grid.o : ../../FFTXlib/fft_smallbox_type.o
smallbox_grid.o : ../../FFTXlib/fft_support.o
smallbox_grid.o : ../../FFTXlib/fft_types.o
smallbox_grid.o : ../../Modules/io_global.o
smallbox_gvec.o : ../../Modules/kind.o
smallbox_lib.o : ../../FFTXlib/fft_types.o
smallbox_lib.o : ../../FFTXlib/fft_smallbox_type.o
smallbox_lib.o : ../../Modules/cell_base.o
smallbox_lib.o : ../../Modules/control_flags.o
smallbox_lib.o : ../../Modules/fft_base.o

View File

@ -131,7 +131,7 @@
END DO
END IF
!
CALL invfft( 'Box', qv, dfftb, isa )
CALL invfft( qv, dfftb, isa )
!
DO iss=1,nspin
res = boxdotgrid(irb(1,isa),1,qv,vr(1,iss))
@ -251,7 +251,7 @@
END DO
END DO
!
CALL invfft('Box',qv,dfftb,isa)
CALL invfft( qv, dfftb, isa)
!
res = boxdotgrid(irb(1,isa),1,qv,vr(1,iss))
fvan(ik,ia,is) = res
@ -310,7 +310,7 @@
END DO
END DO
!
CALL invfft('Box',qv,dfftb,isa)
CALL invfft( qv, dfftb, isa)
!
fvan(ik,ia,is) = &
& boxdotgrid(irb(1,isa),isup,qv,vr(1,isup)) + &

View File

@ -279,7 +279,7 @@
end do
end if
!
call invfft( 'Box', qv, dfftb, ia+isa )
call invfft( qv, dfftb, ia+isa )
!
! note that a factor 1/2 is hidden in fac if nspin=2
!
@ -415,7 +415,7 @@
end do
endif
!
call invfft( 'Box', qv, dfftb, isa+ia )
call invfft( qv, dfftb, isa+ia )
!
call box2grid(irb(1,ia+isa),1,qv,wrk1)
if (nfft.eq.2) call box2grid(irb(1,ia+1+isa),2,qv,wrk1)

View File

@ -28,11 +28,12 @@
!
USE fft_support, only: good_fft_dimension, good_fft_order
USE fft_types, only: fft_dlay_descriptor
USE fft_smallbox_type, only: fft_box_descriptor
!
IMPLICIT NONE
!
TYPE(fft_dlay_descriptor), INTENT(IN) :: dfftp
TYPE(fft_dlay_descriptor), INTENT(INOUT) :: dfftb
TYPE(fft_box_descriptor), INTENT(INOUT) :: dfftb
!
! no default values for grid box: if nr*b=0, ignore
@ -62,9 +63,9 @@
SUBROUTINE smallbox_grid_info( dfftb )
!
USE io_global, ONLY: stdout, ionode
USE fft_types, ONLY: fft_dlay_descriptor
USE fft_smallbox_type, only: fft_box_descriptor
!
TYPE(fft_dlay_descriptor), INTENT(IN) :: dfftb
TYPE(fft_box_descriptor), INTENT(IN) :: dfftb
!
IF ( ionode ) THEN
IF ( dfftb%nr1 > 0 .AND. dfftb%nr2 > 0 .AND. dfftb%nr3 > 0 ) THEN

View File

@ -18,7 +18,7 @@
USE io_global, ONLY: stdout
USE mp_global, ONLY: nproc_bgrp, me_bgrp, intra_bgrp_comm
USE fft_base, ONLY: dfftb, dfftp, dfftb, fft_dlay_descriptor
USE fft_types, ONLY: fft_box_set
USE fft_smallbox_type, ONLY: fft_box_set
IMPLICIT NONE
! input

View File

@ -329,7 +329,7 @@ SUBROUTINE wf( clwf, c, bec, eigr, eigrb, taub, irb, &
#ifdef __MPI
irb3=irb(3,isa)
#endif
CALL invfft('Box',qv,dfftb,isa)
CALL invfft(qv,dfftb,isa)
iqv=1
qvt=(0.D0,0.D0)
qvt=boxdotgridcplx(irb(1,isa),qv,expo(1,inw))
@ -370,7 +370,7 @@ SUBROUTINE wf( clwf, c, bec, eigr, eigrb, taub, irb, &
qv(npb(ig))=eigrb(ig,isa)*qgb(ig,ijv,is)
qv(nmb(ig))=CONJG(eigrb(ig,isa)*qgb(ig,ijv,is))
END DO
CALL invfft('Box',qv,dfftb,isa)
CALL invfft(qv,dfftb,isa)
iqv=1
qvt=0.D0
qvt=boxdotgridcplx(irb(1,isa),qv,expo(1,inw))

View File

@ -14,6 +14,7 @@ fft_interfaces.o \
stick_base.o \
stick_set.o \
fft_smallbox.o \
fft_smallbox_type.o \
fft_support.o \
fft_error.o \
fft_stick.o \

View File

@ -32,13 +32,12 @@ MODULE fft_interfaces
COMPLEX(DP) :: f(:)
END SUBROUTINE invfft_x
!
SUBROUTINE invfft_b( grid_type, f, dfft, ia )
USE fft_types, ONLY: fft_dlay_descriptor
SUBROUTINE invfft_b( f, dfft, ia )
USE fft_smallbox_type, ONLY: fft_box_descriptor
IMPLICIT NONE
INTEGER, PARAMETER :: DP = selected_real_kind(14,200)
INTEGER, INTENT(IN) :: ia
CHARACTER(LEN=*), INTENT(IN) :: grid_type
TYPE(fft_dlay_descriptor), INTENT(IN) :: dfft
TYPE(fft_box_descriptor), INTENT(IN) :: dfft
COMPLEX(DP) :: f(:)
END SUBROUTINE invfft_b
END INTERFACE
@ -109,8 +108,6 @@ SUBROUTINE invfft_x( grid_type, f, dfft, dtgs )
CALL start_clock( 'ffts' )
ELSE IF( grid_type == 'Wave' ) THEN
CALL start_clock('fftw')
ELSE IF( grid_type == 'Box' ) THEN
CALL fftx_error__( ' invfft ', ' incorrect CALL for Box fft ', 1 )
ELSE IF( grid_type == 'Custom' ) THEN
CALL start_clock('fftc')
ELSE IF( grid_type == 'CustomWave' ) THEN
@ -281,7 +278,7 @@ END SUBROUTINE fwfft_x
!=---------------------------------------------------------------------------=!
!
!=---------------------------------------------------------------------------=!
SUBROUTINE invfft_b( grid_type, f, dfft, ia )
SUBROUTINE invfft_b( f, dfft, ia )
!! Not-so-parallel 3d fft for box grid, implemented ONLY for sign=1
!!
!! ComputeG-space to R-space, $$ output = \sum_G f(G)exp(+iG*R) $$
@ -302,27 +299,23 @@ SUBROUTINE invfft_b( grid_type, f, dfft, ia )
USE fft_scalar, ONLY: cfft3d, cfft3ds
USE fft_smallbox, ONLY: cft_b, cft_b_omp
USE fft_parallel, ONLY: tg_cft3s
USE fft_types, ONLY: fft_dlay_descriptor
USE fft_smallbox_type, ONLY: fft_box_descriptor
IMPLICIT NONE
INTEGER, PARAMETER :: DP = selected_real_kind(14,200)
TYPE(fft_dlay_descriptor), INTENT(IN) :: dfft
TYPE(fft_box_descriptor), INTENT(IN) :: dfft
! Removed the 'OPTIONAL' attribute. When present, the specific interfaces
! 'invfft_x' and 'invfft_b' cannot be disambiguated when the generic interface
! call is made. This is a violation the Fortran standard. The Cray compiler
! errors out on this, while the Intel only issues a warning. --rbw
! INTEGER, OPTIONAL, INTENT(IN) :: ia
INTEGER, INTENT(IN) :: ia
CHARACTER(LEN=*), INTENT(IN) :: grid_type
COMPLEX(DP) :: f(:)
!
INTEGER :: imin3, imax3, np3
IF( grid_type /= 'Box' ) &
CALL fftx_error__( ' invfft ', ' inconsistent call for Box fft ', 1 )
! clocks called inside a parallel region do not work properly!
! in the future we probably need a thread safe version of the clock

View File

@ -55,13 +55,6 @@ MODULE fft_types
INTEGER :: id
INTEGER :: tptr
!
! Sub (box) grid descriptor
!
INTEGER, POINTER :: irb(:,:) ! the offset of the box corner
INTEGER, POINTER :: imin3(:) ! the starting local plane
INTEGER, POINTER :: imax3(:) ! the last local plane
INTEGER, POINTER :: np3(:) ! number of local plane for the box fft
!
! fft parallelization
!
INTEGER :: mype = 0 ! my processor id (starting from 0) in the fft group
@ -182,39 +175,6 @@ CONTAINS
END SUBROUTINE fft_dlay_deallocate
!=----------------------------------------------------------------------------=!
SUBROUTINE fft_box_allocate( desc, mype, root, nproc, comm, nat )
TYPE (fft_dlay_descriptor) :: desc
INTEGER, INTENT(in) :: nat, nproc, mype, root, comm ! mype starting from 0
ALLOCATE( desc%irb( 3, nat ) )
ALLOCATE( desc%imin3( nat ) )
ALLOCATE( desc%imax3( nat ) )
ALLOCATE( desc%npp( nproc ) )
ALLOCATE( desc%ipp( nproc ) )
ALLOCATE( desc%np3( nat ) )
desc%irb = 0
desc%imin3 = 0
desc%imax3 = 0
desc%npp = 0
desc%ipp = 0
desc%np3 = 0
desc%mype = mype
desc%nproc = nproc
desc%comm = comm
desc%root = root
END SUBROUTINE fft_box_allocate
SUBROUTINE fft_box_deallocate( desc )
TYPE (fft_dlay_descriptor) :: desc
IF( associated( desc%irb ) ) DEALLOCATE( desc%irb )
IF( associated( desc%imin3 ) ) DEALLOCATE( desc%imin3 )
IF( associated( desc%imax3 ) ) DEALLOCATE( desc%imax3 )
IF( associated( desc%npp ) ) DEALLOCATE( desc%npp )
IF( associated( desc%ipp ) ) DEALLOCATE( desc%ipp )
IF( associated( desc%np3 ) ) DEALLOCATE( desc%np3 )
END SUBROUTINE fft_box_deallocate
!=----------------------------------------------------------------------------=!
SUBROUTINE fft_dlay_set( desc, tk, nst, ub, lb, idx, in1, in2, ncp, ncpw, ngp, ngpw, st, stw )
@ -472,71 +432,6 @@ CONTAINS
RETURN
END SUBROUTINE fft_dlay_set
!=----------------------------------------------------------------------------=!
SUBROUTINE fft_box_set( desc, nr1b, nr2b, nr3b, nr1bx, nr2bx, nr3bx, nat, &
irb, npp, ipp )
IMPLICIT NONE
TYPE (fft_dlay_descriptor) :: desc
INTEGER, INTENT(in) :: nat
INTEGER, INTENT(in) :: irb( :, : )
INTEGER, INTENT(in) :: npp( : )
INTEGER, INTENT(in) :: ipp( : )
INTEGER, INTENT(in) :: nr1b, nr2b, nr3b, nr1bx, nr2bx, nr3bx
INTEGER :: ir3, ibig3, irb3, imin3, imax3, nr3, isa
IF( nat > size( desc%irb, 2 ) ) THEN
WRITE( stdout, fmt="( ///,'NAT, SIZE = ',2I10)" ) nat, size( desc%irb, 2 )
CALL fftx_error__(" fft_box_set ", " inconsistent dimensions ", 1 )
ENDIF
IF( desc%nproc > size( desc%npp ) ) &
CALL fftx_error__(" fft_box_set ", " inconsistent dimensions ", 2 )
desc%nr1 = nr1b
desc%nr2 = nr2b
desc%nr3 = nr3b
desc%nr1x = nr1bx
desc%nr2x = nr2bx
desc%nr3x = nr3bx
desc%irb( 1:3, 1:nat ) = irb( 1:3, 1:nat )
desc%npp( 1:desc%nproc ) = npp( 1:desc%nproc )
desc%ipp( 1:desc%nproc ) = ipp( 1:desc%nproc )
nr3 = sum( npp( 1:desc%nproc ) )
DO isa = 1, nat
imin3 = nr3b
imax3 = 1
irb3 = irb( 3, isa )
DO ir3 = 1, nr3b
ibig3 = 1 + mod( irb3 + ir3 - 2, nr3 )
IF( ibig3 < 1 .or. ibig3 > nr3 ) &
& CALL fftx_error__(' fft_box_set ',' ibig3 wrong ', ibig3 )
ibig3 = ibig3 - ipp( desc%mype + 1 )
IF ( ibig3 > 0 .and. ibig3 <= npp(desc%mype + 1) ) THEN
imin3 = min( imin3, ir3 )
imax3 = max( imax3, ir3 )
ENDIF
ENDDO
desc%imin3( isa ) = imin3
desc%imax3( isa ) = imax3
desc%np3( isa ) = imax3 - imin3 + 1
ENDDO
END SUBROUTINE fft_box_set
!=----------------------------------------------------------------------------=!
SUBROUTINE fft_dlay_scalar( desc, ub, lb, stw )

View File

@ -1,6 +1,7 @@
fft_interfaces.o : fft_parallel.o
fft_interfaces.o : fft_scalar.o
fft_interfaces.o : fft_smallbox.o
fft_interfaces.o : fft_smallbox_type.o
fft_interfaces.o : fft_types.o
fft_interfaces.o : task_groups.o
fft_parallel.o : fft_scalar.o

View File

@ -69,7 +69,7 @@ program test
!! MPI handles
INTEGER :: ntgs
!! number of taskgroups
INTEGER :: nbnds
INTEGER :: nbnd
!! number of bands
LOGICAL :: iope
!! I/O process

View File

@ -236,12 +236,14 @@ program lax_test
write(6,*)
write(6,*) '+-----------------------------------+'
write(6,*) '| ping-pong network bandwidth |'
write(6,*) '| with pe = 0 |'
write(6,*) '+-----------------------------------+'
write(6,*)
write(6,315) 0, proc_name(1)
do i = 2, npes
write(6,320) i-1, 2.0d0*DBLE(nx*nx)*8.0d0/tempo_tutti(i)/1.0D+9, proc_name(i)
end do
end if
315 FORMAT('pe = ',I5,', sender GBytes', ', node: ', A20)
320 FORMAT('pe = ',I5,',', F8.3, ' GBytes', ', node: ', A20)
DEALLOCATE( s )
!
@ -280,12 +282,14 @@ program lax_test
write(6,*)
write(6,*) '+-----------------------------------+'
write(6,*) '| ping-pong network latency |'
write(6,*) '| with pe = 0 |'
write(6,*) '+-----------------------------------+'
write(6,*)
write(6,325) 0, proc_name(1)
do i = 2, npes
write(6,330) i-1, tempo_tutti(i)*1000000.0d0, proc_name(i)
end do
end if
325 FORMAT('pe = ',I5,', sender usec', ', node: ', A20)
330 FORMAT('pe = ',I5,',', F8.3, ' usec', ', node: ', A20)
DEALLOCATE( tempo_tutti )

View File

@ -18,6 +18,7 @@
USE fft_types, ONLY: fft_dlay_descriptor
USE task_groups, ONLY: task_groups_descriptor
USE fft_smallbox_type, ONLY: fft_box_descriptor
IMPLICIT NONE
@ -32,7 +33,7 @@
! Dimensions of the 3D real and reciprocal space
! FFT grid relative to the smooth part of the charge density
! (may differ from the full charge density grid for USPP )
TYPE ( fft_dlay_descriptor ) :: dfftb ! descriptor for box grids
TYPE ( fft_box_descriptor ) :: dfftb ! descriptor for box grids
! Dimensions of the 3D real and reciprocal space
! FFT grid relative to the "small box" computation
! of the atomic augmentation part of the
@ -46,8 +47,9 @@
PRIVATE
PUBLIC :: dfftp, dffts, dfftb, dfft3d, fft_dlay_descriptor
PUBLIC :: dfftp, dffts, dfft3d, fft_dlay_descriptor
PUBLIC :: dtgs, task_groups_descriptor
PUBLIC :: dfftb, fft_box_descriptor
!=----------------------------------------------------------------------=!
END MODULE fft_base

View File

@ -84,6 +84,7 @@ fd_gradient.o : fft_base.o
fd_gradient.o : kind.o
fd_gradient.o : mp.o
fd_gradient.o : mp_bands.o
fft_base.o : ../FFTXlib/fft_smallbox_type.o
fft_base.o : ../FFTXlib/fft_types.o
fft_base.o : ../FFTXlib/task_groups.o
fft_base.o : parallel_include.o

View File

@ -693,6 +693,7 @@ gradcorr.o : ../../Modules/recvec.o
gradcorr.o : ../../Modules/wavefunctions.o
gradcorr.o : pwcom.o
gweights.o : ../../Modules/kind.o
h_1psi.o : ../../Modules/control_flags.o
h_1psi.o : ../../Modules/kind.o
h_1psi.o : ../../Modules/noncol.o
h_1psi.o : bp_mod.o