[cig-commits] r14943 - in short/3D/PyLith/trunk: libsrc/meshio libsrc/topology pylith/perf
knepley at geodynamics.org
knepley at geodynamics.org
Sat May 9 12:01:16 PDT 2009
Author: knepley
Date: 2009-05-09 12:01:15 -0700 (Sat, 09 May 2009)
New Revision: 14943
Modified:
short/3D/PyLith/trunk/libsrc/meshio/MeshIO.cc
short/3D/PyLith/trunk/libsrc/topology/Field.cc
short/3D/PyLith/trunk/libsrc/topology/Fields.icc
short/3D/PyLith/trunk/pylith/perf/MemoryLogger.py
Log:
More logging
Modified: short/3D/PyLith/trunk/libsrc/meshio/MeshIO.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/meshio/MeshIO.cc 2009-05-09 19:00:59 UTC (rev 14942)
+++ short/3D/PyLith/trunk/libsrc/meshio/MeshIO.cc 2009-05-09 19:01:15 UTC (rev 14943)
@@ -309,7 +309,6 @@
assert(!sieveMesh.isNull());
ALE::MemoryLogger& logger = ALE::MemoryLogger::singleton();
- logger.setDebug(1);
std::cout << "Building Vertex Group " << name << std::endl;
logger.stagePush("VertexGroups");
const ALE::Obj<IntSection>& groupField = sieveMesh->getIntSection(name);
@@ -330,7 +329,6 @@
} // if/else
sieveMesh->allocate(groupField);
logger.stagePop();
- logger.setDebug(0);
#if defined(ALE_MEM_LOGGING)
std::cout
Modified: short/3D/PyLith/trunk/libsrc/topology/Field.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/topology/Field.cc 2009-05-09 19:00:59 UTC (rev 14942)
+++ short/3D/PyLith/trunk/libsrc/topology/Field.cc 2009-05-09 19:01:15 UTC (rev 14943)
@@ -80,7 +80,10 @@
void
pylith::topology::Field<mesh_type>::newSection(void)
{ // newSection
+ ALE::MemoryLogger& logger = ALE::MemoryLogger::singleton();
+ logger.stagePush("Field");
_section = new RealSection(_mesh.comm(), _mesh.debug());
+ logger.stagePop();
} // newSection
// ----------------------------------------------------------------------
@@ -93,6 +96,8 @@
{ // newSection
typedef typename mesh_type::SieveMesh::point_type point_type;
+ ALE::MemoryLogger& logger = ALE::MemoryLogger::singleton();
+ logger.stagePush("Field");
if (fiberDim < 0) {
std::ostringstream msg;
msg
@@ -115,6 +120,7 @@
_section->setChart(chart_type(0, 0));
_section->setFiberDimension(points, fiberDim);
} // if/else
+ logger.stagePop();
} // newSection
// ----------------------------------------------------------------------
@@ -148,6 +154,8 @@
pylith::topology::Field<mesh_type>::newSection(const chart_type& chart,
const int fiberDim)
{ // newSection
+ ALE::MemoryLogger& logger = ALE::MemoryLogger::singleton();
+ logger.stagePush("Field");
if (_section.isNull())
newSection();
@@ -159,6 +167,7 @@
++c_iter)
_section->setFiberDimension(*c_iter, fiberDim);
allocate();
+ logger.stagePop();
} // newSection
// ----------------------------------------------------------------------
@@ -167,6 +176,8 @@
void
pylith::topology::Field<mesh_type>::newSection(const Field& src)
{ // newSection
+ ALE::MemoryLogger& logger = ALE::MemoryLogger::singleton();
+ logger.stagePush("Field");
_vecFieldType = src._vecFieldType;
const ALE::Obj<RealSection>& srcSection = src.section();
@@ -184,6 +195,7 @@
CHECK_PETSC_ERROR(err);
} // if
} // if
+ logger.stagePop();
} // newSection
// ----------------------------------------------------------------------
@@ -192,12 +204,15 @@
void
pylith::topology::Field<mesh_type>::clear(void)
{ // clear
+ ALE::MemoryLogger& logger = ALE::MemoryLogger::singleton();
+ logger.stagePush("Field");
if (!_section.isNull())
_section->clear();
_scale = 1.0;
_vecFieldType = OTHER;
_dimensionsOkay = false;
+ logger.stagePop();
} // clear
// ----------------------------------------------------------------------
@@ -206,11 +221,14 @@
void
pylith::topology::Field<mesh_type>::allocate(void)
{ // allocate
+ ALE::MemoryLogger& logger = ALE::MemoryLogger::singleton();
+ logger.stagePush("Field");
assert(!_section.isNull());
const ALE::Obj<SieveMesh>& sieveMesh = _mesh.sieveMesh();
assert(!sieveMesh.isNull());
sieveMesh->allocate(_section);
+ logger.stagePop();
} // allocate
// ----------------------------------------------------------------------
@@ -229,6 +247,8 @@
void
pylith::topology::Field<mesh_type>::complete(void)
{ // complete
+ ALE::MemoryLogger& logger = ALE::MemoryLogger::singleton();
+ logger.stagePush("Completion");
const ALE::Obj<SieveMesh>& sieveMesh = _mesh.sieveMesh();
assert(!sieveMesh.isNull());
@@ -236,6 +256,7 @@
ALE::Completion::completeSectionAdd(sieveMesh->getSendOverlap(),
sieveMesh->getRecvOverlap(),
_section, _section);
+ logger.stagePop();
} // complete
// ----------------------------------------------------------------------
Modified: short/3D/PyLith/trunk/libsrc/topology/Fields.icc
===================================================================
--- short/3D/PyLith/trunk/libsrc/topology/Fields.icc 2009-05-09 19:00:59 UTC (rev 14942)
+++ short/3D/PyLith/trunk/libsrc/topology/Fields.icc 2009-05-09 19:01:15 UTC (rev 14943)
@@ -39,11 +39,14 @@
void
pylith::topology::Fields<field_type>::deallocate(void)
{ // deallocate
+ ALE::MemoryLogger& logger = ALE::MemoryLogger::singleton();
+ logger.stagePush("Field");
const typename map_type::iterator begin = _fields.begin();
const typename map_type::iterator end = _fields.end();
for (typename map_type::iterator iter=begin; iter != end; ++iter) {
delete iter->second; iter->second = 0;
} // for
+ logger.stagePop();
} // deallocate
// ----------------------------------------------------------------------
@@ -53,6 +56,8 @@
pylith::topology::Fields<field_type>::add(const char* name,
const char* label)
{ // add
+ ALE::MemoryLogger& logger = ALE::MemoryLogger::singleton();
+ logger.stagePush("Field");
typename map_type::iterator iter = _fields.find(name);
if (iter != _fields.end()) {
std::ostringstream msg;
@@ -63,6 +68,7 @@
_fields[name] = new field_type(_mesh);
_fields[name]->label(label);
+ logger.stagePop();
} // add
// ----------------------------------------------------------------------
@@ -75,6 +81,8 @@
const pylith::topology::FieldBase::DomainEnum domain,
const int fiberDim)
{ // add
+ ALE::MemoryLogger& logger = ALE::MemoryLogger::singleton();
+ logger.stagePush("Field");
typename map_type::iterator iter = _fields.find(name);
if (iter != _fields.end()) {
std::ostringstream msg;
@@ -86,6 +94,7 @@
_fields[name] = new field_type(_mesh);
_fields[name]->label(label);
_fields[name]->newSection(domain, fiberDim);
+ logger.stagePop();
} // add
// ----------------------------------------------------------------------
@@ -94,6 +103,8 @@
void
pylith::topology::Fields<field_type>::del(const char* name)
{ // del
+ ALE::MemoryLogger& logger = ALE::MemoryLogger::singleton();
+ logger.stagePush("Field");
typename map_type::iterator iter = _fields.find(name);
if (iter == _fields.end()) {
std::ostringstream msg;
@@ -103,6 +114,7 @@
} // if
delete iter->second; iter->second = 0;
_fields.erase(name);
+ logger.stagePop();
} // del
// ----------------------------------------------------------------------
@@ -153,6 +165,8 @@
void
pylith::topology::Fields<field_type>::copyLayout(const char* name)
{ // copyLayout
+ ALE::MemoryLogger& logger = ALE::MemoryLogger::singleton();
+ logger.stagePush("Field");
typename map_type::const_iterator src = _fields.find(name);
if (src == _fields.end()) {
std::ostringstream msg;
@@ -166,6 +180,7 @@
for (typename map_type::iterator iter=begin; iter != end; ++iter)
if (iter != src)
iter->second->newSection(*src->second);
+ logger.stagePop();
} // copyLayout
// ----------------------------------------------------------------------
Modified: short/3D/PyLith/trunk/pylith/perf/MemoryLogger.py
===================================================================
--- short/3D/PyLith/trunk/pylith/perf/MemoryLogger.py 2009-05-09 19:00:59 UTC (rev 14942)
+++ short/3D/PyLith/trunk/pylith/perf/MemoryLogger.py 2009-05-09 19:01:15 UTC (rev 14943)
@@ -53,6 +53,8 @@
Logger.__init__(self, name)
self.megabyte = float(2**20)
self.memory = {}
+ self.memory['Field'] = 0
+ self.memory['Completion'] = 0
return
def logMesh(self, stage, mesh):
@@ -145,13 +147,19 @@
output.append(self.memLine('Code', name, mem, indent))
if namePrefix:
mem = logger.getAllocationTotal(namePrefix) - logger.getDeallocationTotal(namePrefix)
+ print 'Queried',namePrefix,'code memory'
else:
mem = logger.getAllocationTotal() - logger.getDeallocationTotal()
+ print 'Queried total code memory'
if mem == 0:
+ print 'Used code total'
mem = codeTotal
output.append(self.memLine('Model', 'Total', total, indent))
output.append(self.memLine('Code', 'Total', mem, indent))
- output.append('%sPercentage memory modeled: %.2f%%' % (self.prefix(indent), total*100.0/mem))
+ if mem:
+ output.append('%sPercentage memory modeled: %.2f%%' % (self.prefix(indent), total*100.0/mem))
+ else:
+ output.append('%sMemory modeled: %d (no measured memory)' % (self.prefix(indent), total))
return output, total, codeTotal
def show(self):
More information about the CIG-COMMITS
mailing list