Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor changes in indexing in homme communications. #1054

Merged
merged 1 commit into from
Sep 27, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
126 changes: 78 additions & 48 deletions components/homme/src/share/edge_mod_base.F90
Original file line number Diff line number Diff line change
Expand Up @@ -948,6 +948,7 @@ subroutine edgeVunpack(edge,v,vlyr,kptr,ielem)
integer :: is,ie,in,iw
integer :: ks,ke,kblock
logical :: done
integer :: getmapL

!call t_adj_detailf(+2)
!call t_startf('edgeVunpack')
Expand All @@ -970,40 +971,44 @@ subroutine edgeVunpack(edge,v,vlyr,kptr,ielem)

! SWEST
do ll=swest,swest+max_corner_elem-1
if(edge%getmap(ll,ielem) /= -1) then
getmapL = edge%getmap(ll,ielem)
if(getmapL /= -1) then
!dir$ ivdep
do k=1,vlyr
v(1 ,1 ,k)=v(1 ,1 ,k)+edge%receive((kptr+k-1)+edge%getmap(ll,ielem)+1)
v(1 ,1 ,k)=v(1 ,1 ,k)+edge%receive((kptr+k-1)+getmapL+1)
enddo
endif
end do

! SEAST
do ll=swest+max_corner_elem,swest+2*max_corner_elem-1
if(edge%getmap(ll,ielem) /= -1) then
getmapL = edge%getmap(ll,ielem)
if(getmapL /= -1) then
!dir$ ivdep
do k=1,vlyr
v(np ,1 ,k)=v(np,1 ,k)+edge%receive((kptr+k-1)+edge%getmap(ll,ielem)+1)
v(np ,1 ,k)=v(np,1 ,k)+edge%receive((kptr+k-1)+getmapL+1)
enddo
endif
end do

! NEAST
do ll=swest+3*max_corner_elem,swest+4*max_corner_elem-1
if(edge%getmap(ll,ielem) /= -1) then
getmapL = edge%getmap(ll,ielem)
if(getmapL /= -1) then
!dir$ ivdep
do k=1,vlyr
v(np ,np,k)=v(np,np,k)+edge%receive((kptr+k-1)+edge%getmap(ll,ielem)+1)
v(np ,np,k)=v(np,np,k)+edge%receive((kptr+k-1)+getmapL+1)
enddo
endif
end do

! NWEST
do ll=swest+2*max_corner_elem,swest+3*max_corner_elem-1
if(edge%getmap(ll,ielem) /= -1) then
getmapL = edge%getmap(ll,ielem)
if(getmapL /= -1) then
!dir$ ivdep
do k=1,vlyr
v(1 ,np,k)=v(1 ,np,k)+edge%receive((kptr+k-1)+edge%getmap(ll,ielem)+1)
v(1 ,np,k)=v(1 ,np,k)+edge%receive((kptr+k-1)+getmapL+1)
enddo
endif
end do
Expand Down Expand Up @@ -1340,6 +1345,7 @@ subroutine edgeVunpackMAX(edge,v,vlyr,kptr,ielem)
! Local
integer :: i,k,l,iptr
integer :: is,ie,in,iw
integer :: getmapL

threadsafe=.false.

Expand All @@ -1360,40 +1366,44 @@ subroutine edgeVunpackMAX(edge,v,vlyr,kptr,ielem)

! SWEST
do l=swest,swest+max_corner_elem-1
if(edge%getmap(l,ielem) /= -1) then
getmapL = edge%getmap(l,ielem)
if(getmapL /= -1) then
!dir$ ivdep
do k=1,vlyr
v(1 ,1 ,k)=MAX(v(1 ,1 ,k),edge%receive(kptr+k+edge%getmap(l,ielem)))
v(1 ,1 ,k)=MAX(v(1 ,1 ,k),edge%receive(kptr+k+getmapL))
enddo
endif
end do

! SEAST
do l=swest+max_corner_elem,swest+2*max_corner_elem-1
if(edge%getmap(l,ielem) /= -1) then
getmapL = edge%getmap(l,ielem)
if(getmapL /= -1) then
!dir$ ivdep
do k=1,vlyr
v(np ,1 ,k)=MAX(v(np,1 ,k),edge%receive(kptr+k+edge%getmap(l,ielem)))
v(np ,1 ,k)=MAX(v(np,1 ,k),edge%receive(kptr+k+getmapL))
enddo
endif
end do

! NEAST
do l=swest+3*max_corner_elem,swest+4*max_corner_elem-1
if(edge%getmap(l,ielem) /= -1) then
getmapL = edge%getmap(l,ielem)
if(getmapL /= -1) then
!dir$ ivdep
do k=1,vlyr
v(np ,np,k)=MAX(v(np,np,k),edge%receive(kptr+k+edge%getmap(l,ielem)))
v(np ,np,k)=MAX(v(np,np,k),edge%receive(kptr+k+getmapL))
enddo
endif
end do

! NWEST
do l=swest+2*max_corner_elem,swest+3*max_corner_elem-1
if(edge%getmap(l,ielem) /= -1) then
getmapL = edge%getmap(l,ielem)
if(getmapL /= -1) then
!dir$ ivdep
do k=1,vlyr
v(1 ,np,k)=MAX(v(1 ,np,k),edge%receive(kptr+k+edge%getmap(l,ielem)))
v(1 ,np,k)=MAX(v(1 ,np,k),edge%receive(kptr+k+getmapL))
enddo
endif
end do
Expand All @@ -1413,6 +1423,7 @@ subroutine edgeSunpackMAX(edge,v,vlyr,kptr,ielem)
! Local
integer :: i,k,l,iptr
integer :: is,ie,in,iw
integer :: getmapL

!pw call t_startf('edgeSunpack')
threadsafe=.false.
Expand All @@ -1429,44 +1440,48 @@ subroutine edgeSunpackMAX(edge,v,vlyr,kptr,ielem)

! SWEST
do l=swest,swest+max_corner_elem-1
if(edge%getmap(l,ielem) /= -1) then
getmapL = edge%getmap(l,ielem)
if(getmapL /= -1) then
!dir$ ivdep
do k=1,vlyr
iptr = (kptr+k-1)
v(k)=MAX(v(k),edge%receive(kptr+k+edge%getmap(l,ielem)))
v(k)=MAX(v(k),edge%receive(kptr+k+getmapL))
enddo
endif
end do

! SEAST
do l=swest+max_corner_elem,swest+2*max_corner_elem-1
if(edge%getmap(l,ielem) /= -1) then
getmapL = edge%getmap(l,ielem)
if(getmapL /= -1) then
!dir$ ivdep
do k=1,vlyr
iptr = (kptr+k-1)
v(k)=MAX(v(k),edge%receive(kptr+k+edge%getmap(l,ielem)))
v(k)=MAX(v(k),edge%receive(kptr+k+getmapL))
enddo
endif
end do

! NEAST
do l=swest+3*max_corner_elem,swest+4*max_corner_elem-1
if(edge%getmap(l,ielem) /= -1) then
getmapL = edge%getmap(l,ielem)
if(getmapL /= -1) then
!dir$ ivdep
do k=1,vlyr
iptr = (kptr+k-1)
v(k)=MAX(v(k),edge%receive(kptr+k+edge%getmap(l,ielem)))
v(k)=MAX(v(k),edge%receive(kptr+k+getmapL))
enddo
endif
end do

! NWEST
do l=swest+2*max_corner_elem,swest+3*max_corner_elem-1
if(edge%getmap(l,ielem) /= -1) then
getmapL = edge%getmap(l,ielem)
if(getmapL /= -1) then
!dir$ ivdep
do k=1,vlyr
iptr = (kptr+k-1)
v(k)=MAX(v(k),edge%receive(kptr+k+edge%getmap(l,ielem)))
v(k)=MAX(v(k),edge%receive(kptr+k+getmapL))
enddo
endif
end do
Expand All @@ -1489,6 +1504,7 @@ subroutine edgeSunpackMIN(edge,v,vlyr,kptr,ielem)

integer :: i,k,l,iptr
integer :: is,ie,in,iw
integer :: getmapL

!pw call t_startf('edgeSunpack')
threadsafe=.false.
Expand All @@ -1505,40 +1521,44 @@ subroutine edgeSunpackMIN(edge,v,vlyr,kptr,ielem)

! SWEST
do l=swest,swest+max_corner_elem-1
if(edge%getmap(l,ielem) /= -1) then
getmapL = edge%getmap(l,ielem)
if(getmapL /= -1) then
!dir$ ivdep
do k=1,vlyr
v(k)=MiN(v(k),edge%receive(kptr+k+edge%getmap(l,ielem)))
v(k)=MiN(v(k),edge%receive(kptr+k+getmapL))
enddo
endif
end do

! SEAST
do l=swest+max_corner_elem,swest+2*max_corner_elem-1
if(edge%getmap(l,ielem) /= -1) then
getmapL = edge%getmap(l,ielem)
if(getmapL /= -1) then
!dir$ ivdep
do k=1,vlyr
v(k)=MIN(v(k),edge%receive(kptr+k+edge%getmap(l,ielem)))
v(k)=MIN(v(k),edge%receive(kptr+k+getmapL))
enddo
endif
end do

! NEAST
do l=swest+3*max_corner_elem,swest+4*max_corner_elem-1
if(edge%getmap(l,ielem) /= -1) then
getmapL = edge%getmap(l,ielem)
if(getmapL /= -1) then
!dir$ ivdep
do k=1,vlyr
v(k)=MIN(v(k),edge%receive(kptr+k+edge%getmap(l,ielem)))
v(k)=MIN(v(k),edge%receive(kptr+k+getmapL))
enddo
endif
end do

! NWEST
do l=swest+2*max_corner_elem,swest+3*max_corner_elem-1
if(edge%getmap(l,ielem) /= -1) then
getmapL = edge%getmap(l,ielem)
if(getmapL /= -1) then
!dir$ ivdep
do k=1,vlyr
v(k)=MIN(v(k),edge%receive(kptr+k+edge%getmap(l,ielem)))
v(k)=MIN(v(k),edge%receive(kptr+k+getmapL))
enddo
endif
end do
Expand All @@ -1559,6 +1579,7 @@ subroutine edgeVunpackMIN(edge,v,vlyr,kptr,ielem)
! Local
integer :: i,k,l,iptr
integer :: is,ie,in,iw
integer :: getmapL

threadsafe=.false.

Expand All @@ -1579,40 +1600,44 @@ subroutine edgeVunpackMIN(edge,v,vlyr,kptr,ielem)

! SWEST
do l=swest,swest+max_corner_elem-1
if(edge%getmap(l,ielem) /= -1) then
getmapL = edge%getmap(l,ielem)
if(getmapL /= -1) then
!dir$ ivdep
do k=1,vlyr
v(1 ,1 ,k)=MIN(v(1 ,1 ,k),edge%receive(kptr+k+edge%getmap(l,ielem)))
v(1 ,1 ,k)=MIN(v(1 ,1 ,k),edge%receive(kptr+k+getmapL))
enddo
endif
end do

! SEAST
do l=swest+max_corner_elem,swest+2*max_corner_elem-1
if(edge%getmap(l,ielem) /= -1) then
getmapL = edge%getmap(l,ielem)
if(getmapL /= -1) then
!dir$ ivdep
do k=1,vlyr
v(np ,1 ,k)=MIN(v(np,1 ,k),edge%receive(kptr+k+edge%getmap(l,ielem)))
v(np ,1 ,k)=MIN(v(np,1 ,k),edge%receive(kptr+k+getmapL))
enddo
endif
end do

! NEAST
do l=swest+3*max_corner_elem,swest+4*max_corner_elem-1
if(edge%getmap(l,ielem) /= -1) then
getmapL = edge%getmap(l,ielem)
if(getmapL /= -1) then
!dir$ ivdep
do k=1,vlyr
v(np ,np,k)=MIN(v(np,np,k),edge%receive(kptr+k+edge%getmap(l,ielem)))
v(np ,np,k)=MIN(v(np,np,k),edge%receive(kptr+k+getmapL))
enddo
endif
end do

! NWEST
do l=swest+2*max_corner_elem,swest+3*max_corner_elem-1
if(edge%getmap(l,ielem) /= -1) then
getmapL = edge%getmap(l,ielem)
if(getmapL /= -1) then
!dir$ ivdep
do k=1,vlyr
v(1 ,np,k)=MIN(v(1 ,np,k),edge%receive(kptr+k+edge%getmap(l,ielem)))
v(1 ,np,k)=MIN(v(1 ,np,k),edge%receive(kptr+k+getmapL))
enddo
endif
end do
Expand All @@ -1637,6 +1662,7 @@ subroutine LongEdgeVunpackMIN(edge,v,vlyr,kptr,desc)
! Local
integer :: i,k,l
integer :: is,ie,in,iw
integer :: getmapL

threadsafe=.false.

Expand All @@ -1656,40 +1682,44 @@ subroutine LongEdgeVunpackMIN(edge,v,vlyr,kptr,desc)

! SWEST
do l=swest,swest+max_corner_elem-1
if(desc%getmapP(l) /= -1) then
getmapL = desc%getmapP(l)
if(getmapL /= -1) then
!dir$ ivdep
do k=1,vlyr
v(1 ,1 ,k)=MIN(v(1 ,1 ,k),edge%buf(kptr+k,desc%getmapP(l)+1))
v(1 ,1 ,k)=MIN(v(1 ,1 ,k),edge%buf(kptr+k,getmapL+1))
enddo
endif
end do

! SEAST
do l=swest+max_corner_elem,swest+2*max_corner_elem-1
if(desc%getmapP(l) /= -1) then
getmapL = desc%getmapP(l)
if(getmapL /= -1) then
!dir$ ivdep
do k=1,vlyr
v(np ,1 ,k)=MIN(v(np,1 ,k),edge%buf(kptr+k,desc%getmapP(l)+1))
v(np ,1 ,k)=MIN(v(np,1 ,k),edge%buf(kptr+k,getmapL+1))
enddo
endif
end do

! NEAST
do l=swest+3*max_corner_elem,swest+4*max_corner_elem-1
if(desc%getmapP(l) /= -1) then
getmapL = desc%getmapP(l)
if(getmapL /= -1) then
!dir$ ivdep
do k=1,vlyr
v(np ,np,k)=MIN(v(np,np,k),edge%buf(kptr+k,desc%getmapP(l)+1))
v(np ,np,k)=MIN(v(np,np,k),edge%buf(kptr+k,getmapL+1))
enddo
endif
end do

! NWEST
do l=swest+2*max_corner_elem,swest+3*max_corner_elem-1
if(desc%getmapP(l) /= -1) then
getmapL = desc%getmapP(l)
if(getmapL /= -1) then
!dir$ ivdep
do k=1,vlyr
v(1 ,np,k)=MIN(v(1 ,np,k),edge%buf(kptr+k,desc%getmapP(l)+1))
v(1 ,np,k)=MIN(v(1 ,np,k),edge%buf(kptr+k,getmapL+1))
enddo
endif
end do
Expand Down