Build the map on the host (BuildMap_SetInterface3D_t), then copy the face element and side lists to the device and allocate device outbox and ghost buffers.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(SetInterface3D), | intent(inout) | :: | this | |||
| type(Mesh3D), | intent(in) | :: | globalMesh | |||
| integer, | intent(in) | :: | setOfElem(1:) | |||
| integer, | intent(in) | :: | setGlobalId(1:) | |||
| integer, | intent(in) | :: | setOffsetThisRank(1:) | |||
| integer, | intent(in) | :: | nvarOfSet(1:) | |||
| integer, | intent(in) | :: | N |
subroutine BuildMap_SetInterface3D(this,globalMesh,setOfElem,setGlobalId, &
setOffsetThisRank,nvarOfSet,N)
!! Build the map on the host (BuildMap_SetInterface3D_t), then copy the face element
!! and side lists to the device and allocate device outbox and ghost buffers.
implicit none
class(SetInterface3D),intent(inout) :: this
type(Mesh3D),intent(in) :: globalMesh
integer,intent(in) :: setOfElem(1:)
integer,intent(in) :: setGlobalId(1:)
integer,intent(in) :: setOffsetThisRank(1:)
integer,intent(in) :: nvarOfSet(1:)
integer,intent(in) :: N
! Local
integer(c_int),allocatable,target :: buf(:)
call BuildMap_SetInterface3D_t(this,globalMesh,setOfElem,setGlobalId, &
setOffsetThisRank,nvarOfSet,N)
if(this%nFaces == 0) return
allocate(buf(1:this%nFaces))
buf = this%faceElem
call gpuCheck(hipMalloc(this%faceElem_gpu,sizeof(buf)))
call gpuCheck(hipMemcpy(this%faceElem_gpu,c_loc(buf),sizeof(buf),hipMemcpyHostToDevice))
buf = this%faceSide
call gpuCheck(hipMalloc(this%faceSide_gpu,sizeof(buf)))
call gpuCheck(hipMemcpy(this%faceSide_gpu,c_loc(buf),sizeof(buf),hipMemcpyHostToDevice))
deallocate(buf)
call gpuCheck(hipMalloc(this%outbox_gpu,sizeof(this%outbox)))
call gpuCheck(hipMalloc(this%ghost_gpu,sizeof(this%ghost)))
endsubroutine BuildMap_SetInterface3D