/[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/Taipan.h revision 757 by woo409, Mon Jun 26 13:12:56 2006 UTC
# Line 1  Line 1 
1  /*  /*
2   ******************************************************************************   ************************************************************
3   *                                                                            *   *          Copyright 2006 by ACcESS MNRF                   *
4   *       COPYRIGHT  ACcESS 2004 -  All Rights Reserved                        *   *                                                          *
5   *                                                                            *   *              http://www.access.edu.au                    *
6   * This software is the property of ACcESS. No part of this code              *   *       Primary Business: Queensland, Australia            *
7   * may be copied in any form or by any means without the expressed written    *   *  Licensed under the Open Software License version 3.0    *
8   * consent of ACcESS.  Copying, use or modification of this software          *   *     http://www.opensource.org/licenses/osl-3.0.php       *
9   * by any unauthorised person is illegal unless that person has a software    *   *                                                          *
10   * license agreement with ACcESS.                                             *   ************************************************************
  *                                                                            *  
  ******************************************************************************  
11  */  */
12    
13  #if !defined escript_Taipan_20050427_H  #if !defined escript_Taipan_20050427_H
14  #define escript_Taipan_20050427_H  #define escript_Taipan_20050427_H
15    #include "system_dep.h"
16    
17  namespace escript {  namespace escript {
18    
# Line 26  namespace escript { Line 25  namespace escript {
25     Taipan: data-array manager.     Taipan: data-array manager.
26    
27     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.
28     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
29     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
30     and added to the pool of managed arrays.     and added to the buffer of managed arrays.
31    
32     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
33     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
34     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
35       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  
36  */  */
37    
38  class Taipan {  class ESCRIPT_DLL_API Taipan {
39    
40   public:   public:
41    
# Line 80  class Taipan { Line 76  class Taipan {
76       The parameter "dim" defines the contiguous "blocksize" within the array.       The parameter "dim" defines the contiguous "blocksize" within the array.
77       Where the array is allocated accross multiple threads, it will be split       Where the array is allocated accross multiple threads, it will be split
78       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.  
79    */    */
80    double*    double*
81    new_array(int dim, int N);    new_array(int dim, int N);
# Line 124  class Taipan { Line 116  class Taipan {
116    */    */
117    long    long
118    num_elements();    num_elements();
119    
120      /**
121         \brief
122         Print out statistics on the memory under management.
123      */
124      void
125      dump_stats();
126    
127      /**
128         \brief
129         Clear record of statistics on the memory under management.
130      */
131      void
132      clear_stats();
133    
134   protected:   protected:
135    
136   private:   private:
137    
138      typedef struct Taipan_StatTable {
139        int requests;
140        int frees;
141        int allocations;
142        int deallocations;
143        long allocated_elements;
144        long deallocated_elements;
145        long max_tab_size;
146      } Taipan_StatTable;
147    
148      Taipan_StatTable* statTable;
149    
150    typedef struct Taipan_MemTable {    typedef struct Taipan_MemTable {
151      double* array;      double* array;
152      int dim;      int dim;

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

  ViewVC Help
Powered by ViewVC 1.1.26