One-directional messages for MortarFluxCollect on device memory : each remote small side sends its boundaryNormal trace to the big side's rank.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(MappedVector2D), | intent(inout) | :: | this | |||
| type(Mesh2D), | intent(inout) | :: | mesh |
subroutine MPIMortarFluxAsync_MappedVector2D(this,mesh)
!! One-directional messages for MortarFluxCollect on device memory : each remote
!! small side sends its boundaryNormal trace to the big side's rank.
implicit none
class(MappedVector2D),intent(inout) :: this
type(Mesh2D),intent(inout) :: mesh
! Local
integer :: m,k,ivar
integer :: eB,rB,eS,sS,rS
integer :: globalSideId,tag
integer :: offset
integer :: iError
integer :: msgCount
real(prec),pointer :: boundaryNormal(:,:,:,:)
real(prec),pointer :: mortarBuff(:,:,:,:)
msgCount = 0
offset = mesh%decomp%offsetElem(mesh%decomp%rankId+1)
call c_f_pointer(this%boundarynormal_gpu,boundaryNormal, &
[this%interp%N+1,4,this%nelem,this%nvar])
call c_f_pointer(this%mortarBuff_gpu,mortarBuff, &
[this%interp%N+1,4,mesh%nMortars,this%nvar])
do ivar = 1,this%nvar
do m = 1,mesh%nMortars
eB = mesh%mortarInfo(1,m)
rB = mesh%decomp%elemToRank(eB)
do k = 1,2
eS = mesh%mortarInfo(2*k+1,m)
sS = mesh%mortarInfo(2*k+2,m)/10
rS = mesh%decomp%elemToRank(eS)
globalSideId = mesh%mortarInfo(6+k,m)
tag = globalSideId+mesh%nUniqueSides*(ivar-1)
if(rB == mesh%decomp%rankId .and. rS /= mesh%decomp%rankId) then
msgCount = msgCount+1
call MPI_IRECV(mortarBuff(:,2+k,m,ivar), &
(this%interp%N+1), &
mesh%decomp%mpiPrec, &
rS,tag, &
mesh%decomp%mpiComm, &
mesh%decomp%requests(msgCount),iError)
elseif(rS == mesh%decomp%rankId .and. rB /= mesh%decomp%rankId) then
msgCount = msgCount+1
call MPI_ISEND(boundaryNormal(:,sS,eS-offset,ivar), &
(this%interp%N+1), &
mesh%decomp%mpiPrec, &
rB,tag, &
mesh%decomp%mpiComm, &
mesh%decomp%requests(msgCount),iError)
endif
enddo
enddo
enddo
mesh%decomp%msgCount = msgCount
endsubroutine MPIMortarFluxAsync_MappedVector2D