/[escript]/trunk/escript/src/Taipan.h
ViewVC logotype

Diff of /trunk/escript/src/Taipan.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

trunk/esys2/escript/src/Data/Taipan.h revision 121 by jgs, Fri May 6 04:26:16 2005 UTC trunk/escript/src/Data/Taipan.h revision 155 by jgs, Wed Nov 9 02:02:19 2005 UTC
# Line 26  namespace escript { Line 26  namespace escript {
26     Taipan: data-array manager.     Taipan: data-array manager.
27    
28     The Taipan data-array manager holds a set of (dim x N) arrays distributed across a number of threads.     The Taipan data-array manager holds a set of (dim x N) arrays distributed across a number of threads.
29     If a (dim x N) array is requested via the Taipan allocator, the pool of managed arrays is searched for     If a (dim x N) array is requested via the Taipan allocator, the buffer of managed arrays is searched for
30     a free array of this size on the current number of threads. If none is available, a new one is allocated     a free array of this size on the current number of threads. If none is available, a new one is allocated
31     and added to the pool of managed arrays.     and added to the buffer of managed arrays.
32    
33     When a managed array is deallocated, the array is marked as free but not returned to the system as long     When a managed array is deallocated, the array is marked as free but not returned to the system as long
34     as at least one array with dimension N is in use. Otherwise all arrays with second dimsenion N are     as at least one array of N is in use. Otherwise all arrays of N are deallocated as it is assumed that
35     deallocated as it is assumed that arrays with second dimension N will not be used anymore.     these arrays not be used anymore. The exceptions to this strategy are arrays with N=0 or N=1, these
36       arrays are never deallocated, but are kept for possible reuse.
    Template Parameters:  
    For templates describe any conditions that the parameters used in the  
    template must satisfy  
37  */  */
38    
39  class Taipan {  class Taipan {
# Line 80  class Taipan { Line 77  class Taipan {
77       The parameter "dim" defines the contiguous "blocksize" within the array.       The parameter "dim" defines the contiguous "blocksize" within the array.
78       Where the array is allocated accross multiple threads, it will be split       Where the array is allocated accross multiple threads, it will be split
79       on block boundaries only. N defines the number of "blocks" in the array.       on block boundaries only. N defines the number of "blocks" in the array.
   
      Where escript Data objects are concerned, N corresponds to the number of samples,  
      and dim correesponds to the number of data-points per sample multiplied by the  
      number of entries in a data-point.  
80    */    */
81    double*    double*
82    new_array(int dim, int N);    new_array(int dim, int N);
# Line 124  class Taipan { Line 117  class Taipan {
117    */    */
118    long    long
119    num_elements();    num_elements();
120    
121      /**
122         \brief
123         Print out statistics on the memory under management.
124      */
125      void
126      dump_stats();
127    
128      /**
129         \brief
130         Clear record of statistics on the memory under management.
131      */
132      void
133      clear_stats();
134    
135   protected:   protected:
136    
137   private:   private:
138    
139      typedef struct Taipan_StatTable {
140        int requests;
141        int frees;
142        int allocations;
143        int deallocations;
144        long allocated_elements;
145        long deallocated_elements;
146        long max_tab_size;
147      } Taipan_StatTable;
148    
149      Taipan_StatTable* statTable;
150    
151    typedef struct Taipan_MemTable {    typedef struct Taipan_MemTable {
152      double* array;      double* array;
153      int dim;      int dim;

Legend:
Removed from v.121  
changed lines
  Added in v.155

  ViewVC Help
Powered by ViewVC 1.1.26