memory optimize x derivatives

This commit is contained in:
ignis 2019-05-03 15:51:45 +09:00
parent f4c917f769
commit eef8cda6d7
2 changed files with 21 additions and 59 deletions

View file

@ -31,15 +31,12 @@ contains
call ludcmp(nxp,nyp,nzp,1,0,0) ! 1,1,0
allocate(xsrc(nyp, nxp), stat=ierr)
allocate(xdst(nyp, nxp), stat=ierr)
allocate(xsrc(nb, nxp), stat=ierr)
allocate(xdst(nb, nxp), stat=ierr)
allocate(rsrc(nxp, nzp), stat=ierr)
allocate(rdst(nxp, nzp), stat=ierr)
allocate(zsrc(nyp, nzp, nxp), stat=ierr)
allocate(zdst(nyp, nzp, nxp), stat=ierr)
end subroutine m_calculate_init
@ -53,9 +50,6 @@ contains
deallocate(rsrc)
deallocate(rdst)
deallocate(zsrc)
deallocate(zdst)
end subroutine m_calculate_finalize
@ -65,16 +59,21 @@ contains
real*8, dimension(nxp,nyp,nzp), intent(out) :: dst
integer :: i, j ,k
integer :: ju
do k = 1,nzp
do j = 1,nyp,nb
call tp2(xsrc, src(:,:,k), nyp, nxp)
ju = min(j+nb-1,nyp)
call dfnonp(nxp, hxp, xsrc, xdst, nyp, 1)
call tp2(xsrc, src(:,j:ju,k), nb, nxp)
call tp2(dst(:,:,k), xdst, nxp, nyp)
call dfnonp(nxp, hxp, xsrc, xdst, nb, 1)
call tp2(dst(:,j:ju,k), xdst, nxp, nb)
end do
end do
end subroutine ddx
@ -104,27 +103,6 @@ contains
integer :: i, j ,k
call tp2(zsrc, src, nyp*nzp, nxp)
do i = 1,nxp
call dfp(nzp, hzp, zsrc(:,:,i), zdst(:,:,i), nyp, 3)
end do
call tp2(dst, zdst, nxp, nyp*nzp)
end subroutine ddz
subroutine ddz_ref(dst, src)
real*8, dimension(nxp,nyp,nzp), intent(in) :: src
real*8, dimension(nxp,nyp,nzp), intent(out) :: dst
integer :: i, j ,k
do j = 1,nyp
do k = 1,nzp
@ -139,7 +117,7 @@ contains
end do
end subroutine ddz_ref
end subroutine ddz
subroutine d2dx(dst, src)
@ -148,16 +126,21 @@ contains
real*8, dimension(nxp,nyp,nzp), intent(out) :: dst
integer :: i, j ,k
integer :: ju
do k = 1,nzp
do j = 1,nyp,nb
call tp2(xsrc, src(:,:,k), nyp, nxp)
ju = min(j+nb-1,nyp)
call d2fnonp(nxp, hxp, xsrc, xdst, nyp, 1)
call tp2(xsrc, src(:,j:ju,k), nb, nxp)
call tp2(dst(:,:,k), xdst, nxp, nyp)
call d2fnonp(nxp, hxp, xsrc, xdst, nb, 1)
call tp2(dst(:,j:ju,k), xdst, nxp, nb)
end do
end do
end subroutine d2dx
@ -187,27 +170,6 @@ contains
integer :: i, j ,k
call tp2(zsrc, src, nyp*nzp, nxp)
do i = 1,nxp
call d2fp(nzp, hzp, zsrc(:,:,i), zdst(:,:,i), nyp, 3)
end do
call tp2(dst, zdst, nxp, nyp*nzp)
end subroutine d2dz
subroutine d2dz_ref(dst, src)
real*8, dimension(nxp,nyp,nzp), intent(in) :: src
real*8, dimension(nxp,nyp,nzp), intent(out) :: dst
integer :: i, j ,k
do j = 1,nyp
do k = 1,nzp
@ -222,7 +184,7 @@ contains
end do
end subroutine d2dz_ref
end subroutine d2dz
subroutine tp(a, b, nx)

View file

@ -4,7 +4,7 @@
#Cluster_2(16.161) flags
BLOCKSIZE?=16
BLOCKSIZE?=32
flags = -cpp -DBLOCKSIZE=$(BLOCKSIZE) -Wall -O3 -ffree-line-length-0 -fdefault-integer-8 -fdefault-double-8 -fdefault-real-8 -march=native