escript  Revision_
Taipan.h
Go to the documentation of this file.
1 
2 /*****************************************************************************
3 *
4 * Copyright (c) 2003-2020 by The University of Queensland
5 * http://www.uq.edu.au
6 *
7 * Primary Business: Queensland, Australia
8 * Licensed under the Apache License, version 2.0
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Development until 2012 by Earth Systems Science Computational Center (ESSCC)
12 * Development 2012-2013 by School of Earth Sciences
13 * Development from 2014-2017 by Centre for Geoscience Computing (GeoComp)
14 * Development from 2019 by School of Earth and Environmental Sciences
15 **
16 *****************************************************************************/
17 
18 
19 #if !defined escript_Taipan_20050427_H
20 #define escript_Taipan_20050427_H
21 #include "system_dep.h"
22 
23 namespace escript {
24 
44 class ESCRIPT_DLL_API Taipan {
45 
46  public:
47 
48 typedef long size_type; // needs to be parallelised by openmp. It should not take negative values.
49  // do not assume that it is unsigned though
50 
64  Taipan();
65 
79  ~Taipan();
80 
89  double*
90  new_array(size_type dim, size_type N);
91 
98  void
99  delete_array(double* array);
100 
106  void
107  release_unused_arrays();
108 
113  int
114  num_arrays();
115 
120  int
121  num_arrays(size_type N);
122 
127  int
128  num_free(size_type N);
129 
134  long
135  num_elements();
136 
141  void
142  dump_stats();
143 
148  void
149  clear_stats();
150 
151  protected:
152 
153  private:
157  void operator=(const Taipan& c){}
158 
159  typedef struct Taipan_StatTable {
160  int requests;
161  int frees;
162  int allocations;
163  int deallocations;
164  long allocated_elements;
165  long deallocated_elements;
166  long max_tab_size;
167  } Taipan_StatTable;
168 
169  Taipan_StatTable* statTable;
170 
171  typedef struct Taipan_MemTable {
172  double* array;
173  size_type dim;
174  size_type N;
175  int numThreads;
176  bool free;
177  struct Taipan_MemTable* next;
178  } Taipan_MemTable;
179 
180  Taipan_MemTable* memTable_Root;
181 
182  long totalElements;
183 
184 };
185 
186 } // end of namespace
187 
188 #endif
ESCRIPT_DLL_API
#define ESCRIPT_DLL_API
Definition: escriptcore/src/system_dep.h:30
paso::N
static dim_t N
Definition: SparseMatrix_saveHB.cpp:52
escript::Taipan::Taipan_StatTable::frees
int frees
Definition: Taipan.h:189
escript::Taipan::Taipan_MemTable::next
struct Taipan_MemTable * next
Definition: Taipan.h:205
escript::Taipan::totalElements
long totalElements
Definition: Taipan.h:210
escript::Taipan::Taipan_MemTable
struct escript::Taipan::Taipan_MemTable Taipan_MemTable
escript::Distribution_ptr
boost::shared_ptr< Distribution > Distribution_ptr
Definition: Distribution.h:39
escript::Taipan::num_arrays
int num_arrays()
Calculate the total number of arrays currently under management.
Definition: Taipan.cpp:275
paso::SystemMatrixPattern::col_connector
Connector_ptr col_connector
Definition: SystemMatrixPattern.h:81
escript::Taipan::memTable_Root
Taipan_MemTable * memTable_Root
Definition: Taipan.h:208
paso::SystemMatrixPattern_ptr
boost::shared_ptr< SystemMatrixPattern > SystemMatrixPattern_ptr
Definition: SystemMatrixPattern.h:54
paso::SystemMatrixPattern::SystemMatrixPattern
SystemMatrixPattern(int type, escript::Distribution_ptr output_distribution, escript::Distribution_ptr input_distribution, Pattern_ptr mainPattern, Pattern_ptr col_couplePattern, Pattern_ptr row_couplePattern, Connector_ptr col_connector, Connector_ptr row_connector)
Definition: SystemMatrixPattern.cpp:48
escript::Taipan::Taipan_StatTable::deallocations
int deallocations
Definition: Taipan.h:191
escript::Taipan::Taipan_StatTable::allocated_elements
long allocated_elements
Definition: Taipan.h:192
paso::SystemMatrixPattern::output_distribution
escript::Distribution_ptr output_distribution
Definition: SystemMatrixPattern.h:83
escript::Taipan::Taipan_MemTable::array
double * array
Definition: Taipan.h:200
MATRIX_FORMAT_OFFSET1
#define MATRIX_FORMAT_OFFSET1
Definition: Paso.h:65
escript::Distribution
Definition: Distribution.h:46
paso::SystemMatrixPattern::row_connector
Connector_ptr row_connector
Definition: SystemMatrixPattern.h:82
escript::Taipan::clear_stats
void clear_stats()
Clear record of statistics on the memory under management.
Definition: Taipan.cpp:368
system_dep.h
paso::SystemMatrixPattern::type
int type
Definition: SystemMatrixPattern.h:76
escript::Taipan::Taipan_StatTable::requests
int requests
Definition: Taipan.h:188
escript::Taipan::size_type
long size_type
Definition: Taipan.h:76
escript::Taipan::statTable
Taipan_StatTable * statTable
Definition: Taipan.h:197
escript::Taipan::Taipan_MemTable::dim
size_type dim
Definition: Taipan.h:201
escript::DataTypes::dim_t
index_t dim_t
Definition: DataTypes.h:93
escript::Taipan::Taipan_StatTable
struct escript::Taipan::Taipan_StatTable Taipan_StatTable
escript::Taipan::~Taipan
~Taipan()
Default destructor for Taipan data-array manager.
Definition: Taipan.cpp:41
SystemMatrixPattern.h
paso::SystemMatrixPattern::input_distribution
escript::Distribution_ptr input_distribution
Definition: SystemMatrixPattern.h:84
Taipan.h
escript::Taipan::Taipan_MemTable::numThreads
int numThreads
Definition: Taipan.h:203
escript::Taipan::num_free
int num_free(size_type N)
Calculate the total number of free arrays of N blocks currently under management.
Definition: Taipan.cpp:315
escript::Taipan::new_array
double * new_array(size_type dim, size_type N)
Taipan data-array allocator.
Definition: Taipan.cpp:105
escript::Taipan::dump_stats
void dump_stats()
Print out statistics on the memory under management.
Definition: Taipan.cpp:345
escript::Taipan::delete_array
void delete_array(double *array)
Taipan data-array deallocator.
Definition: Taipan.cpp:192
escript::Taipan::Taipan_StatTable::allocations
int allocations
Definition: Taipan.h:190
escript::Taipan::Taipan_StatTable::max_tab_size
long max_tab_size
Definition: Taipan.h:194
escript
Definition: AbstractContinuousDomain.cpp:23
paso::SystemMatrixPattern::row_couplePattern
Pattern_ptr row_couplePattern
Definition: SystemMatrixPattern.h:80
escript::Taipan::Taipan_MemTable::N
size_type N
Definition: Taipan.h:202
paso::SystemMatrixPattern::unrollBlocks
SystemMatrixPattern_ptr unrollBlocks(int type, dim_t output_block_size, dim_t input_block_size)
Definition: SystemMatrixPattern_unrollBlocks.cpp:47
escript::Taipan::Taipan_StatTable::deallocated_elements
long deallocated_elements
Definition: Taipan.h:193
escript::Taipan::Taipan_MemTable::free
bool free
Definition: Taipan.h:204
paso::SystemMatrixPattern::col_couplePattern
Pattern_ptr col_couplePattern
Definition: SystemMatrixPattern.h:79
paso::Connector_ptr
boost::shared_ptr< Connector > Connector_ptr
Definition: Coupler.h:52
paso::Pattern_ptr
boost::shared_ptr< Pattern > Pattern_ptr
Definition: Pattern.h:52
escript::Taipan::num_elements
long num_elements()
Return the total number of array elements currently under management.
Definition: Taipan.cpp:337
escript::Taipan::Taipan_MemTable
Definition: Taipan.h:199
paso
Definition: BiCGStab.cpp:26
escript::Taipan::release_unused_arrays
void release_unused_arrays()
frees all arrays that are currently unused.
Definition: Taipan.cpp:74
paso::SystemMatrixPattern::mainPattern
Pattern_ptr mainPattern
Definition: SystemMatrixPattern.h:78