dbcsr_mem_methods Module

DBCSR Memory Pool to avoid slow allocations of accelerator memory



Variables

Type Visibility Attributes Name Initial
character(len=*), private, parameter :: moduleN = 'dbcsr_mem_methods'
logical, private, parameter :: debug = .FALSE.

Functions

public function dbcsr_mempool_get(memtype, datatype, datasize) result(res)

Picks a suitable data_area from mempool, returns Null() if none found.

Arguments

Type IntentOptional Attributes Name
type(dbcsr_memtype_type) :: memtype
integer, intent(in) :: datatype
integer, intent(in) :: datasize

Return Value type(dbcsr_data_obj)

public function dbcsr_memtype_equal(mt1, mt2) result(res)

Test if two memtypes are equal

Arguments

Type IntentOptional Attributes Name
type(dbcsr_memtype_type), intent(in) :: mt1
type(dbcsr_memtype_type), intent(in) :: mt2

Return Value logical


Subroutines

private subroutine dbcsr_mempool_create(pool)

Creates a memory pool.

Arguments

Type IntentOptional Attributes Name
type(dbcsr_mempool_type), POINTER :: pool

public subroutine dbcsr_mempool_limit_capacity(pool, capacity)

Ensures that mempool has at least the given capacity.

Arguments

Type IntentOptional Attributes Name
type(dbcsr_mempool_type), POINTER :: pool
integer, intent(in) :: capacity

public subroutine dbcsr_mempool_add(area)

Adds an unused (refcount==0) data_area to the pool.

Arguments

Type IntentOptional Attributes Name
type(dbcsr_data_obj) :: area

private subroutine mempool_collect_garbage(pool)

Ensures that pool_size < max_size, e.g. that there is a free slot.

Arguments

Type IntentOptional Attributes Name
type(dbcsr_mempool_type), POINTER :: pool

public subroutine dbcsr_mempool_destruct(pool)

Finalizes mempool, includes deallocation of all contained data_areas.

Arguments

Type IntentOptional Attributes Name
type(dbcsr_mempool_type), POINTER :: pool

public subroutine dbcsr_mempool_clear(pool)

Deallocates all data_areas contained in given mempool.

Arguments

Type IntentOptional Attributes Name
type(dbcsr_mempool_type), POINTER :: pool

public subroutine dbcsr_memtype_setup(memtype, acc_hostalloc, acc_devalloc, mpi, acc_stream, oversize_factor, has_pool)

Ensures that given memtype has requested settings.

Arguments

Type IntentOptional Attributes Name
type(dbcsr_memtype_type), intent(inout) :: memtype
logical, intent(in), optional :: acc_hostalloc
logical, intent(in), optional :: acc_devalloc
logical, intent(in), optional :: mpi
type(acc_stream_type), optional :: acc_stream
real(kind=dp), optional :: oversize_factor
logical, intent(in), optional :: has_pool