escript  Revision_
Taipan.h
Go to the documentation of this file.
1 
2 /*****************************************************************************
3 *
4 * Copyright (c) 2003-2018 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 by Centre for Geoscience Computing (GeoComp)
14 *
15 *****************************************************************************/
16 
17 
18 #if !defined escript_Taipan_20050427_H
19 #define escript_Taipan_20050427_H
20 #include "system_dep.h"
21 
22 namespace escript {
23 
43 class ESCRIPT_DLL_API Taipan {
44 
45  public:
46 
47 typedef long size_type; // needs to be parallelised by openmp. It should not take negative values.
48  // do not assume that it is unsigned though
49 
63  Taipan();
64 
78  ~Taipan();
79 
88  double*
89  new_array(size_type dim, size_type N);
90 
97  void
98  delete_array(double* array);
99 
105  void
106  release_unused_arrays();
107 
112  int
113  num_arrays();
114 
119  int
120  num_arrays(size_type N);
121 
126  int
127  num_free(size_type N);
128 
133  long
134  num_elements();
135 
140  void
141  dump_stats();
142 
147  void
148  clear_stats();
149 
150  protected:
151 
152  private:
156  void operator=(const Taipan& c){}
157 
158  typedef struct Taipan_StatTable {
159  int requests;
160  int frees;
161  int allocations;
162  int deallocations;
163  long allocated_elements;
164  long deallocated_elements;
165  long max_tab_size;
166  } Taipan_StatTable;
167 
168  Taipan_StatTable* statTable;
169 
170  typedef struct Taipan_MemTable {
171  double* array;
172  size_type dim;
173  size_type N;
174  int numThreads;
175  bool free;
176  struct Taipan_MemTable* next;
177  } Taipan_MemTable;
178 
179  Taipan_MemTable* memTable_Root;
180 
181  long totalElements;
182 
183 };
184 
185 } // end of namespace
186 
187 #endif
ESCRIPT_DLL_API
#define ESCRIPT_DLL_API
Definition: escriptcore/src/system_dep.h:28
paso::N
static dim_t N
Definition: SparseMatrix_saveHB.cpp:48
escript::Taipan::Taipan_StatTable::frees
int frees
Definition: Taipan.h:183
escript::Taipan::Taipan_MemTable::next
struct Taipan_MemTable * next
Definition: Taipan.h:199
escript::Taipan::totalElements
long totalElements
Definition: Taipan.h:204
escript::Distribution_ptr
boost::shared_ptr< Distribution > Distribution_ptr
Definition: Distribution.h:35
escript::Taipan::num_arrays
int num_arrays()
Calculate the total number of arrays currently under management.
Definition: Taipan.cpp:273
paso::SystemMatrixPattern::col_connector
Connector_ptr col_connector
Definition: SystemMatrixPattern.h:77
escript::Taipan::memTable_Root
Taipan_MemTable * memTable_Root
Definition: Taipan.h:202
paso::SystemMatrixPattern_ptr
boost::shared_ptr< SystemMatrixPattern > SystemMatrixPattern_ptr
Definition: SystemMatrixPattern.h:50
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:44
escript::Taipan::Taipan_StatTable::deallocations
int deallocations
Definition: Taipan.h:185
escript::Taipan::Taipan_StatTable::allocated_elements
long allocated_elements
Definition: Taipan.h:186
paso::SystemMatrixPattern::output_distribution
escript::Distribution_ptr output_distribution
Definition: SystemMatrixPattern.h:79
escript::Taipan::Taipan_MemTable::array
double * array
Definition: Taipan.h:194
MATRIX_FORMAT_OFFSET1
#define MATRIX_FORMAT_OFFSET1
Definition: Paso.h:63
escript::Distribution
Definition: Distribution.h:42
paso::SystemMatrixPattern::row_connector
Connector_ptr row_connector
Definition: SystemMatrixPattern.h:78
escript::Taipan::clear_stats
void clear_stats()
Clear record of statistics on the memory under management.
Definition: Taipan.cpp:366
system_dep.h
paso::SystemMatrixPattern::type
int type
Definition: SystemMatrixPattern.h:72
escript::Taipan::Taipan_StatTable::requests
int requests
Definition: Taipan.h:182
escript::Taipan::size_type
long size_type
Definition: Taipan.h:70
escript::Taipan::statTable
Taipan_StatTable * statTable
Definition: Taipan.h:191
escript::Taipan::Taipan_MemTable::dim
size_type dim
Definition: Taipan.h:195
escript::DataTypes::dim_t
index_t dim_t
Definition: DataTypes.h:87
escript::Taipan::~Taipan
~Taipan()
Default destructor for Taipan data-array manager.
Definition: Taipan.cpp:39
SystemMatrixPattern.h
paso::SystemMatrixPattern::input_distribution
escript::Distribution_ptr input_distribution
Definition: SystemMatrixPattern.h:80
escript::Taipan::Taipan_StatTable
struct escript::Taipan::Taipan_StatTable Taipan_StatTable
Taipan.h
escript::Taipan::Taipan_MemTable::numThreads
int numThreads
Definition: Taipan.h:197
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:313
escript::Taipan::new_array
double * new_array(size_type dim, size_type N)
Taipan data-array allocator.
Definition: Taipan.cpp:103
escript::Taipan::dump_stats
void dump_stats()
Print out statistics on the memory under management.
Definition: Taipan.cpp:343
escript::Taipan::delete_array
void delete_array(double *array)
Taipan data-array deallocator.
Definition: Taipan.cpp:190
escript::Taipan::Taipan_StatTable::allocations
int allocations
Definition: Taipan.h:184
escript::Taipan::Taipan_StatTable::max_tab_size
long max_tab_size
Definition: Taipan.h:188
escript
Definition: AbstractContinuousDomain.cpp:22
paso::SystemMatrixPattern::row_couplePattern
Pattern_ptr row_couplePattern
Definition: SystemMatrixPattern.h:76
escript::Taipan::Taipan_MemTable::N
size_type N
Definition: Taipan.h:196
paso::SystemMatrixPattern::unrollBlocks
SystemMatrixPattern_ptr unrollBlocks(int type, dim_t output_block_size, dim_t input_block_size)
Definition: SystemMatrixPattern_unrollBlocks.cpp:43
escript::Taipan::Taipan_StatTable::deallocated_elements
long deallocated_elements
Definition: Taipan.h:187
escript::Taipan::Taipan_MemTable::free
bool free
Definition: Taipan.h:198
paso::SystemMatrixPattern::col_couplePattern
Pattern_ptr col_couplePattern
Definition: SystemMatrixPattern.h:75
escript::Taipan::Taipan_MemTable
struct escript::Taipan::Taipan_MemTable Taipan_MemTable
paso::Connector_ptr
boost::shared_ptr< Connector > Connector_ptr
Definition: Coupler.h:48
paso::Pattern_ptr
boost::shared_ptr< Pattern > Pattern_ptr
Definition: Pattern.h:48
escript::Taipan::num_elements
long num_elements()
Return the total number of array elements currently under management.
Definition: Taipan.cpp:335
escript::Taipan::Taipan_MemTable
Definition: Taipan.h:193
paso
Definition: BiCGStab.cpp:25
escript::Taipan::release_unused_arrays
void release_unused_arrays()
frees all arrays that are currently unused.
Definition: Taipan.cpp:72
paso::SystemMatrixPattern::mainPattern
Pattern_ptr mainPattern
Definition: SystemMatrixPattern.h:74