/[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 1388 by trankine, Fri Jan 11 07:45:58 2008 UTC
# Line 1  Line 1 
1  /*  
2   ******************************************************************************  /* $Id$ */
3   *                                                                            *  
4   *       COPYRIGHT  ACcESS 2004 -  All Rights Reserved                        *  /*******************************************************
5   *                                                                            *   *
6   * This software is the property of ACcESS. No part of this code              *   *           Copyright 2003-2007 by ACceSS MNRF
7   * may be copied in any form or by any means without the expressed written    *   *       Copyright 2007 by University of Queensland
8   * consent of ACcESS.  Copying, use or modification of this software          *   *
9   * by any unauthorised person is illegal unless that person has a software    *   *                http://esscc.uq.edu.au
10   * license agreement with ACcESS.                                             *   *        Primary Business: Queensland, Australia
11   *                                                                            *   *  Licensed under the Open Software License version 3.0
12   ******************************************************************************   *     http://www.opensource.org/licenses/osl-3.0.php
13  */   *
14     *******************************************************/
15    
16  #if !defined escript_Taipan_20050427_H  #if !defined escript_Taipan_20050427_H
17  #define escript_Taipan_20050427_H  #define escript_Taipan_20050427_H
18    #include "system_dep.h"
19    
20  namespace escript {  namespace escript {
21    
# Line 26  namespace escript { Line 28  namespace escript {
28     Taipan: data-array manager.     Taipan: data-array manager.
29    
30     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.
31     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
32     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
33     and added to the pool of managed arrays.     and added to the buffer of managed arrays.
34    
35     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
36     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
37     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
38       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  
39  */  */
40    
41  class Taipan {  class ESCRIPT_DLL_API Taipan {
42    
43   public:   public:
44    
# Line 80  class Taipan { Line 79  class Taipan {
79       The parameter "dim" defines the contiguous "blocksize" within the array.       The parameter "dim" defines the contiguous "blocksize" within the array.
80       Where the array is allocated accross multiple threads, it will be split       Where the array is allocated accross multiple threads, it will be split
81       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.  
82    */    */
83    double*    double*
84    new_array(int dim, int N);    new_array(int dim, int N);
# Line 99  class Taipan { Line 94  class Taipan {
94    
95    /**    /**
96       \brief       \brief
97         frees all arrays that are currently unused.
98    
99      */
100      void
101      release_unused_arrays();
102    
103      /**
104         \brief
105       Calculate the total number of arrays currently under management.       Calculate the total number of arrays currently under management.
106    */    */
107    int    int
# Line 124  class Taipan { Line 127  class Taipan {
127    */    */
128    long    long
129    num_elements();    num_elements();
130    
131      /**
132         \brief
133         Print out statistics on the memory under management.
134      */
135      void
136      dump_stats();
137    
138      /**
139         \brief
140         Clear record of statistics on the memory under management.
141      */
142      void
143      clear_stats();
144    
145   protected:   protected:
146    
147   private:   private:
148    
149      typedef struct Taipan_StatTable {
150        int requests;
151        int frees;
152        int allocations;
153        int deallocations;
154        long allocated_elements;
155        long deallocated_elements;
156        long max_tab_size;
157      } Taipan_StatTable;
158    
159      Taipan_StatTable* statTable;
160    
161    typedef struct Taipan_MemTable {    typedef struct Taipan_MemTable {
162      double* array;      double* array;
163      int dim;      int dim;

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

  ViewVC Help
Powered by ViewVC 1.1.26