escript
Revision_
|
00001 00002 /***************************************************************************** 00003 * 00004 * Copyright (c) 2003-2014 by University of Queensland 00005 * http://www.uq.edu.au 00006 * 00007 * Primary Business: Queensland, Australia 00008 * Licensed under the Open Software License version 3.0 00009 * http://www.opensource.org/licenses/osl-3.0.php 00010 * 00011 * Development until 2012 by Earth Systems Science Computational Center (ESSCC) 00012 * Development 2012-2013 by School of Earth Sciences 00013 * Development from 2014 by Centre for Geoscience Computing (GeoComp) 00014 * 00015 *****************************************************************************/ 00016 00017 00018 #if !defined escript_Taipan_20050427_H 00019 #define escript_Taipan_20050427_H 00020 #include "system_dep.h" 00021 00022 namespace escript { 00023 00043 class ESCRIPT_DLL_API Taipan { 00044 00045 public: 00046 00047 typedef long size_type; // needs to be parallelised by openmp. It should not take negative values. 00048 // do not assume that it is unsigned though 00049 00063 Taipan(); 00064 00078 ~Taipan(); 00079 00088 double* 00089 new_array(size_type dim, size_type N); 00090 00097 void 00098 delete_array(double* array); 00099 00105 void 00106 release_unused_arrays(); 00107 00112 int 00113 num_arrays(); 00114 00119 int 00120 num_arrays(size_type N); 00121 00126 int 00127 num_free(size_type N); 00128 00133 long 00134 num_elements(); 00135 00140 void 00141 dump_stats(); 00142 00147 void 00148 clear_stats(); 00149 00150 protected: 00151 00152 private: 00156 void operator=(const Taipan& c){} 00157 00158 typedef struct Taipan_StatTable { 00159 int requests; 00160 int frees; 00161 int allocations; 00162 int deallocations; 00163 long allocated_elements; 00164 long deallocated_elements; 00165 long max_tab_size; 00166 } Taipan_StatTable; 00167 00168 Taipan_StatTable* statTable; 00169 00170 typedef struct Taipan_MemTable { 00171 double* array; 00172 size_type dim; 00173 size_type N; 00174 int numThreads; 00175 bool free; 00176 struct Taipan_MemTable* next; 00177 } Taipan_MemTable; 00178 00179 Taipan_MemTable* memTable_Root; 00180 00181 long totalElements; 00182 00183 }; 00184 00185 } // end of namespace 00186 00187 #endif