Commit 055857ca authored by Kirill Terekhov's avatar Kirill Terekhov

add functions to check memory usage; reduce memory usage by multilevel solver; fix some warnings

parent 07d81fc9
...@@ -214,7 +214,7 @@ namespace INMOST ...@@ -214,7 +214,7 @@ namespace INMOST
void Automatizator::EnumerateEntries() void Automatizator::EnumerateEntries()
{ {
first_num = last_num = 0; first_num = last_num = 0;
const ElementType paralleltypes = NODE | EDGE | FACE | CELL; const ElementType paralleltypes = NODE | EDGE | FACE | CELL | ESET;
for (unsigned it = 0; it < reg_blocks.size(); ++it) if( act_blocks[it] ) for (unsigned it = 0; it < reg_blocks.size(); ++it) if( act_blocks[it] )
{ {
......
...@@ -330,10 +330,10 @@ namespace INMOST ...@@ -330,10 +330,10 @@ namespace INMOST
template<typename Var> template<typename Var>
class ConstBlockOfMatrix; class ConstBlockOfMatrix;
template<typename Var, typename Storage = array<Var> > template<typename Var, typename Storage = std::vector<Var> >
class Matrix; class Matrix;
template<typename Var, typename Storage = array<Var> > template<typename Var, typename Storage = std::vector<Var> >
class SymmetricMatrix; class SymmetricMatrix;
} }
...@@ -343,5 +343,8 @@ __INLINE bool __isnan__(double x) { return x != x; } ...@@ -343,5 +343,8 @@ __INLINE bool __isnan__(double x) { return x != x; }
__INLINE bool __isinf__(double x) { return fabs(x) > DBL_MAX; } __INLINE bool __isinf__(double x) { return fabs(x) > DBL_MAX; }
__INLINE bool __isbad(double x) { return __isnan__(x) || __isinf__(x); } __INLINE bool __isbad(double x) { return __isnan__(x) || __isinf__(x); }
//in Utils/mem.cpp
size_t getPeakRSS();
size_t getCurrentRSS();
#endif //INMOST_COMMON_INCLUDED #endif //INMOST_COMMON_INCLUDED
...@@ -275,8 +275,6 @@ namespace INMOST ...@@ -275,8 +275,6 @@ namespace INMOST
else return false; else return false;
} //m <= n } //m <= n
std::vector<Var> rv1(m); std::vector<Var> rv1(m);
//array<Var> _rv1(m);
//shell<Var> rv1(_rv1);
std::swap(n,m); //this how original algorithm takes it std::swap(n,m); //this how original algorithm takes it
// Householder reduction to bidiagonal form // Householder reduction to bidiagonal form
for (i = 0; i < n; i++) for (i = 0; i < n; i++)
...@@ -1234,7 +1232,6 @@ namespace INMOST ...@@ -1234,7 +1232,6 @@ namespace INMOST
using AbstractMatrix<Var>::operator(); using AbstractMatrix<Var>::operator();
typedef unsigned enumerator; //< Integer type for indexes. typedef unsigned enumerator; //< Integer type for indexes.
protected: protected:
//array<Var> space; //< Array of row-wise stored elements.
storage_type space; //< Array of row-wise stored elements. storage_type space; //< Array of row-wise stored elements.
enumerator n; //< Number of rows. enumerator n; //< Number of rows.
enumerator m; //< Number of columns. enumerator m; //< Number of columns.
...@@ -3626,16 +3623,15 @@ namespace INMOST ...@@ -3626,16 +3623,15 @@ namespace INMOST
int n = Rows(); int n = Rows();
int m = Cols(); int m = Cols();
INMOST_DATA_REAL_TYPE u, l; INMOST_DATA_REAL_TYPE u, l;
array<INMOST_DATA_REAL_TYPE> Cmax(m,0.0); std::vector<INMOST_DATA_REAL_TYPE> Cmax(m,0.0);
array<INMOST_DATA_REAL_TYPE> U(m,std::numeric_limits<INMOST_DATA_REAL_TYPE>::max()); std::vector<INMOST_DATA_REAL_TYPE> U(m,std::numeric_limits<INMOST_DATA_REAL_TYPE>::max());
array<INMOST_DATA_REAL_TYPE> V(n,std::numeric_limits<INMOST_DATA_REAL_TYPE>::max()); std::vector<INMOST_DATA_REAL_TYPE> V(n,std::numeric_limits<INMOST_DATA_REAL_TYPE>::max());
std::fill(Perm,Perm+m,ENUMUNDEF); std::fill(Perm,Perm+m,ENUMUNDEF);
//array<INMOST_DATA_ENUM_TYPE> Perm(m,ENUMUNDEF); std::vector<INMOST_DATA_ENUM_TYPE> IPerm(std::max(n,m),ENUMUNDEF);
array<INMOST_DATA_ENUM_TYPE> IPerm(std::max(n,m),ENUMUNDEF); std::vector<INMOST_DATA_ENUM_TYPE> ColumnList(m,ENUMUNDEF);
array<INMOST_DATA_ENUM_TYPE> ColumnList(m,ENUMUNDEF); std::vector<INMOST_DATA_ENUM_TYPE> ColumnPosition(n,ENUMUNDEF);
array<INMOST_DATA_ENUM_TYPE> ColumnPosition(n,ENUMUNDEF); std::vector<INMOST_DATA_ENUM_TYPE> Parent(n,ENUMUNDEF);
array<INMOST_DATA_ENUM_TYPE> Parent(n,ENUMUNDEF); std::vector<INMOST_DATA_REAL_TYPE> Dist(m,std::numeric_limits<INMOST_DATA_REAL_TYPE>::max());
array<INMOST_DATA_REAL_TYPE> Dist(m,std::numeric_limits<INMOST_DATA_REAL_TYPE>::max());
const AbstractMatrix<Var> & A = *this; const AbstractMatrix<Var> & A = *this;
Matrix<INMOST_DATA_REAL_TYPE> C(n,m); Matrix<INMOST_DATA_REAL_TYPE> C(n,m);
INMOST_DATA_ENUM_TYPE Li, Ui; INMOST_DATA_ENUM_TYPE Li, Ui;
...@@ -3847,10 +3843,6 @@ namespace INMOST ...@@ -3847,10 +3843,6 @@ namespace INMOST
typedef Matrix<INMOST_DATA_INTEGER_TYPE> iMatrix; typedef Matrix<INMOST_DATA_INTEGER_TYPE> iMatrix;
/// shortcut for matrix of real values. /// shortcut for matrix of real values.
typedef Matrix<INMOST_DATA_REAL_TYPE> rMatrix; typedef Matrix<INMOST_DATA_REAL_TYPE> rMatrix;
/// shortcut for matrix of integer values in stack-preallocated and dynamically reallocated array.
//typedef Matrix<INMOST_DATA_INTEGER_TYPE,dynarray<INMOST_DATA_INTEGER_TYPE,128> > idMatrix;
/// shortcut for matrix of real values in stack-preallocated and dynamically reallocated array.
//typedef Matrix<INMOST_DATA_REAL_TYPE, dynarray<INMOST_DATA_REAL_TYPE,128> > rdMatrix;
/// shortcut for matrix of integer values in pool-allocated array (beaware of deallocation order issue). /// shortcut for matrix of integer values in pool-allocated array (beaware of deallocation order issue).
typedef Matrix<INMOST_DATA_INTEGER_TYPE,pool_array_t<INMOST_DATA_INTEGER_TYPE> > ipMatrix; typedef Matrix<INMOST_DATA_INTEGER_TYPE,pool_array_t<INMOST_DATA_INTEGER_TYPE> > ipMatrix;
/// shortcut for matrix of real values in pool-allocated array (beaware of deallocation order issue). /// shortcut for matrix of real values in pool-allocated array (beaware of deallocation order issue).
...@@ -3863,10 +3855,6 @@ namespace INMOST ...@@ -3863,10 +3855,6 @@ namespace INMOST
typedef SymmetricMatrix<INMOST_DATA_INTEGER_TYPE> iSymmetricMatrix; typedef SymmetricMatrix<INMOST_DATA_INTEGER_TYPE> iSymmetricMatrix;
/// shortcut for symmetric matrix of real values. /// shortcut for symmetric matrix of real values.
typedef SymmetricMatrix<INMOST_DATA_REAL_TYPE> rSymmetricMatrix; typedef SymmetricMatrix<INMOST_DATA_REAL_TYPE> rSymmetricMatrix;
/// shortcut for symmetric matrix of integer values in stack-preallocated and dynamically reallocated array.
//typedef SymmetricMatrix<INMOST_DATA_INTEGER_TYPE,dynarray<INMOST_DATA_INTEGER_TYPE,128> > idSymmetricMatrix;
/// shortcut for symmetric matrix of real values in stack-preallocated and dynamically reallocated array.
//typedef SymmetricMatrix<INMOST_DATA_REAL_TYPE,dynarray<INMOST_DATA_REAL_TYPE,128> > rdSymmetricMatrix;
/// shortcut for symmetric matrix of integer values in pool-allocated array (beaware of deallocation order issue). /// shortcut for symmetric matrix of integer values in pool-allocated array (beaware of deallocation order issue).
typedef SymmetricMatrix<INMOST_DATA_INTEGER_TYPE,pool_array_t<INMOST_DATA_INTEGER_TYPE> > ipSymmetricMatrix; typedef SymmetricMatrix<INMOST_DATA_INTEGER_TYPE,pool_array_t<INMOST_DATA_INTEGER_TYPE> > ipSymmetricMatrix;
/// shortcut for symmetric matrix of real values in pool-allocated array (beaware of deallocation order issue). /// shortcut for symmetric matrix of real values in pool-allocated array (beaware of deallocation order issue).
...@@ -3887,12 +3875,6 @@ namespace INMOST ...@@ -3887,12 +3875,6 @@ namespace INMOST
typedef Matrix<variable> vMatrix; typedef Matrix<variable> vMatrix;
//< shortcut for matrix of variables with first and second order derivatives. //< shortcut for matrix of variables with first and second order derivatives.
typedef Matrix<hessian_variable> hMatrix; typedef Matrix<hessian_variable> hMatrix;
/// shortcut for matrix of variables with single unit entry of first order derivative in stack-preallocated and dynamically reallocated array.
//typedef Matrix<unknown, dynarray<unknown,128> > udMatrix;
/// shortcut for matrix of variables with first order derivatives in stack-preallocated and dynamically reallocated array.
//typedef Matrix<variable, dynarray<variable,128> > vdMatrix;
//< shortcut for matrix of variables with first and second order derivatives in stack-preallocated and dynamically reallocated array.
//typedef Matrix<hessian_variable, dynarray<hessian_variable,128> > hdMatrix;
/// shortcut for matrix of variables with single unit entry of first order derivative in pool-allocated array (beaware of deallocation order issue). /// shortcut for matrix of variables with single unit entry of first order derivative in pool-allocated array (beaware of deallocation order issue).
typedef Matrix<unknown, pool_array_t<unknown> > upMatrix; typedef Matrix<unknown, pool_array_t<unknown> > upMatrix;
/// shortcut for matrix of variables with first order derivatives in pool-allocated array (beaware of deallocation order issue). /// shortcut for matrix of variables with first order derivatives in pool-allocated array (beaware of deallocation order issue).
...@@ -3911,12 +3893,6 @@ namespace INMOST ...@@ -3911,12 +3893,6 @@ namespace INMOST
typedef SymmetricMatrix<variable,shell<variable> > vaSymmetricMatrix; typedef SymmetricMatrix<variable,shell<variable> > vaSymmetricMatrix;
/// shortcut for matrix of variables in existing array. /// shortcut for matrix of variables in existing array.
typedef SymmetricMatrix<hessian_variable,shell<hessian_variable> > haSymmetricMatrix; typedef SymmetricMatrix<hessian_variable,shell<hessian_variable> > haSymmetricMatrix;
/// shortcut for symmetric matrix of variables with single unit entry of first order derivative in stack-preallocated and dynamically reallocated array.
//typedef SymmetricMatrix<unknown, dynarray<unknown,128> > udSymmetricMatrix;
/// shortcut for symmetric matrix of variables with first order derivatives in stack-preallocated and dynamically reallocated array.
//typedef SymmetricMatrix<variable, dynarray<variable,128> > vdSymmetricMatrix;
//< shortcut for symmetric matrix of variables with first and second order derivatives in stack-preallocated and dynamically reallocated array.
//typedef SymmetricMatrix<hessian_variable, dynarray<hessian_variable,128> > hdSymmetricMatrix;
/// shortcut for symmetric matrix of variables with single unit entry of first order derivative in pool-allocated array (beaware of deallocation order issue). /// shortcut for symmetric matrix of variables with single unit entry of first order derivative in pool-allocated array (beaware of deallocation order issue).
typedef SymmetricMatrix<unknown, pool_array_t<unknown> > upSymmetricMatrix; typedef SymmetricMatrix<unknown, pool_array_t<unknown> > upSymmetricMatrix;
/// shortcut for symmetric matrix of variables with first order derivatives in pool-allocated array (beaware of deallocation order issue). /// shortcut for symmetric matrix of variables with first order derivatives in pool-allocated array (beaware of deallocation order issue).
......
...@@ -177,8 +177,7 @@ namespace INMOST ...@@ -177,8 +177,7 @@ namespace INMOST
return ret; return ret;
} }
private: private:
//typedef dynarray<entry,16> Entries; //replace later with more memory-efficient chunk_array, with first chunk in stack typedef std::vector<entry> Entries; ///< Container type for
typedef array<entry> Entries; ///< Container type for
public: public:
typedef Entries::iterator iterator; ///< Iterator over pairs of index and value. typedef Entries::iterator iterator; ///< Iterator over pairs of index and value.
typedef Entries::const_iterator const_iterator; ///< Iterator over constant pairs of index and value. typedef Entries::const_iterator const_iterator; ///< Iterator over constant pairs of index and value.
...@@ -349,8 +348,7 @@ namespace INMOST ...@@ -349,8 +348,7 @@ namespace INMOST
return ret; return ret;
} }
private: private:
typedef array<entry> Entries; //replace later with more memory-efficient chunk_array, with first chunk in stack typedef std::vector<entry> Entries; //replace later with more memory-efficient chunk_array, with first chunk in stack
//typedef dynarray<entry,8> Entries;
public: public:
typedef Entries::iterator iterator; typedef Entries::iterator iterator;
typedef Entries::const_iterator const_iterator; typedef Entries::const_iterator const_iterator;
......
...@@ -111,7 +111,7 @@ namespace INMOST ...@@ -111,7 +111,7 @@ namespace INMOST
} }
} }
ret += static_cast<enumerator>(result.size()); ret += static_cast<enumerator>(result.size());
if( !result.empty() ) mesh->RemPrivateMarkerArray(&result[0],result.size(),mrk); if( !result.empty() ) mesh->RemPrivateMarkerArray(&result[0],(enumerator)result.size(),mrk);
result.clear(); result.clear();
mesh->ReleasePrivateMarker(mrk); mesh->ReleasePrivateMarker(mrk);
} }
...@@ -130,7 +130,7 @@ namespace INMOST ...@@ -130,7 +130,7 @@ namespace INMOST
} }
} }
ret += static_cast<enumerator>(result.size()); ret += static_cast<enumerator>(result.size());
if( !result.empty() ) mesh->RemPrivateMarkerArray(&result[0],result.size(),mrk); if( !result.empty() ) mesh->RemPrivateMarkerArray(&result[0], (enumerator)result.size(),mrk);
result.clear(); result.clear();
mesh->ReleasePrivateMarker(mrk); mesh->ReleasePrivateMarker(mrk);
} }
...@@ -153,7 +153,7 @@ namespace INMOST ...@@ -153,7 +153,7 @@ namespace INMOST
} }
} }
ret += static_cast<enumerator>(result.size()); ret += static_cast<enumerator>(result.size());
if( !result.empty() ) mesh->RemPrivateMarkerArray(&result[0],result.size(),mrk); if( !result.empty() ) mesh->RemPrivateMarkerArray(&result[0], (enumerator)result.size(),mrk);
result.clear(); result.clear();
mesh->ReleasePrivateMarker(mrk); mesh->ReleasePrivateMarker(mrk);
} }
...@@ -176,7 +176,7 @@ namespace INMOST ...@@ -176,7 +176,7 @@ namespace INMOST
} }
} }
ret += static_cast<enumerator>(result.size()); ret += static_cast<enumerator>(result.size());
if( !result.empty() ) mesh->RemPrivateMarkerArray(&result[0],result.size(),mrk); if( !result.empty() ) mesh->RemPrivateMarkerArray(&result[0], (enumerator)result.size(),mrk);
result.clear(); result.clear();
mesh->ReleasePrivateMarker(mrk); mesh->ReleasePrivateMarker(mrk);
} }
...@@ -220,7 +220,7 @@ namespace INMOST ...@@ -220,7 +220,7 @@ namespace INMOST
} }
} }
ret += static_cast<enumerator>(result.size()); ret += static_cast<enumerator>(result.size());
if( !result.empty() ) mesh->RemPrivateMarkerArray(&result[0],result.size(),mrk); if( !result.empty() ) mesh->RemPrivateMarkerArray(&result[0], (enumerator)result.size(),mrk);
result.clear(); result.clear();
mesh->ReleasePrivateMarker(mrk); mesh->ReleasePrivateMarker(mrk);
} }
...@@ -239,7 +239,7 @@ namespace INMOST ...@@ -239,7 +239,7 @@ namespace INMOST
} }
} }
ret += static_cast<enumerator>(result.size()); ret += static_cast<enumerator>(result.size());
if( !result.empty() ) mesh->RemPrivateMarkerArray(&result[0],result.size(),mrk); if( !result.empty() ) mesh->RemPrivateMarkerArray(&result[0], (enumerator)result.size(),mrk);
result.clear(); result.clear();
mesh->ReleasePrivateMarker(mrk); mesh->ReleasePrivateMarker(mrk);
} }
...@@ -262,7 +262,7 @@ namespace INMOST ...@@ -262,7 +262,7 @@ namespace INMOST
} }
} }
ret += static_cast<enumerator>(result.size()); ret += static_cast<enumerator>(result.size());
if( !result.empty() ) mesh->RemPrivateMarkerArray(&result[0],result.size(),mrk); if( !result.empty() ) mesh->RemPrivateMarkerArray(&result[0], (enumerator)result.size(),mrk);
result.clear(); result.clear();
mesh->ReleasePrivateMarker(mrk); mesh->ReleasePrivateMarker(mrk);
} }
...@@ -285,7 +285,7 @@ namespace INMOST ...@@ -285,7 +285,7 @@ namespace INMOST
} }
} }
ret += static_cast<enumerator>(result.size()); ret += static_cast<enumerator>(result.size());
if( !result.empty() ) mesh->RemPrivateMarkerArray(&result[0],result.size(),mrk); if( !result.empty() ) mesh->RemPrivateMarkerArray(&result[0], (enumerator)result.size(),mrk);
result.clear(); result.clear();
mesh->ReleasePrivateMarker(mrk); mesh->ReleasePrivateMarker(mrk);
} }
...@@ -349,7 +349,7 @@ namespace INMOST ...@@ -349,7 +349,7 @@ namespace INMOST
} }
} }
ret += static_cast<enumerator>(result.size()); ret += static_cast<enumerator>(result.size());
if( !result.empty() ) mesh->RemPrivateMarkerArray(&result[0],result.size(),mrk); if( !result.empty() ) mesh->RemPrivateMarkerArray(&result[0], (enumerator)result.size(),mrk);
result.clear(); result.clear();
mesh->ReleasePrivateMarker(mrk); mesh->ReleasePrivateMarker(mrk);
} }
...@@ -368,7 +368,7 @@ namespace INMOST ...@@ -368,7 +368,7 @@ namespace INMOST
} }
} }
ret += static_cast<enumerator>(result.size()); ret += static_cast<enumerator>(result.size());
if( !result.empty() ) mesh->RemPrivateMarkerArray(&result[0],result.size(),mrk); if( !result.empty() ) mesh->RemPrivateMarkerArray(&result[0], (enumerator)result.size(),mrk);
result.clear(); result.clear();
mesh->ReleasePrivateMarker(mrk); mesh->ReleasePrivateMarker(mrk);
} }
...@@ -393,7 +393,7 @@ namespace INMOST ...@@ -393,7 +393,7 @@ namespace INMOST
} }
} }
ret += static_cast<enumerator>(result.size()); ret += static_cast<enumerator>(result.size());
if( !result.empty() ) mesh->RemPrivateMarkerArray(&result[0],result.size(),mrk); if( !result.empty() ) mesh->RemPrivateMarkerArray(&result[0], (enumerator)result.size(),mrk);
result.clear(); result.clear();
mesh->ReleasePrivateMarker(mrk); mesh->ReleasePrivateMarker(mrk);
} }
...@@ -418,7 +418,7 @@ namespace INMOST ...@@ -418,7 +418,7 @@ namespace INMOST
} }
} }
ret += static_cast<enumerator>(result.size()); ret += static_cast<enumerator>(result.size());
if( !result.empty() ) mesh->RemPrivateMarkerArray(&result[0],result.size(),mrk); if( !result.empty() ) mesh->RemPrivateMarkerArray(&result[0], (enumerator)result.size(),mrk);
result.clear(); result.clear();
mesh->ReleasePrivateMarker(mrk); mesh->ReleasePrivateMarker(mrk);
} }
...@@ -460,7 +460,7 @@ namespace INMOST ...@@ -460,7 +460,7 @@ namespace INMOST
} }
} }
ret += static_cast<enumerator>(result.size()); ret += static_cast<enumerator>(result.size());
if( !result.empty() ) mesh->RemPrivateMarkerArray(&result[0],result.size(),mrk); if( !result.empty() ) mesh->RemPrivateMarkerArray(&result[0], (enumerator)result.size(),mrk);
result.clear(); result.clear();
mesh->ReleasePrivateMarker(mrk); mesh->ReleasePrivateMarker(mrk);
} }
...@@ -479,7 +479,7 @@ namespace INMOST ...@@ -479,7 +479,7 @@ namespace INMOST
} }
} }
ret += static_cast<enumerator>(result.size()); ret += static_cast<enumerator>(result.size());
if( !result.empty() ) mesh->RemPrivateMarkerArray(&result[0],result.size(),mrk); if( !result.empty() ) mesh->RemPrivateMarkerArray(&result[0], (enumerator)result.size(),mrk);
result.clear(); result.clear();
mesh->ReleasePrivateMarker(mrk); mesh->ReleasePrivateMarker(mrk);
} }
...@@ -504,7 +504,7 @@ namespace INMOST ...@@ -504,7 +504,7 @@ namespace INMOST
} }
} }
ret += static_cast<enumerator>(result.size()); ret += static_cast<enumerator>(result.size());
if( !result.empty() ) mesh->RemPrivateMarkerArray(&result[0],result.size(),mrk); if( !result.empty() ) mesh->RemPrivateMarkerArray(&result[0], (enumerator)result.size(),mrk);
result.clear(); result.clear();
mesh->ReleasePrivateMarker(mrk); mesh->ReleasePrivateMarker(mrk);
} }
...@@ -529,7 +529,7 @@ namespace INMOST ...@@ -529,7 +529,7 @@ namespace INMOST
} }
} }
ret += static_cast<enumerator>(result.size()); ret += static_cast<enumerator>(result.size());
if( !result.empty() ) mesh->RemPrivateMarkerArray(&result[0],result.size(),mrk); if( !result.empty() ) mesh->RemPrivateMarkerArray(&result[0], (enumerator)result.size(),mrk);
result.clear(); result.clear();
mesh->ReleasePrivateMarker(mrk); mesh->ReleasePrivateMarker(mrk);
} }
...@@ -573,7 +573,7 @@ namespace INMOST ...@@ -573,7 +573,7 @@ namespace INMOST
} }
} }
ret += static_cast<enumerator>(result.size()); ret += static_cast<enumerator>(result.size());
if( !result.empty() ) mesh->RemPrivateMarkerArray(&result[0],result.size(),mrk); if( !result.empty() ) mesh->RemPrivateMarkerArray(&result[0], (enumerator)result.size(),mrk);
result.clear(); result.clear();
mesh->ReleasePrivateMarker(mrk); mesh->ReleasePrivateMarker(mrk);
} }
...@@ -592,7 +592,7 @@ namespace INMOST ...@@ -592,7 +592,7 @@ namespace INMOST
} }
} }
ret += static_cast<enumerator>(result.size()); ret += static_cast<enumerator>(result.size());
if( !result.empty() ) mesh->RemPrivateMarkerArray(&result[0],result.size(),mrk); if( !result.empty() ) mesh->RemPrivateMarkerArray(&result[0], (enumerator)result.size(),mrk);
result.clear(); result.clear();
mesh->ReleasePrivateMarker(mrk); mesh->ReleasePrivateMarker(mrk);
} }
...@@ -617,7 +617,7 @@ namespace INMOST ...@@ -617,7 +617,7 @@ namespace INMOST
} }
} }
ret += static_cast<enumerator>(result.size()); ret += static_cast<enumerator>(result.size());
if( !result.empty() ) mesh->RemPrivateMarkerArray(&result[0],result.size(),mrk); if( !result.empty() ) mesh->RemPrivateMarkerArray(&result[0], (enumerator)result.size(),mrk);
result.clear(); result.clear();
mesh->ReleasePrivateMarker(mrk); mesh->ReleasePrivateMarker(mrk);
} }
...@@ -642,7 +642,7 @@ namespace INMOST ...@@ -642,7 +642,7 @@ namespace INMOST
} }
} }
ret += static_cast<enumerator>(result.size()); ret += static_cast<enumerator>(result.size());
if( !result.empty() ) mesh->RemPrivateMarkerArray(&result[0],result.size(),mrk); if( !result.empty() ) mesh->RemPrivateMarkerArray(&result[0], (enumerator)result.size(),mrk);
result.clear(); result.clear();
mesh->ReleasePrivateMarker(mrk); mesh->ReleasePrivateMarker(mrk);
} }
...@@ -684,7 +684,7 @@ namespace INMOST ...@@ -684,7 +684,7 @@ namespace INMOST
} }
} }
ret += static_cast<enumerator>(result.size()); ret += static_cast<enumerator>(result.size());
if( !result.empty() ) mesh->RemPrivateMarkerArray(&result[0],result.size(),mrk); if( !result.empty() ) mesh->RemPrivateMarkerArray(&result[0], (enumerator)result.size(),mrk);
result.clear(); result.clear();
mesh->ReleasePrivateMarker(mrk); mesh->ReleasePrivateMarker(mrk);
} }
...@@ -703,7 +703,7 @@ namespace INMOST ...@@ -703,7 +703,7 @@ namespace INMOST
} }
} }
ret += static_cast<enumerator>(result.size()); ret += static_cast<enumerator>(result.size());
if( !result.empty() ) mesh->RemPrivateMarkerArray(&result[0],result.size(),mrk); if( !result.empty() ) mesh->RemPrivateMarkerArray(&result[0], (enumerator)result.size(),mrk);
result.clear(); result.clear();
mesh->ReleasePrivateMarker(mrk); mesh->ReleasePrivateMarker(mrk);
} }
...@@ -728,7 +728,7 @@ namespace INMOST ...@@ -728,7 +728,7 @@ namespace INMOST
} }
} }
ret += static_cast<enumerator>(result.size()); ret += static_cast<enumerator>(result.size());
if( !result.empty() ) mesh->RemPrivateMarkerArray(&result[0],result.size(),mrk); if( !result.empty() ) mesh->RemPrivateMarkerArray(&result[0], (enumerator)result.size(),mrk);
result.clear(); result.clear();
mesh->ReleasePrivateMarker(mrk); mesh->ReleasePrivateMarker(mrk);
} }
...@@ -753,7 +753,7 @@ namespace INMOST ...@@ -753,7 +753,7 @@ namespace INMOST
} }
} }
ret += static_cast<enumerator>(result.size()); ret += static_cast<enumerator>(result.size());
if( !result.empty() ) mesh->RemPrivateMarkerArray(&result[0],result.size(),mrk); if( !result.empty() ) mesh->RemPrivateMarkerArray(&result[0], (enumerator)result.size(),mrk);
result.clear(); result.clear();
mesh->ReleasePrivateMarker(mrk); mesh->ReleasePrivateMarker(mrk);
} }
......
...@@ -155,7 +155,7 @@ namespace INMOST ...@@ -155,7 +155,7 @@ namespace INMOST
} }
} }
} }
if( !nodes.empty() ) m->RemPrivateMarkerArray(&nodes[0],nodes.size(),mrk); if( !nodes.empty() ) m->RemPrivateMarkerArray(&nodes[0],(Storage::enumerator)nodes.size(),mrk);
m->ReleasePrivateMarker(mrk); m->ReleasePrivateMarker(mrk);
bbox[0] = bbox[2] = bbox[4] = 1.0e20f; bbox[0] = bbox[2] = bbox[4] = 1.0e20f;
bbox[1] = bbox[3] = bbox[5] = -1.0e20f; bbox[1] = bbox[3] = bbox[5] = -1.0e20f;
......
...@@ -5,6 +5,7 @@ set(SOURCE ...@@ -5,6 +5,7 @@ set(SOURCE
${CMAKE_CURRENT_SOURCE_DIR}/utils.cpp ${CMAKE_CURRENT_SOURCE_DIR}/utils.cpp
${CMAKE_CURRENT_SOURCE_DIR}/base64.cpp ${CMAKE_CURRENT_SOURCE_DIR}/base64.cpp
${CMAKE_CURRENT_SOURCE_DIR}/pool.cpp ${CMAKE_CURRENT_SOURCE_DIR}/pool.cpp
${CMAKE_CURRENT_SOURCE_DIR}/mem.cpp
PARENT_SCOPE PARENT_SCOPE
) )
......
/*
* Author: David Robert Nadeau
* Site: http://NadeauSoftware.com/
* License: Creative Commons Attribution 3.0 Unported License
* http://creativecommons.org/licenses/by/3.0/deed.en_US
*/
#if defined(_WIN32)
#include <windows.h>
#include <psapi.h>
#elif defined(__unix__) || defined(__unix) || defined(unix) || (defined(__APPLE__) && defined(__MACH__))
#include <unistd.h>
#include <sys/resource.h>
#if defined(__APPLE__) && defined(__MACH__)
#include <mach/mach.h>
#elif (defined(_AIX) || defined(__TOS__AIX__)) || (defined(__sun__) || defined(__sun) || defined(sun) && (defined(__SVR4) || defined(__svr4__)))
#include <fcntl.h>
#include <procfs.h>
#elif defined(__linux__) || defined(__linux) || defined(linux) || defined(__gnu_linux__)
#include <stdio.h>
#endif
#else
#error "Cannot define getPeakRSS( ) or getCurrentRSS( ) for an unknown OS."
#endif
#include "utils.h"
/**
* Returns the peak (maximum so far) resident set size (physical
* memory use) measured in bytes, or zero if the value cannot be
* determined on this OS.
*/
size_t getPeakRSS()
{
#if defined(_WIN32)
/* Windows -------------------------------------------------- */
PROCESS_MEMORY_COUNTERS info;
GetProcessMemoryInfo(GetCurrentProcess(), &info, sizeof(info));
return (size_t)info.PeakWorkingSetSize;
#elif (defined(_AIX) || defined(__TOS__AIX__)) || (defined(__sun__) || defined(__sun) || defined(sun) && (defined(__SVR4) || defined(__svr4__)))
/* AIX and Solaris ------------------------------------------ */
struct psinfo psinfo;
int fd = -1;
if ((fd = open("/proc/self/psinfo", O_RDONLY)) == -1)
return (size_t)0L; /* Can't open? */
if (read(fd, &psinfo, sizeof(psinfo)) != sizeof(psinfo))
{
close(fd);
return (size_t)0L; /* Can't read? */
}
close(fd);
return (size_t)(psinfo.pr_rssize * 1024L);
#elif defined(__unix__) || defined(__unix) || defined(unix) || (defined(__APPLE__) && defined(__MACH__))
/* BSD, Linux, and OSX -------------------------------------- */
struct rusage rusage;
getrusage(RUSAGE_SELF, &rusage);
#if defined(__APPLE__) && defined(__MACH__)
return (size_t)rusage.ru_maxrss;
#else
return (size_t)(rusage.ru_maxrss * 1024L);
#endif
#else
/* Unknown OS ----------------------------------------------- */
return (size_t)0L; /* Unsupported. */
#endif
}
/**
* Returns the current resident set size (physical memory use) measured
* in bytes, or zero if the value cannot be determined on this OS.
*/
size_t getCurrentRSS()
{
#if defined(_WIN32)
/* Windows -------------------------------------------------- */
PROCESS_MEMORY_COUNTERS info;
GetProcessMemoryInfo(GetCurrentProcess(), &info, sizeof(info));
return (size_t)info.WorkingSetSize;
#elif defined(__APPLE__) && defined(__MACH__)
/* OSX ------------------------------------------------------ */
struct mach_task_basic_info info;
mach_msg_type_number_t infoCount = MACH_TASK_BASIC_INFO_COUNT;
if (task_info(mach_task_self(), MACH_TASK_BASIC_INFO,
(task_info_t)&info, &infoCount) != KERN_SUCCESS)
return (size_t)0L; /* Can't access? */
return (size_t)info.resident_size;
#elif defined(__linux__) || defined(__linux) || defined(linux) || defined(__gnu_linux__)
/* Linux ---------------------------------------------------- */
long rss = 0L;
FILE* fp = NULL;
if ((fp = fopen("/proc/self/statm", "r")) == NULL)
return (size_t)0L; /* Can't open? */
if (fscanf(fp, "%*s%ld", &rss) != 1)
{
fclose(fp);
return (size_t)0L; /* Can't read? */
}
fclose(fp);
return (size_t)rss * (size_t)sysconf(_SC_PAGESIZE);
#else
/* AIX, BSD, Solaris, and Unknown OS ------------------------ */
return (size_t)0L; /* Unsupported. */
#endif
}
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -6,34 +6,6 @@ ...@@ -6,34 +6,6 @@
#include "inmost_solver.h" #include "inmost_solver.h"
#include "../solver_prototypes.hpp" #include "../solver_prototypes.hpp"
/*
class Range
{
INMOST_DATA_ENUM_TYPE first, last;
public:
Range(const Range & b):first(b.first), last(b.last) {}
Range(INMOST_DATA_ENUM_TYPE first, INMOST_DATA_ENUM_TYPE last) : first(first), last(last) {}
Range & operator =(Range const & b) {first = b.first; last = b.last; return *this;}
~Range() {}
INMOST_DATA_ENUM_TYPE Size() { return last - first; }
INMOST_DATA_ENUM_TYPE First() {return first;}
INMOST_DATA_ENUM_TYPE Last() {return last;}
};
class CSR_Row
{
Range & range;
std::vector<Sparse::Row::entry> & entries;
public:
}
class CSR_Matrix
{
interval<INMOST_DATA_ENUM_TYPE, Range> Address;
std::vector<Sparse::Row::entry> Entries;
public:
};
*/
class MLMTILUC_preconditioner : public Method class MLMTILUC_preconditioner : public Method
{ {
...@@ -77,9 +49,9 @@ class MLMTILUC_preconditioner : public Method ...@@ -77,9 +49,9 @@ class MLMTILUC_preconditioner : public Method
INMOST_DATA_ENUM_TYPE Size() const { return last - first; } INMOST_DATA_ENUM_TYPE Size() const { return last - first; }
} Interval;