cuda_allocator_t Derived Type

type, public, extends(allocator_t) :: cuda_allocator_t


Components

Type Visibility Attributes Name Initial
integer, public :: ngrid
integer, public :: next_id = 0

The id for the next allocated block. This counter is incremented each time a new block is allocated.

class(mesh_t), public, pointer :: mesh

The pointer to the first block on the list. Non associated if the list is empty

class(field_t), public, pointer :: first => null()

Constructor

public interface cuda_allocator_t

  • public function cuda_allocator_init(mesh, sz) result(allocator)

    Arguments

    Type IntentOptional Attributes Name
    class(mesh_t), intent(inout) :: mesh
    integer, intent(in) :: sz

    Return Value type(cuda_allocator_t)


Type-Bound Procedures

procedure, public :: get_block

  • public function get_block(self, dir, data_loc) result(handle)

    Return a pointer to the first available memory block, i.e. the current head of the block list. If the list is empty, allocate a new block with create_block first.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(allocator_t), intent(inout) :: self
    integer, intent(in) :: dir
    integer, intent(in), optional :: data_loc

    Return Value class(field_t), pointer

procedure, public :: release_block

  • public subroutine release_block(self, handle)

    Release memory block pointed to by HANDLE to the block list. It is pushed to the front of the block list, in other words it is made the head block.

    Arguments

    Type IntentOptional Attributes Name
    class(allocator_t), intent(inout) :: self
    class(field_t), pointer :: handle

procedure, public :: get_block_ids

  • public function get_block_ids(self)

    Utility function that returns a array made of the id of the block currently in the block list. Return the array [0] if block list is empty.

    Arguments

    Type IntentOptional Attributes Name
    class(allocator_t), intent(inout) :: self

    Return Value integer, allocatable, (:)

procedure, public :: destroy

  • public subroutine destroy(self)

    Go through the block list from head to tail, deallocating each memory block in turn. Deallocation of a m_allocator object automatically deallocates its internal allocatable data array.

    Arguments

    Type IntentOptional Attributes Name
    class(allocator_t), intent(inout) :: self

procedure, public :: compute_padded_dims

  • public subroutine compute_padded_dims(self, sz)

    Arguments

    Type IntentOptional Attributes Name
    class(allocator_t), intent(inout) :: self
    integer, intent(in) :: sz

procedure, public :: create_block => create_cuda_block