[cig-commits] r15384 - in short/3D/PyLith/trunk: . libsrc/meshio modulesrc/meshio pylith/apps pylith/bc pylith/feassemble pylith/materials pylith/meshio pylith/perf pylith/problems pylith/utils

brad at geodynamics.org brad at geodynamics.org
Wed Jun 24 19:29:27 PDT 2009


Author: brad
Date: 2009-06-24 19:29:25 -0700 (Wed, 24 Jun 2009)
New Revision: 15384

Modified:
   short/3D/PyLith/trunk/TODO
   short/3D/PyLith/trunk/libsrc/meshio/CellFilterAvg.cc
   short/3D/PyLith/trunk/libsrc/meshio/CellFilterAvg.hh
   short/3D/PyLith/trunk/libsrc/meshio/OutputManager.cc
   short/3D/PyLith/trunk/libsrc/meshio/OutputManager.hh
   short/3D/PyLith/trunk/modulesrc/meshio/CellFilterAvg.i
   short/3D/PyLith/trunk/modulesrc/meshio/OutputManager.i
   short/3D/PyLith/trunk/pylith/apps/PetscApplication.py
   short/3D/PyLith/trunk/pylith/bc/AbsorbingDampers.py
   short/3D/PyLith/trunk/pylith/bc/BoundaryCondition.py
   short/3D/PyLith/trunk/pylith/bc/DirichletBC.py
   short/3D/PyLith/trunk/pylith/bc/Neumann.py
   short/3D/PyLith/trunk/pylith/bc/PointForce.py
   short/3D/PyLith/trunk/pylith/feassemble/ElasticityImplicit.py
   short/3D/PyLith/trunk/pylith/feassemble/IntegratorElasticity.py
   short/3D/PyLith/trunk/pylith/materials/Material.py
   short/3D/PyLith/trunk/pylith/meshio/CellFilter.py
   short/3D/PyLith/trunk/pylith/meshio/CellFilterAvgMesh.py
   short/3D/PyLith/trunk/pylith/meshio/CellFilterAvgSubMesh.py
   short/3D/PyLith/trunk/pylith/meshio/OutputManager.py
   short/3D/PyLith/trunk/pylith/perf/MemoryLogger.py
   short/3D/PyLith/trunk/pylith/problems/Explicit.py
   short/3D/PyLith/trunk/pylith/problems/Formulation.py
   short/3D/PyLith/trunk/pylith/problems/Implicit.py
   short/3D/PyLith/trunk/pylith/problems/Problem.py
   short/3D/PyLith/trunk/pylith/utils/PetscComponent.py
Log:
Worked on memory model.

Modified: short/3D/PyLith/trunk/TODO
===================================================================
--- short/3D/PyLith/trunk/TODO	2009-06-25 02:27:14 UTC (rev 15383)
+++ short/3D/PyLith/trunk/TODO	2009-06-25 02:29:25 UTC (rev 15384)
@@ -10,11 +10,14 @@
 RELEASE
 
   Release notes
+  Manual improvements
+    pylithinfo
+    list of components
+    units
+    
 
 BONUS
 
-  pylithinfo (Python application, send extra args to PyLith)
-
   Memory model
 
 ----------------------------------------------------------------------

Modified: short/3D/PyLith/trunk/libsrc/meshio/CellFilterAvg.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/meshio/CellFilterAvg.cc	2009-06-25 02:27:14 UTC (rev 15383)
+++ short/3D/PyLith/trunk/libsrc/meshio/CellFilterAvg.cc	2009-06-25 02:29:25 UTC (rev 15384)
@@ -63,6 +63,15 @@
 } // clone
 
 // ----------------------------------------------------------------------
+// Get averaged field buffer.
+template<typename mesh_type, typename field_type>
+const field_type*
+pylith::meshio::CellFilterAvg<mesh_type, field_type>::fieldAvg(void) const
+{ // fieldAvg
+  return _fieldAvg;
+} // fieldAvg
+  
+// ----------------------------------------------------------------------
 // Filter field.
 template<typename mesh_type, typename field_type>
 const field_type&

Modified: short/3D/PyLith/trunk/libsrc/meshio/CellFilterAvg.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/meshio/CellFilterAvg.hh	2009-06-25 02:27:14 UTC (rev 15383)
+++ short/3D/PyLith/trunk/libsrc/meshio/CellFilterAvg.hh	2009-06-25 02:29:25 UTC (rev 15384)
@@ -46,6 +46,12 @@
   /// Deallocate PETSc and local data structures.
   void deallocate(void);
   
+  /** Get averaged field buffer.
+   *
+   * @returns Field associated with averaged values.
+   */
+  const field_type* fieldAvg(void) const;
+  
   /** Filter field over cells.
    *
    * @param fieldIn Field to filter.

Modified: short/3D/PyLith/trunk/libsrc/meshio/OutputManager.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/meshio/OutputManager.cc	2009-06-25 02:27:14 UTC (rev 15383)
+++ short/3D/PyLith/trunk/libsrc/meshio/OutputManager.cc	2009-06-25 02:29:25 UTC (rev 15384)
@@ -94,6 +94,15 @@
 } // cellFilter
 
 // ----------------------------------------------------------------------
+// Get fields used in output.
+template<typename mesh_type, typename field_type>
+const pylith::topology::Fields<field_type>*
+pylith::meshio::OutputManager<mesh_type, field_type>::fields(void) const
+{ // fields
+  return _fields;
+} // fields
+
+// ----------------------------------------------------------------------
 // Prepare for output.
 template<typename mesh_type, typename field_type>
 void
@@ -236,6 +245,7 @@
       fieldOut.cloneSection(fieldIn);
       fieldOut.vectorFieldType(fieldIn.vectorFieldType());
       fieldOut.scale(fieldIn.scale());
+
       logger.stagePop();
     } // if
     field_type& fieldOut = _fields->get(fieldName.c_str());

Modified: short/3D/PyLith/trunk/libsrc/meshio/OutputManager.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/meshio/OutputManager.hh	2009-06-25 02:27:14 UTC (rev 15383)
+++ short/3D/PyLith/trunk/libsrc/meshio/OutputManager.hh	2009-06-25 02:29:25 UTC (rev 15384)
@@ -70,6 +70,12 @@
    */
   void cellFilter(CellFilter<mesh_type, field_type>* const filter);
 
+  /** Get fields used in output.
+   *
+   * @returns Fields associated with output.
+   */
+  const topology::Fields<field_type>* fields(void) const;
+
   /** Prepare for output.
    *
    * @param mesh Finite-element mesh object.

Modified: short/3D/PyLith/trunk/modulesrc/meshio/CellFilterAvg.i
===================================================================
--- short/3D/PyLith/trunk/modulesrc/meshio/CellFilterAvg.i	2009-06-25 02:27:14 UTC (rev 15383)
+++ short/3D/PyLith/trunk/modulesrc/meshio/CellFilterAvg.i	2009-06-25 02:29:25 UTC (rev 15384)
@@ -42,6 +42,12 @@
       /// Deallocate PETSc and local data structures.
       void deallocate(void);
   
+      /** Get averaged field buffer.
+       *
+       * @returns Field associated with averaged values.
+       */
+      const field_type* fieldAvg(void) const;
+  
       /** Filter field over cells.
        *
        * @param fieldIn Field to filter.

Modified: short/3D/PyLith/trunk/modulesrc/meshio/OutputManager.i
===================================================================
--- short/3D/PyLith/trunk/modulesrc/meshio/OutputManager.i	2009-06-25 02:27:14 UTC (rev 15383)
+++ short/3D/PyLith/trunk/modulesrc/meshio/OutputManager.i	2009-06-25 02:29:25 UTC (rev 15384)
@@ -62,6 +62,12 @@
        */
       void cellFilter(CellFilter<mesh_type, field_type>* const filter);
       
+      /** Get fields used in output.
+       *
+       * @returns Fields associated with output.
+       */
+      const pylith::topology::Fields<field_type>* fields(void) const;
+
       /** Prepare for output.
        *
        * @param mesh Finite-element mesh object.

Modified: short/3D/PyLith/trunk/pylith/apps/PetscApplication.py
===================================================================
--- short/3D/PyLith/trunk/pylith/apps/PetscApplication.py	2009-06-25 02:27:14 UTC (rev 15383)
+++ short/3D/PyLith/trunk/pylith/apps/PetscApplication.py	2009-06-25 02:29:25 UTC (rev 15384)
@@ -66,9 +66,7 @@
     from pylith.utils.PetscComponent import PetscComponent
     for component in self.components():
       if isinstance(component, PetscComponent):
-        component.compilePerformanceLog()
-        if hasattr(component, 'perfLogger'):
-          self.perfLogger.join(component.perfLogger)
+        component.compilePerformanceLog(self.perfLogger)
     return
 
 

Modified: short/3D/PyLith/trunk/pylith/bc/AbsorbingDampers.py
===================================================================
--- short/3D/PyLith/trunk/pylith/bc/AbsorbingDampers.py	2009-06-25 02:27:14 UTC (rev 15383)
+++ short/3D/PyLith/trunk/pylith/bc/AbsorbingDampers.py	2009-06-25 02:29:25 UTC (rev 15384)
@@ -120,6 +120,16 @@
     return
   
 
+  def finalize(self):
+    """
+    Cleanup.
+    """
+    BoundaryCondition.finalize(self)
+    Integrator.finalize(self)
+    self._modelMemoryUse()
+    return
+  
+
   # PRIVATE METHODS ////////////////////////////////////////////////////
 
   def _configure(self):
@@ -140,6 +150,14 @@
     return
   
 
+  def _modelMemoryUse(self):
+    """
+    Model memory allocation.
+    """
+    self.perfLogger.logFields("BoundaryConditions", self.parameterFields())
+    return
+
+
 # FACTORIES ////////////////////////////////////////////////////////////
 
 def boundary_condition():

Modified: short/3D/PyLith/trunk/pylith/bc/BoundaryCondition.py
===================================================================
--- short/3D/PyLith/trunk/pylith/bc/BoundaryCondition.py	2009-06-25 02:27:14 UTC (rev 15383)
+++ short/3D/PyLith/trunk/pylith/bc/BoundaryCondition.py	2009-06-25 02:29:25 UTC (rev 15384)
@@ -79,7 +79,12 @@
 		        "tangent direction that is not collinear " \
 			"with normal direction."
 
+    from pylith.perf.MemoryLogger import MemoryLogger
+    perfLogger = pyre.inventory.facility("perf_logger", family="perf_logger",
+                                         factory=MemoryLogger)
+    perfLogger.meta['tip'] = "Performance and memory logging."
 
+
   # PUBLIC METHODS /////////////////////////////////////////////////////
 
   def __init__(self, name="boundarycondition"):
@@ -107,6 +112,14 @@
     return
 
 
+  def finalize(self):
+    """
+    Cleanup.
+    """
+    self._modelMemoryUse()
+    return
+  
+
   # PRIVATE METHODS ////////////////////////////////////////////////////
 
   def _configure(self):
@@ -116,6 +129,7 @@
     PetscComponent._configure(self)
     ModuleBoundaryCondition.label(self, self.inventory.label)
     self.upDir = map(float, self.inventory.upDir)
+    self.perfLogger = self.inventory.perfLogger
     return
 
 
@@ -127,4 +141,13 @@
           "Please implement _createModuleObj() in derived class."
 
 
+  def _modelMemoryUse(self):
+    """
+    Model memory allocation.
+    """
+    raise NotImplementedError, \
+          "Please implement _modelModelUse() in derived class."
+    return
+
+
 # End of file 

Modified: short/3D/PyLith/trunk/pylith/bc/DirichletBC.py
===================================================================
--- short/3D/PyLith/trunk/pylith/bc/DirichletBC.py	2009-06-25 02:27:14 UTC (rev 15383)
+++ short/3D/PyLith/trunk/pylith/bc/DirichletBC.py	2009-06-25 02:29:25 UTC (rev 15384)
@@ -45,12 +45,6 @@
                                       family="spatial_database")
   dbInitial.meta['tip'] = "Database of parameters for initial values."
   
-  from pylith.perf.MemoryLogger import MemoryLogger
-  perfLogger = pyre.inventory.facility("perf_logger", family="perf_logger",
-                                       factory=MemoryLogger)
-  perfLogger.meta['tip'] = "Performance and memory logging."
-
-
   # PUBLIC METHODS /////////////////////////////////////////////////////
 
   def __init__(self, name="dirichletbc"):
@@ -95,11 +89,20 @@
     self.normalizer(normalizer)
     BoundaryCondition.initialize(self, totalTime, numTimeSteps, normalizer)
 
-    self._modelMemoryUse()
     self._eventLogger.eventEnd(logEvent)    
     return
   
 
+  def finalize(self):
+    """
+    Cleanup.
+    """
+    BoundaryCondition.finalize(self)
+    Constraint.finalize(self)
+    self._modelMemoryUse()
+    return
+  
+
   # PRIVATE METHODS ////////////////////////////////////////////////////
 
   def _configure(self):

Modified: short/3D/PyLith/trunk/pylith/bc/Neumann.py
===================================================================
--- short/3D/PyLith/trunk/pylith/bc/Neumann.py	2009-06-25 02:27:14 UTC (rev 15383)
+++ short/3D/PyLith/trunk/pylith/bc/Neumann.py	2009-06-25 02:29:25 UTC (rev 15384)
@@ -125,6 +125,16 @@
     return
   
 
+  def finalize(self):
+    """
+    Cleanup.
+    """
+    BoundaryCondition.finalize(self)
+    Integrator.finalize(self)
+    self._modelMemoryUse()
+    return
+  
+
   def getDataMesh(self):
     """
     Get mesh associated with data fields.
@@ -164,6 +174,14 @@
     return
   
 
+  def _modelMemoryUse(self):
+    """
+    Model memory allocation.
+    """
+    self.perfLogger.logFields("BoundaryConditions", self.parameterFields())
+    return
+
+
 # FACTORIES ////////////////////////////////////////////////////////////
 
 def boundary_condition():

Modified: short/3D/PyLith/trunk/pylith/bc/PointForce.py
===================================================================
--- short/3D/PyLith/trunk/pylith/bc/PointForce.py	2009-06-25 02:27:14 UTC (rev 15383)
+++ short/3D/PyLith/trunk/pylith/bc/PointForce.py	2009-06-25 02:29:25 UTC (rev 15384)
@@ -81,6 +81,16 @@
     return
   
 
+  def finalize(self):
+    """
+    Cleanup.
+    """
+    BoundaryCondition.finalize(self)
+    Integrator.finalize(self)
+    self._modelMemoryUse()
+    return
+  
+
   # PRIVATE METHODS ////////////////////////////////////////////////////
 
   def _configure(self):
@@ -99,6 +109,14 @@
     return
   
 
+  def _modelMemoryUse(self):
+    """
+    Model memory allocation.
+    """
+    self.perfLogger.logFields("BoundaryConditions", self.parameterFields())
+    return
+
+
 # FACTORIES ////////////////////////////////////////////////////////////
 
 def boundary_condition():

Modified: short/3D/PyLith/trunk/pylith/feassemble/ElasticityImplicit.py
===================================================================
--- short/3D/PyLith/trunk/pylith/feassemble/ElasticityImplicit.py	2009-06-25 02:27:14 UTC (rev 15383)
+++ short/3D/PyLith/trunk/pylith/feassemble/ElasticityImplicit.py	2009-06-25 02:29:25 UTC (rev 15384)
@@ -50,7 +50,6 @@
     ModuleElasticityImplicit.initialize(self, self.mesh)
     self._initializeOutput(totalTime, numTimeSteps, normalizer)
     
-    self._modelMemoryUse()
     self._eventLogger.eventEnd(logEvent)
     return
 

Modified: short/3D/PyLith/trunk/pylith/feassemble/IntegratorElasticity.py
===================================================================
--- short/3D/PyLith/trunk/pylith/feassemble/IntegratorElasticity.py	2009-06-25 02:27:14 UTC (rev 15383)
+++ short/3D/PyLith/trunk/pylith/feassemble/IntegratorElasticity.py	2009-06-25 02:29:25 UTC (rev 15384)
@@ -108,6 +108,16 @@
     return
 
 
+  def finalize(self):
+    """
+    Cleanup.
+    """
+    Integrator.finalize(self)
+    self.materialObj.finalize()
+    self.output.finalize()
+    return
+
+
   def getDataMesh(self):
     """
     Get mesh associated with data fields.
@@ -136,12 +146,4 @@
     return
 
 
-  def _modelMemoryUse(self):
-    """
-    Model allocated memory.
-    """
-    self.materialObj.modelMemoryUse()
-    return
-
-
 # End of file 

Modified: short/3D/PyLith/trunk/pylith/materials/Material.py
===================================================================
--- short/3D/PyLith/trunk/pylith/materials/Material.py	2009-06-25 02:27:14 UTC (rev 15383)
+++ short/3D/PyLith/trunk/pylith/materials/Material.py	2009-06-25 02:29:25 UTC (rev 15384)
@@ -82,10 +82,10 @@
     quadrature.meta['tip'] = "Quadrature object for numerical integration."
 
 
-    #from pylith.perf.MemoryLogger import MemoryLogger
-    #perfLogger = pyre.inventory.facility("perf_logger", family="perf_logger",
-    #                                     factory=MemoryLogger)
-    #perfLogger.meta['tip'] = "Performance and memory logging."
+    from pylith.perf.MemoryLogger import MemoryLogger
+    perfLogger = pyre.inventory.facility("perf_logger", family="perf_logger",
+                                         factory=MemoryLogger)
+    perfLogger.meta['tip'] = "Performance and memory logging."
 
   
   # PUBLIC METHODS /////////////////////////////////////////////////////
@@ -135,21 +135,21 @@
     return
   
 
-  def getDataMesh(self):
+  def finalize(self):
     """
-    Get mesh associated with data fields.
+    Cleanup.
     """
-    return (self.mesh, "material-id", self.id())
+    if not self.output is None:
+      self.output.finalize()
+    self._modelMemoryUse()
+    return
 
 
-  def modelMemoryUse(self):
+  def getDataMesh(self):
     """
-    Model allocated memory.
+    Get mesh associated with data fields.
     """
-    #self.perfLogger.logMaterial('Materials', self)
-    #self.perfLogger.logField('Materials', self.propertiesField())
-    #self.perfLogger.logField('Materials', self.stateVarsField())
-    return
+    return (self.mesh, "material-id", self.id())
 
 
   # PRIVATE METHODS ////////////////////////////////////////////////////
@@ -167,7 +167,7 @@
       self.dbInitialState(self.inventory.dbInitialState)
 
     self.quadrature = self.inventory.quadrature
-    #self.perfLogger = self.inventory.perfLogger
+    self.perfLogger = self.inventory.perfLogger
     return
 
   
@@ -179,6 +179,16 @@
           "Please implement _createModuleOb() in derived class."
 
 
+  def _modelMemoryUse(self):
+    """
+    Model allocated memory.
+    """
+    self.perfLogger.logMaterial('Materials', self)
+    self.perfLogger.logField('Materials', self.propertiesField())
+    self.perfLogger.logField('Materials', self.stateVarsField())
+    return
+
+
   def _setupLogging(self):
     """
     Setup event logging.

Modified: short/3D/PyLith/trunk/pylith/meshio/CellFilter.py
===================================================================
--- short/3D/PyLith/trunk/pylith/meshio/CellFilter.py	2009-06-25 02:27:14 UTC (rev 15383)
+++ short/3D/PyLith/trunk/pylith/meshio/CellFilter.py	2009-06-25 02:29:25 UTC (rev 15384)
@@ -28,6 +28,16 @@
   Factory: output_cell_filter
   """
 
+  # INVENTORY //////////////////////////////////////////////////////////
+
+  import pyre.inventory
+
+  from pylith.perf.MemoryLogger import MemoryLogger
+  perfLogger = pyre.inventory.facility("perf_logger", family="perf_logger",
+                                       factory=MemoryLogger)
+  perfLogger.meta['tip'] = "Performance and memory logging."
+
+
   # PUBLIC METHODS /////////////////////////////////////////////////////
 
   def __init__(self, name="cellfilter"):
@@ -52,6 +62,34 @@
     return
 
 
+  def finalize(self):
+    """
+    Cleanup after running problem.
+    """
+    self._modelMemoryUse()
+    return
+
+
+  # PRIVATE METHODS ///////////////////////////////////////////////////
+
+  def _configure(self):
+    """
+    Set members based using inventory.
+    """
+    PetscComponent._configure(self)
+    self.perfLogger = self.inventory.perfLogger
+    return
+
+
+  def _modelMemoryUse(self):
+    """
+    Model memory allocation.
+    """
+    raise NotImplementedError("Please implement _modelMemoryUse() in "
+                              "derived class.")
+    return
+
+
 # FACTORIES ////////////////////////////////////////////////////////////
 
 def output_cell_filter():

Modified: short/3D/PyLith/trunk/pylith/meshio/CellFilterAvgMesh.py
===================================================================
--- short/3D/PyLith/trunk/pylith/meshio/CellFilterAvgMesh.py	2009-06-25 02:27:14 UTC (rev 15383)
+++ short/3D/PyLith/trunk/pylith/meshio/CellFilterAvgMesh.py	2009-06-25 02:29:25 UTC (rev 15384)
@@ -48,6 +48,16 @@
     return
 
 
+  # PRIVATE METHODS ///////////////////////////////////////////////////
+
+  def _modelMemoryUse(self):
+    """
+    Model memory allocation.
+    """
+    self.perfLogger.logField('Output', self.fieldAvg())
+    return
+
+
 # FACTORIES ////////////////////////////////////////////////////////////
 
 def output_cell_filter():

Modified: short/3D/PyLith/trunk/pylith/meshio/CellFilterAvgSubMesh.py
===================================================================
--- short/3D/PyLith/trunk/pylith/meshio/CellFilterAvgSubMesh.py	2009-06-25 02:27:14 UTC (rev 15383)
+++ short/3D/PyLith/trunk/pylith/meshio/CellFilterAvgSubMesh.py	2009-06-25 02:29:25 UTC (rev 15384)
@@ -48,6 +48,16 @@
     return
 
 
+  # PRIVATE METHODS ///////////////////////////////////////////////////
+
+  def _modelMemoryUse(self):
+    """
+    Model memory allocation.
+    """
+    self.perfLogger.logFields('Output', self.fieldAvg())
+    return
+
+
 # FACTORIES ////////////////////////////////////////////////////////////
 
 def output_cell_filter():

Modified: short/3D/PyLith/trunk/pylith/meshio/OutputManager.py
===================================================================
--- short/3D/PyLith/trunk/pylith/meshio/OutputManager.py	2009-06-25 02:27:14 UTC (rev 15383)
+++ short/3D/PyLith/trunk/pylith/meshio/OutputManager.py	2009-06-25 02:29:25 UTC (rev 15384)
@@ -36,6 +36,7 @@
   @li \b coordsys Coordinate system for output.
   @li \b vertex_filter Filter for vertex data.
   @li \b cell_filter Filter for cell data.
+  @li \b perf_logger Performance (memory) logger.
   """
 
   # INVENTORY //////////////////////////////////////////////////////////
@@ -70,7 +71,12 @@
                                        factory=NullComponent)
   cellFilter.meta['tip'] = "Filter for cell data."
   
+  from pylith.perf.MemoryLogger import MemoryLogger
+  perfLogger = pyre.inventory.facility("perf_logger", family="perf_logger",
+                                       factory=MemoryLogger)
+  perfLogger.meta['tip'] = "Performance and memory logging."
 
+
   # PUBLIC METHODS /////////////////////////////////////////////////////
 
   def __init__(self, name="outputmanager"):
@@ -147,6 +153,16 @@
     return
 
 
+  def finalize(self):
+    """
+    Cleanup after running problem.
+    """
+    if not isinstance(self.inventory.cellFilter, NullComponent):
+      self.cellFilter.finalize()
+    self._modelMemoryUse()
+    return
+
+
   def open(self, totalTime, numTimeSteps):
     """
     Prepare for writing data.
@@ -239,6 +255,7 @@
     Set members based using inventory.
     """
     PetscComponent._configure(self)
+    self.perfLogger = self.inventory.perfLogger
     return
 
 
@@ -251,6 +268,14 @@
     return
   
 
+  def _modelMemoryUse(self):
+    """
+    Model memory allocation.
+    """
+    self.perfLogger.logFields('Output', self.fields())
+    return
+
+
   def _estimateNumSteps(self, totalTime, numTimeSteps):
     """
     Estimate the number of time steps we expect to output.

Modified: short/3D/PyLith/trunk/pylith/perf/MemoryLogger.py
===================================================================
--- short/3D/PyLith/trunk/pylith/perf/MemoryLogger.py	2009-06-25 02:27:14 UTC (rev 15383)
+++ short/3D/PyLith/trunk/pylith/perf/MemoryLogger.py	2009-06-25 02:29:25 UTC (rev 15384)
@@ -116,6 +116,8 @@
     """
     Log fields to determine memory from our model.
     """
+    if fields is None:
+      return
     names = fields.fieldNames()
     for name in names:
       field = fields.get(name)

Modified: short/3D/PyLith/trunk/pylith/problems/Explicit.py
===================================================================
--- short/3D/PyLith/trunk/pylith/problems/Explicit.py	2009-06-25 02:27:14 UTC (rev 15383)
+++ short/3D/PyLith/trunk/pylith/problems/Explicit.py	2009-06-25 02:29:25 UTC (rev 15384)
@@ -108,7 +108,6 @@
 
     logger.stagePop()
     logger.setDebug(0)
-    self._modelMemoryUse()
     self._eventLogger.eventEnd(logEvent)
     return
 

Modified: short/3D/PyLith/trunk/pylith/problems/Formulation.py
===================================================================
--- short/3D/PyLith/trunk/pylith/problems/Formulation.py	2009-06-25 02:27:14 UTC (rev 15383)
+++ short/3D/PyLith/trunk/pylith/problems/Formulation.py	2009-06-25 02:29:25 UTC (rev 15384)
@@ -345,7 +345,10 @@
       constraint.finalize()
     for output in self.output.components():
       output.close()
+      output.finalize()
     self._debug.log(resourceUsageString())
+    
+    self._modelMemoryUse()
 
     self._eventLogger.eventEnd(logEvent)
     return
@@ -534,7 +537,6 @@
       self.perfLogger.logQuadrature('Quadrature', integrator.quadrature())
     # Placeholders until we know we they go
     self.perfLogger.memory['Fault'] = 0
-    self.perfLogger.memory['Output'] = 0
     return
 
 

Modified: short/3D/PyLith/trunk/pylith/problems/Implicit.py
===================================================================
--- short/3D/PyLith/trunk/pylith/problems/Implicit.py	2009-06-25 02:27:14 UTC (rev 15383)
+++ short/3D/PyLith/trunk/pylith/problems/Implicit.py	2009-06-25 02:29:25 UTC (rev 15384)
@@ -148,7 +148,6 @@
 
     memoryLogger.stagePop()
     memoryLogger.setDebug(0)
-    self._modelMemoryUse()
     return
 
 

Modified: short/3D/PyLith/trunk/pylith/problems/Problem.py
===================================================================
--- short/3D/PyLith/trunk/pylith/problems/Problem.py	2009-06-25 02:27:14 UTC (rev 15383)
+++ short/3D/PyLith/trunk/pylith/problems/Problem.py	2009-06-25 02:29:25 UTC (rev 15384)
@@ -112,11 +112,6 @@
                                           factory=NullComponent)
     gravityField.meta['tip'] = "Database used for gravity field."
 
-    from pylith.perf.MemoryLogger import MemoryLogger
-    perfLogger = pyre.inventory.facility("perf_logger", family="perf_logger",
-                                         factory=MemoryLogger)
-    perfLogger.meta['tip'] = "Performance and memory logging."
-
   
 
   # PUBLIC METHODS /////////////////////////////////////////////////////
@@ -229,7 +224,6 @@
       self.gravityField = None
     else:
       self.gravityField = self.inventory.gravityField
-    self.perfLogger = self.inventory.perfLogger
     return
 
 

Modified: short/3D/PyLith/trunk/pylith/utils/PetscComponent.py
===================================================================
--- short/3D/PyLith/trunk/pylith/utils/PetscComponent.py	2009-06-25 02:27:14 UTC (rev 15383)
+++ short/3D/PyLith/trunk/pylith/utils/PetscComponent.py	2009-06-25 02:29:25 UTC (rev 15384)
@@ -34,23 +34,23 @@
     return
   
 
-  def compilePerformanceLog(self):
+  def compilePerformanceLog(self, parentLogger):
     """
     Compile performance and memory information.
     """
+    if hasattr(self, 'perfLogger'):
+      if not parentLogger is None:
+        parentLogger.join(self.perfLogger)
+
     for component in self.components():
       if isinstance(component, PetscComponent):
-        component.compilePerformanceLog()
-        if hasattr(component, 'perfLogger'):
-          self.perfLogger.join(component.perfLogger)
+        component.compilePerformanceLog(parentLogger)
 
       # Facility arrays are not PetscComponents but have components().
       elif hasattr(component, "components"):
         for subcomponent in component.components():
           if isinstance(subcomponent, PetscComponent):
-            subcomponent.compilePerformanceLog()
-            if hasattr(subcomponent, 'perfLogger'):
-              self.perfLogger.join(subcomponent.perfLogger)
+            subcomponent.compilePerformanceLog(parentLogger)
     return
 
 



More information about the CIG-COMMITS mailing list