| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(MappedScalar3D), | intent(inout) | :: | this |
subroutine Free_MappedScalar3D(this)
implicit none
class(MappedScalar3D),intent(inout) :: this
! Local
integer :: n,iError
logical :: mpiIsFinalized
! Host storage is owned by the pools in the parent type (Stage 6b), so the parent Free
! releases it rather than deallocating these pointers.
call Free_Scalar3D_t(this)
call gpuCheck(hipFree(this%interior_gpu))
call gpuCheck(hipFree(this%boundary_gpu))
call gpuCheck(hipFree(this%extBoundary_gpu))
call gpuCheck(hipFree(this%avgBoundary_gpu))
call gpuCheck(hipFree(this%boundarynormal_gpu))
call gpuCheck(hipFree(this%jas_gpu))
if(c_associated(this%mortarBuff_gpu)) then
call gpuCheck(hipFree(this%mortarBuff_gpu))
this%mortarBuff_gpu = c_null_ptr
endif
if(c_associated(this%halo_sendbuf_gpu)) call gpuCheck(hipFree(this%halo_sendbuf_gpu))
if(c_associated(this%halo_recvbuf_gpu)) call gpuCheck(hipFree(this%halo_recvbuf_gpu))
this%halo_sendbuf_gpu = c_null_ptr
this%halo_recvbuf_gpu = c_null_ptr
if(allocated(this%halo_reqs)) then
! Persistent requests can only be released while MPI is still
! initialized; if the mesh (and its MPI finalization) was freed first,
! MPI has reclaimed them already.
call MPI_FINALIZED(mpiIsFinalized,iError)
if(.not. mpiIsFinalized) then
do n = 1,size(this%halo_reqs)
call MPI_REQUEST_FREE(this%halo_reqs(n),iError)
enddo
endif
deallocate(this%halo_reqs)
endif
this%halo_nactive = 0
this%halo_inflight = 0
this%halo_static_done = .false.
endsubroutine Free_MappedScalar3D