Init_Scalar1D Subroutine

public subroutine Init_Scalar1D(this, interp, nVar, nElem)

Arguments

TypeIntentOptionalAttributesName
class(Scalar1D), intent(out) :: this
type(Lagrange), intent(in), target:: interp
integer, intent(in) :: nVar
integer, intent(in) :: nElem

Calls

proc~~init_scalar1d~2~~CallsGraph proc~init_scalar1d~2 Init_Scalar1D proc~gpuavailable GPUAvailable proc~init_scalar1d~2->proc~gpuavailable proc~hipblascheck hipblasCheck proc~init_scalar1d~2->proc~hipblascheck interface~hipmalloc hipMalloc proc~init_scalar1d~2->interface~hipmalloc proc~gpucheck gpuCheck proc~init_scalar1d~2->proc~gpucheck interface~hipblascreate hipblasCreate proc~init_scalar1d~2->interface~hipblascreate interface~hipgetdevicecount hipGetDeviceCount proc~gpuavailable->interface~hipgetdevicecount

Contents

Source Code


Source Code

  subroutine Init_Scalar1D(this,interp,nVar,nElem)
    implicit none
    class(Scalar1D),intent(out) :: this
    type(Lagrange),intent(in),target :: interp
    integer,intent(in) :: nVar
    integer,intent(in) :: nElem

    if(.not. GPUAvailable()) then
      print*,__FILE__,':',__LINE__,' : Error : Attempt to use GPU extension, but GPU is not available.'
      stop 1
    endif

    this%interp => interp
    this%nVar = nVar
    this%nElem = nElem
    this%N = interp%N
    this%M = interp%M

    allocate(this%interior(1:interp%N+1,1:nelem,1:nvar), &
             this%boundary(1:2,1:nelem,1:nvar), &
             this%boundarynormal(1:2,1:nelem,1:nvar), &
             this%extBoundary(1:2,1:nelem,1:nvar), &
             this%avgBoundary(1:2,1:nelem,1:nvar))

    this%interior = 0.0_prec
    this%boundary = 0.0_prec
    this%boundarynormal = 0.0_prec
    this%extBoundary = 0.0_prec
    this%avgBoundary = 0.0_prec

    allocate(this%meta(1:nVar))
    allocate(this%eqn(1:nVar))

    call gpuCheck(hipMalloc(this%interior_gpu,sizeof(this%interior)))
    call gpuCheck(hipMalloc(this%boundary_gpu,sizeof(this%boundary)))
    call gpuCheck(hipMalloc(this%boundarynormal_gpu,sizeof(this%boundarynormal)))
    call gpuCheck(hipMalloc(this%extBoundary_gpu,sizeof(this%extBoundary)))
    call gpuCheck(hipMalloc(this%avgBoundary_gpu,sizeof(this%avgBoundary)))

    call this%UpdateDevice()

    call hipblasCheck(hipblasCreate(this%blas_handle))

  endsubroutine Init_Scalar1D