Skip to content

Commit

Permalink
Merge branch 'oksanaguba/homme/small-change-dss' into next (PR #1054)
Browse files Browse the repository at this point in the history
Minor changes in indexing in homme communications:
Instead of code like this

! SEAST
    do l=swest+max_corner_elem,swest+2*max_corner_elem-1
        if(edge%getmap(l,ielem) /= -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)))
            enddo
        endif
    end do

one can introduce a variable

! SEAST
    do l=swest+max_corner_elem,swest+2*max_corner_elem-1
        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+getmapL))
            enddo
        endif
    end do

[BFB] - Bit-For-Bit

Conflicts:
	components/homme/src/share/edge_mod_base.F90
  • Loading branch information
amametjanov committed Sep 26, 2016
2 parents fe29e0a + b765996 commit 539d3e8
Showing 1 changed file with 102 additions and 56 deletions.
158 changes: 102 additions & 56 deletions components/homme/src/share/edge_mod_base.F90
Original file line number Diff line number Diff line change
Expand Up @@ -979,6 +979,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 Down Expand Up @@ -1018,36 +1019,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+getmapL)
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+getmapL)
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+getmapL)
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+getmapL)
enddo
endif
end do
Expand Down Expand Up @@ -1392,6 +1401,7 @@ subroutine edgeVunpackMAX(edge,v,vlyr,kptr,ielem)

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

threadsafe=.false.

Expand All @@ -1411,36 +1421,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-1)+edge%getmap(l,ielem)+1))
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-1)+edge%getmap(l,ielem)+1))
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-1)+edge%getmap(l,ielem)+1))
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-1)+edge%getmap(l,ielem)+1))
v(1 ,np,k)=MAX(v(1 ,np,k),edge%receive(kptr+k+getmapL))
enddo
endif
end do
Expand All @@ -1462,6 +1480,7 @@ subroutine edgeSunpackMAX(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 @@ -1477,40 +1496,44 @@ 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(iptr+edge%getmap(l,ielem)+1))
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(iptr+edge%getmap(l,ielem)+1))
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(iptr+edge%getmap(l,ielem)+1))
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(iptr+edge%getmap(l,ielem)+1))
v(k)=MAX(v(k),edge%receive(kptr+k+getmapL))
enddo
endif
end do
Expand All @@ -1533,6 +1556,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 @@ -1548,40 +1572,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
iptr = (kptr+k-1)
v(k)=MiN(v(k),edge%receive(iptr+edge%getmap(l,ielem)+1))
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
iptr = (kptr+k-1)
v(k)=MIN(v(k),edge%receive(iptr+edge%getmap(l,ielem)+1))
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
iptr = (kptr+k-1)
v(k)=MIN(v(k),edge%receive(iptr+edge%getmap(l,ielem)+1))
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
iptr = (kptr+k-1)
v(k)=MIN(v(k),edge%receive(iptr+edge%getmap(l,ielem)+1))
v(k)=MIN(v(k),edge%receive(kptr+k+getmapL))
enddo
endif
end do
Expand All @@ -1604,6 +1632,7 @@ subroutine edgeVunpackMIN(edge,v,vlyr,kptr,ielem)

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

threadsafe=.false.

Expand All @@ -1623,36 +1652,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-1)+edge%getmap(l,ielem)+1))
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-1)+edge%getmap(l,ielem)+1))
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-1)+edge%getmap(l,ielem)+1))
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-1)+edge%getmap(l,ielem)+1))
v(1 ,np,k)=MIN(v(1 ,np,k),edge%receive(kptr+k+getmapL))
enddo
endif
end do
Expand All @@ -1679,6 +1716,7 @@ subroutine LongEdgeVunpackMIN(edge,v,vlyr,kptr,desc)

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

threadsafe=.false.

Expand All @@ -1697,36 +1735,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

0 comments on commit 539d3e8

Please sign in to comment.