MatrixMemoryPoolModule Module

A module for handling scratch memory for matrix multiplication. The purpose of this module is to avoid having to allocate memory on the heap during a matrix multiply, and to manage the underlying hash table.



Contents


Interfaces

public interface ConstructMatrixMemoryPool

  • private subroutine ConstructMatrixMemoryPoolSub_lr(this, columns, rows, sparsity_in)

    Subroutine wrapper for the constructor.

    Arguments

    Type IntentOptional Attributes Name
    type(MatrixMemoryPool_lr), TARGET :: this

    The matrix to construct.

    integer, intent(in) :: columns

    Number of columns in the matrix.

    integer, intent(in) :: rows

    Number of rows in the matrix.

    real(kind=NTREAL), intent(in), optional :: sparsity_in

    Estimated sparsity (optional).

  • private subroutine ConstructMatrixMemoryPoolSub_lc(this, columns, rows, sparsity_in)

    Subroutine wrapper for the constructor.

    Arguments

    Type IntentOptional Attributes Name
    type(MatrixMemoryPool_lc), TARGET :: this

    The matrix to construct.

    integer, intent(in) :: columns

    Number of columns in the matrix.

    integer, intent(in) :: rows

    Number of rows in the matrix.

    real(kind=NTREAL), intent(in), optional :: sparsity_in

    Estimated sparsity (optional).

public interface DestructMatrixMemoryPool

  • private pure subroutine DestructMatrixMemoryPool_lr(this)

    A destructor for a matrix memory pool

    Arguments

    Type IntentOptional Attributes Name
    type(MatrixMemoryPool_lr), intent(inout) :: this

    The matrix being destructed.

  • private pure subroutine DestructMatrixMemoryPool_lc(this)

    A destructor for a matrix memory pool

    Arguments

    Type IntentOptional Attributes Name
    type(MatrixMemoryPool_lc), intent(inout) :: this

    The matrix being destructed.

public interface CheckMemoryPoolValidity

  • private pure function CheckMemoryPoolValidity_lr(this, columns, rows) result(isvalid)

    Checks if a given memory pool has been validly allocated to handle the given parameters.

    Arguments

    Type IntentOptional Attributes Name
    type(MatrixMemoryPool_lr), intent(in) :: this

    The memory pool to check.

    integer, intent(in) :: columns

    Number of columns in the matrix.

    integer, intent(in) :: rows

    Number of rows in the matrix.

    Return Value logical

    true if the memory pool is valid.

  • private pure function CheckMemoryPoolValidity_lc(this, columns, rows) result(isvalid)

    Checks if a given memory pool has been validly allocated to handle Checks if a given memory pool has been validly allocated to handle the given parameters.

    Arguments

    Type IntentOptional Attributes Name
    type(MatrixMemoryPool_lc), intent(in) :: this

    The memory pool to check.

    integer, intent(in) :: columns

    Number of columns in the matrix.

    integer, intent(in) :: rows

    Number of rows in the matrix.

    Return Value logical

    true if the memory pool is valid.

public interface SetPoolSparsity

  • private subroutine SetPoolSparsity_lr(this, sparsity)

    Sets the expected sparsity of the matrix, which helps with hashing.

    Arguments

    Type IntentOptional Attributes Name
    type(MatrixMemoryPool_lr), intent(inout), TARGET :: this

    The memory pool to set the sparsity of.

    real(kind=NTREAL), intent(in) :: sparsity

    The sparsity value.

  • private subroutine SetPoolSparsity_lc(this, sparsity)

    Sets the expected sparsity of the matrix, which helps with hashing.

    Arguments

    Type IntentOptional Attributes Name
    type(MatrixMemoryPool_lc), intent(inout), TARGET :: this

    The memory pool to set the sparsity of.

    real(kind=NTREAL), intent(in) :: sparsity

    The sparsity value.


Derived Types

type, public ::  MatrixMemoryPool_lr

A memory pool datatype that can be reused for matrix matrix multiplication. this is to prevent excessive alloc/dealloc.

Components

Type Visibility Attributes Name Initial
integer, public :: columns

Shape of matrix: columns

integer, public :: rows

Shape of matrix: rows

type(Triplet_r), public, DIMENSION(:), ALLOCATABLE :: pruned_list

storage for actual values added to the matrix.

real(kind=NTREAL), public, DIMENSION(:,:), ALLOCATABLE :: value_array

storage for potential values added to the matrix.

logical, public, DIMENSION(:,:), ALLOCATABLE :: dirty_array

true if an element has been pushed to this part of the matrix.

integer, public, DIMENSION(:,:), ALLOCATABLE :: hash_index

Storage space for indices, hashed.

integer, public, DIMENSION(:,:), ALLOCATABLE :: inserted_per_bucket

Internal storage space for amount of items added to a bucket.

integer, public :: hash_size

Size of the buckets.

type, public ::  MatrixMemoryPool_lc

A memory pool datatype that can be reused for matrix matrix multiplication. this is to prevent excessive alloc/dealloc.

Components

Type Visibility Attributes Name Initial
integer, public :: columns

Shape of matrix: columns

integer, public :: rows

Shape of matrix: rows

type(Triplet_c), public, DIMENSION(:), ALLOCATABLE :: pruned_list

storage for actual values added to the matrix.

complex(kind=NTCOMPLEX), public, DIMENSION(:,:), ALLOCATABLE :: value_array

storage for potential values added to the matrix.

logical, public, DIMENSION(:,:), ALLOCATABLE :: dirty_array

true if an element has been pushed to this part of the matrix.

integer, public, DIMENSION(:,:), ALLOCATABLE :: hash_index

Storage space for indices, hashed.

integer, public, DIMENSION(:,:), ALLOCATABLE :: inserted_per_bucket

Internal storage space for amount of items added to a bucket.

integer, public :: hash_size

Size of the buckets.