MPI-SCATCI 2.0
An MPI version of SCATCI
Loading...
Searching...
No Matches
MemoryManager_module Module Reference

Memory manager module. More...

Data Types

type  MemoryManager
 This is a simple class to handle memory management tracking. More...

Functions/Subroutines

subroutine Memorymanager_ctor (this, total_memory)
 Constructor, used to initialize total available memory.
subroutine init_memory (this, total_memory)
 Same as constructor, used to reinitialize te memory again (not really used)
subroutine track_memory (this, elem_size, nelem, stat, array_name)
 Tracks memory allocation, usually called after an allocation.
subroutine free_memory (this, elem_size, nelem)
 Tracks memory deallocation, usually called before a deallocation.
integer(longint) function get_available_memory (this)
 Get currently available memory.
integer(longint) function get_scaled_available_memory (this, scale_)
 Get currently available memory scaled.
subroutine print_memory_report (this)
 Prints a very simple memory report.

Variables

type(memorymanager), public master_memory
 This is the global memory manager.

Detailed Description

Memory manager module.

Authors
A Al-Refaie
Date
2017

This module has an extremely basic memory management system in place, this will hopefully be upgraded in due time

Note
30/01/2017 - Ahmed Al-Refaie: Initial revision.
16/01/2019 - Jakub Benda: Unifom coding style and expanded documentation.

Function/Subroutine Documentation

◆ free_memory()

subroutine MemoryManager_module::free_memory ( class(memorymanager) this,
integer, intent(in) elem_size,
integer, intent(in) nelem )
private

Tracks memory deallocation, usually called before a deallocation.

Authors
A Al-Refaie
Date
2017
Parameters
[in,out]thisManager object to update.
[in]elem_sizeSize in byte of each element
[in]nelemNumber of elements of size elem_size

Definition at line 166 of file MemoryManager_module.f90.

◆ get_available_memory()

integer(longint) function MemoryManager_module::get_available_memory ( class(memorymanager) this)
private

Get currently available memory.

Authors
A Al-Refaie
Date
2017
Returns
Total memory in bytes

Definition at line 194 of file MemoryManager_module.f90.

◆ get_scaled_available_memory()

integer(longint) function MemoryManager_module::get_scaled_available_memory ( class(memorymanager) this,
real(wp), intent(in) scale_ )
private

Get currently available memory scaled.

Authors
A Al-Refaie
Date
2017

This is particularly useful when trying to determine how many elements we can fit into memory by giving a margin of safety

Parameters
[in,out]thisManager object to update.
[in]scale_Scale valued of available memory (0.0 - 1.0).
Returns
Total memory in bytes

Definition at line 213 of file MemoryManager_module.f90.

◆ init_memory()

subroutine MemoryManager_module::init_memory ( class(memorymanager) this,
integer(longint), intent(in) total_memory )
private

Same as constructor, used to reinitialize te memory again (not really used)

Authors
A Al-Refaie
Date
2017
Parameters
[in,out]thisManager object to update.
[in]total_memoryTotal available memory for the process in bytes

Definition at line 99 of file MemoryManager_module.f90.

◆ Memorymanager_ctor()

subroutine MemoryManager_module::Memorymanager_ctor ( class(memorymanager) this,
integer(longint), intent(in) total_memory )
private

Constructor, used to initialize total available memory.

Authors
A Al-Refaie
Date
2017
Parameters
[in,out]thisManager object to update.
[in]total_memoryTotal available memory for the process in bytes

Definition at line 80 of file MemoryManager_module.f90.

◆ print_memory_report()

subroutine MemoryManager_module::print_memory_report ( class(memorymanager) this)
private

Prints a very simple memory report.

Authors
A Al-Refaie
Date
2017

Definition at line 231 of file MemoryManager_module.f90.

◆ track_memory()

subroutine MemoryManager_module::track_memory ( class(memorymanager) this,
integer, intent(in) elem_size,
integer, intent(in) nelem,
integer, intent(in) stat,
character(len=*), intent(in) array_name )
private

Tracks memory allocation, usually called after an allocation.

Authors
A Al-Refaie
Date
2017
Parameters
[in,out]thisManager object to update.
[in]elem_sizeSize in byte of each element
[in]nelemNumber of elements of size elem_size
[in]staterror Value after an allocate call
[in]array_nameAssigned name of array, used to debug where a memory allocation error occured.

Definition at line 121 of file MemoryManager_module.f90.

Variable Documentation

◆ master_memory

type(memorymanager), public MemoryManager_module::master_memory

This is the global memory manager.

Authors
A Al-Refaie
Date
2017

No other memory manager can exist

Definition at line 69 of file MemoryManager_module.f90.