Init_Points Subroutine

public subroutine Init_Points(this, nPoints, nDim)

Allocate host + device storage for nPoints in nDim dimensions. The basis-cache device buffers are allocated lazily in UpdateDevice once the polynomial degree N is known (it is set by LocatePoints).

Arguments

TypeIntentOptionalAttributesName
class(Points), intent(out) :: this
integer, intent(in) :: nPoints
integer, intent(in) :: nDim

Calls

proc~~init_points~~CallsGraph proc~init_points Init_Points interface~hipmalloc hipMalloc proc~init_points->interface~hipmalloc proc~gpucheck gpuCheck proc~init_points->proc~gpucheck

Contents

Source Code


Source Code

  subroutine Init_Points(this,nPoints,nDim)
    !! Allocate host + device storage for nPoints in nDim dimensions. The
    !! basis-cache device buffers are allocated lazily in UpdateDevice once
    !! the polynomial degree N is known (it is set by LocatePoints).
    implicit none
    class(Points),intent(out) :: this
    integer,intent(in) :: nPoints
    integer,intent(in) :: nDim
    ! Local
    integer(c_size_t) :: nBytes

    if(nDim /= 2 .and. nDim /= 3) then
      print*,"SELF_Points (gpu)::Init: nDim must be 2 or 3, got ",nDim
      stop 1
    endif

    this%nPoints = nPoints
    this%nDim = nDim
    this%nPointsAlloc = nPoints
    this%nCachedAlloc = 0
    allocate(this%x(1:nPoints,1:nDim))
    allocate(this%elements(1:nPoints))
    allocate(this%coordinates(1:nPoints,1:nDim))
    this%x = 0.0_prec
    this%elements = 0
    this%coordinates = 0.0_prec

    nBytes = int(nPoints,c_size_t)*c_sizeof(0_c_int)
    call gpuCheck(hipMalloc(this%elements_gpu,nBytes))

    nBytes = int(nPoints*nDim,c_size_t)*int(prec,c_size_t)
    call gpuCheck(hipMalloc(this%coordinates_gpu,nBytes))

  endsubroutine Init_Points