ESYS13
Revision_
|
Taipan array manager, C++ version. Based on TaipanMemManager C module by Lutz Gross. More...
#include <Taipan.h>
Classes | |
struct | Taipan_MemTable |
struct | Taipan_StatTable |
Public Types | |
typedef long | size_type |
Public Member Functions | |
Taipan () | |
Default constructor for Taipan data-array manager. | |
~Taipan () | |
Default destructor for Taipan data-array manager. | |
double * | new_array (size_type dim, size_type N) |
Taipan data-array allocator. | |
void | delete_array (double *array) |
Taipan data-array deallocator. | |
void | release_unused_arrays () |
frees all arrays that are currently unused. | |
int | num_arrays () |
Calculate the total number of arrays currently under management. | |
int | num_arrays (size_type N) |
Calculate the total number of arrays of N blocks currently under management. | |
int | num_free (size_type N) |
Calculate the total number of free arrays of N blocks currently under management. | |
long | num_elements () |
Return the total number of array elements currently under management. | |
void | dump_stats () |
Print out statistics on the memory under management. | |
void | clear_stats () |
Clear record of statistics on the memory under management. | |
Private Types | |
typedef struct escript::Taipan::Taipan_StatTable | Taipan_StatTable |
typedef struct escript::Taipan::Taipan_MemTable | Taipan_MemTable |
Private Member Functions | |
void | operator= (const Taipan &c) |
Private Attributes | |
Taipan_StatTable * | statTable |
Taipan_MemTable * | memTable_Root |
long | totalElements |
Taipan array manager, C++ version. Based on TaipanMemManager C module by Lutz Gross.
Description: Taipan: data-array manager.
The Taipan data-array manager holds a set of (dim x N) arrays distributed across a number of threads. If a (dim x N) array is requested via the Taipan allocator, the buffer of managed arrays is searched for a free array of this size on the current number of threads. If none is available, a new one is allocated and added to the buffer of managed arrays.
When a managed array is deallocated, the array is marked as free but not returned to the system as long as at least one array of N is in use. Otherwise all arrays of N are deallocated as it is assumed that these arrays not be used anymore. The exceptions to this strategy are arrays with N=0 or N=1, these arrays are never deallocated, but are kept for possible reuse.
typedef long escript::Taipan::size_type |
typedef struct escript::Taipan::Taipan_MemTable escript::Taipan::Taipan_MemTable [private] |
typedef struct escript::Taipan::Taipan_StatTable escript::Taipan::Taipan_StatTable [private] |
Default constructor for Taipan data-array manager.
Description: Default constructor for Taipan data-array manager.
Preconditions: Describe any preconditions
Throws: Describe any exceptions thrown
References clear_stats(), and statTable.
Default destructor for Taipan data-array manager.
Description: Default destructor for Taipan data-array manager.
Preconditions: Describe any preconditions
Throws: Describe any exceptions thrown
References escript::Taipan::Taipan_MemTable::array, escript::Taipan::Taipan_MemTable::dim, dump_stats(), memTable_Root, escript::Taipan::Taipan_MemTable::N, escript::Taipan::Taipan_MemTable::next, statTable, and totalElements.
void escript::Taipan::clear_stats | ( | ) |
Clear record of statistics on the memory under management.
References escript::Taipan::Taipan_StatTable::allocated_elements, escript::Taipan::Taipan_StatTable::allocations, escript::Taipan::Taipan_StatTable::deallocated_elements, escript::Taipan::Taipan_StatTable::deallocations, escript::Taipan::Taipan_StatTable::frees, escript::Taipan::Taipan_StatTable::max_tab_size, escript::Taipan::Taipan_StatTable::requests, statTable, and totalElements.
Referenced by Taipan().
void escript::Taipan::delete_array | ( | double * | array | ) |
Taipan data-array deallocator.
The parameter "array" should be an array object that was returned by Taipan::new_array.
References escript::Taipan::Taipan_MemTable::array, escript::Taipan::Taipan_StatTable::deallocated_elements, escript::Taipan::Taipan_StatTable::deallocations, escript::Taipan::Taipan_MemTable::dim, escript::Taipan::Taipan_MemTable::free, escript::Taipan::Taipan_StatTable::frees, memTable_Root, N, escript::Taipan::Taipan_MemTable::N, escript::Taipan::Taipan_MemTable::next, statTable, and totalElements.
Referenced by escript::DataVector::copyFromArray(), escript::DataVector::operator=(), escript::DataVector::resize(), and escript::DataVector::~DataVector().
void escript::Taipan::dump_stats | ( | ) |
Print out statistics on the memory under management.
References escript::Taipan::Taipan_StatTable::allocated_elements, escript::Taipan::Taipan_StatTable::allocations, escript::Taipan::Taipan_StatTable::deallocated_elements, escript::Taipan::Taipan_StatTable::deallocations, escript::Taipan::Taipan_StatTable::frees, escript::Taipan::Taipan_StatTable::max_tab_size, num_arrays(), num_elements(), escript::Taipan::Taipan_StatTable::requests, statTable, and totalElements.
Referenced by ~Taipan().
double * escript::Taipan::new_array | ( | size_type | dim, |
size_type | N | ||
) |
Taipan data-array allocator.
The parameter "dim" defines the contiguous "blocksize" within the array. Where the array is allocated accross multiple threads, it will be split on block boundaries only. N defines the number of "blocks" in the array.
References escript::Taipan::Taipan_StatTable::allocated_elements, escript::Taipan::Taipan_StatTable::allocations, escript::Taipan::Taipan_MemTable::array, escript::Taipan::Taipan_MemTable::dim, escript::Taipan::Taipan_MemTable::free, escript::Taipan::Taipan_StatTable::max_tab_size, memTable_Root, N, escript::Taipan::Taipan_MemTable::N, escript::Taipan::Taipan_MemTable::next, escript::Taipan::Taipan_MemTable::numThreads, escript::Taipan::Taipan_StatTable::requests, statTable, and totalElements.
Referenced by escript::DataVector::copyFromArray(), escript::DataVector::DataVector(), escript::DataVector::operator=(), and escript::DataVector::resize().
int escript::Taipan::num_arrays | ( | ) |
Calculate the total number of arrays currently under management.
References memTable_Root, escript::Taipan::Taipan_MemTable::next, and totalElements.
Referenced by dump_stats(), and num_arrays().
int escript::Taipan::num_arrays | ( | size_type | N | ) |
Calculate the total number of arrays of N blocks currently under management.
References memTable_Root, escript::Taipan::Taipan_MemTable::N, escript::Taipan::Taipan_MemTable::next, num_arrays(), and totalElements.
long escript::Taipan::num_elements | ( | ) |
Return the total number of array elements currently under management.
References totalElements.
Referenced by dump_stats().
int escript::Taipan::num_free | ( | size_type | N | ) |
Calculate the total number of free arrays of N blocks currently under management.
References escript::Taipan::Taipan_MemTable::free, memTable_Root, escript::Taipan::Taipan_MemTable::N, escript::Taipan::Taipan_MemTable::next, and totalElements.
void escript::Taipan::operator= | ( | const Taipan & | c | ) | [inline, private] |
Declared (private) as a precaution to ensure that noone tries to copy instances.
frees all arrays that are currently unused.
References escript::Taipan::Taipan_MemTable::array, escript::Taipan::Taipan_StatTable::deallocated_elements, escript::Taipan::Taipan_StatTable::deallocations, escript::Taipan::Taipan_MemTable::dim, escript::Taipan::Taipan_MemTable::free, memTable_Root, escript::Taipan::Taipan_MemTable::N, escript::Taipan::Taipan_MemTable::next, statTable, and totalElements.
Referenced by escript::releaseUnusedMemory().
Taipan_MemTable* escript::Taipan::memTable_Root [private] |
Referenced by delete_array(), new_array(), num_arrays(), num_free(), release_unused_arrays(), and ~Taipan().
Taipan_StatTable* escript::Taipan::statTable [private] |
Referenced by clear_stats(), delete_array(), dump_stats(), new_array(), release_unused_arrays(), Taipan(), and ~Taipan().
long escript::Taipan::totalElements [private] |
Referenced by clear_stats(), delete_array(), dump_stats(), new_array(), num_arrays(), num_elements(), num_free(), release_unused_arrays(), and ~Taipan().