[cig-commits] r15428 - in short/3D/PyLith/trunk: libsrc/faults libsrc/meshio pylith pylith/apps pylith/faults pylith/perf
brad at geodynamics.org
brad at geodynamics.org
Sun Jul 5 19:12:35 PDT 2009
Author: brad
Date: 2009-07-05 19:12:35 -0700 (Sun, 05 Jul 2009)
New Revision: 15428
Added:
short/3D/PyLith/trunk/pylith/perf/Fault.py
Modified:
short/3D/PyLith/trunk/libsrc/faults/CohesiveTopology.cc
short/3D/PyLith/trunk/libsrc/faults/FaultCohesiveKin.cc
short/3D/PyLith/trunk/libsrc/faults/StepSlipFn.cc
short/3D/PyLith/trunk/libsrc/meshio/MeshBuilder.cc
short/3D/PyLith/trunk/pylith/Makefile.am
short/3D/PyLith/trunk/pylith/apps/PyLithApp.py
short/3D/PyLith/trunk/pylith/faults/FaultCohesiveKin.py
short/3D/PyLith/trunk/pylith/perf/MemoryLogger.py
short/3D/PyLith/trunk/pylith/perf/__init__.py
Log:
More work on memory model.
Modified: short/3D/PyLith/trunk/libsrc/faults/CohesiveTopology.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/faults/CohesiveTopology.cc 2009-07-05 02:21:29 UTC (rev 15427)
+++ short/3D/PyLith/trunk/libsrc/faults/CohesiveTopology.cc 2009-07-06 02:12:35 UTC (rev 15428)
@@ -43,6 +43,10 @@
assert(0 != faultMesh);
assert(!groupField.isNull());
+ // Memory logging
+ ALE::MemoryLogger& logger = ALE::MemoryLogger::singleton();
+ logger.stagePush("FaultCreation");
+
faultMesh->coordsys(mesh);
const ALE::Obj<SieveMesh>& sieveMesh = mesh.sieveMesh();
@@ -86,7 +90,12 @@
fault->getArrowSection("orientation"),
faultSieve, flipFault);
fault->setSieve(faultSieve);
+
+ logger.stagePop();
+ logger.stagePush("FaultStratification");
fault->stratify();
+ logger.stagePop();
+ logger.stagePush("FaultCreation");
if (debug)
fault->view("Fault mesh");
@@ -103,6 +112,8 @@
faultSieveMesh->setSieve(ifaultSieve);
ALE::ISieveConverter::convertMesh(*fault, *faultSieveMesh, renumbering, false);
renumbering.clear();
+
+ logger.stagePop();
} // createFault
// ----------------------------------------------------------------------
@@ -123,6 +134,10 @@
typedef ALE::SieveAlg<ALE::Mesh> sieveAlg;
typedef ALE::Selection<ALE::Mesh> selection;
+ // Memory logging
+ ALE::MemoryLogger& logger = ALE::MemoryLogger::singleton();
+ logger.stagePush("FaultCreation");
+
const ALE::Obj<SieveMesh>& sieveMesh = mesh->sieveMesh();
assert(!sieveMesh.isNull());
const ALE::Obj<SieveSubMesh>& faultSieveMesh = faultMesh.sieveMesh();
@@ -187,6 +202,8 @@
std::cout << "Duplicating " << *v_iter << " to "
<< vertexRenumber[*v_iter] << std::endl;
+ logger.stagePop();
+ logger.stagePush("FaultStratification");
// Add shadow and constraint vertices (if they exist) to group
// associated with fault
groupField->addPoint(firstFaultVertex, 1);
@@ -203,6 +220,8 @@
sieveMesh->setDepth(firstFaultVertex+numFaultVertices, 0);
#endif
} // if
+ logger.stagePop();
+ logger.stagePush("FaultCreation");
// Add shadow vertices to other groups, don't add constraint
// vertices (if they exist) because we don't want BC, etc to act
@@ -382,11 +401,15 @@
} // if
// TODO: Need to reform the material label when sieve is reallocated
sieveMesh->setValue(material, firstFaultCell, materialId);
+ logger.stagePop();
+ logger.stagePush("FaultStratification");
#if defined(FAST_STRATIFY)
// OPTIMIZATION
sieveMesh->setHeight(firstFaultCell, 0);
sieveMesh->setDepth(firstFaultCell, 1);
#endif
+ logger.stagePop();
+ logger.stagePush("FaultCreation");
sV2.clear();
cV2.clear();
} // for
@@ -574,7 +597,11 @@
if (!faultSieveMesh->commRank())
delete [] indices;
#if !defined(FAST_STRATIFY)
+ logger.stagePop();
+ logger.stagePush("FaultStratification");
sieveMesh->stratify();
+ logger.stagePop();
+ logger.stagePush("FaultCreation");
#endif
const std::string labelName("censored depth");
@@ -635,6 +662,8 @@
} // for
if (debug)
coordinates->view("Coordinates with shadow vertices");
+
+ logger.stagePop();
} // create
// ----------------------------------------------------------------------
@@ -650,6 +679,10 @@
assert(0 != faultMesh);
assert(0 != cohesiveToFault);
+ // Memory logging
+ ALE::MemoryLogger& logger = ALE::MemoryLogger::singleton();
+ logger.stagePush("FaultCreation");
+
faultMesh->coordsys(mesh);
const ALE::Obj<SieveMesh>& sieveMesh = mesh.sieveMesh();
@@ -718,7 +751,11 @@
cV.clear();
} // for
fault->setSieve(faultSieve);
+ logger.stagePop();
+ logger.stagePush("FaultStratification");
fault->stratify();
+ logger.stagePop();
+ logger.stagePush("FaultCreation");
// Convert fault to an IMesh
SieveSubMesh::renumbering_type& fRenumbering =
@@ -731,7 +768,11 @@
ALE::ISieveConverter::convertSieve(*fault->getSieve(),
*faultSieveMesh->getSieve(),
fRenumbering, true);
+ logger.stagePop();
+ logger.stagePush("FaultStratification");
faultSieveMesh->stratify();
+ logger.stagePop();
+ logger.stagePush("FaultCreation");
ALE::ISieveConverter::convertOrientation(*fault->getSieve(),
*faultSieveMesh->getSieve(),
fRenumbering,
@@ -846,6 +887,8 @@
faultSieveMesh->setCalculatedOverlap(true);
//sendParallelMeshOverlap->view("Send parallel fault overlap");
//recvParallelMeshOverlap->view("Recv parallel fault overlap");
+
+ logger.stagePop();
} // createFaultParallel
Modified: short/3D/PyLith/trunk/libsrc/faults/FaultCohesiveKin.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/faults/FaultCohesiveKin.cc 2009-07-05 02:21:29 UTC (rev 15427)
+++ short/3D/PyLith/trunk/libsrc/faults/FaultCohesiveKin.cc 2009-07-06 02:12:35 UTC (rev 15428)
@@ -122,7 +122,7 @@
} // for
ALE::MemoryLogger& logger = ALE::MemoryLogger::singleton();
- logger.stagePush("Fault");
+ //logger.stagePush("Fault");
// Allocate slip field
const ALE::Obj<SieveSubMesh>& faultSieveMesh = _faultMesh->sieveMesh();
@@ -160,7 +160,7 @@
// Compute tributary area for each vertex in fault mesh.
_calcArea();
- logger.stagePop();
+ //logger.stagePop();
} // initialize
// ----------------------------------------------------------------------
@@ -1197,13 +1197,13 @@
const ALE::Obj<RealSection>& tractionsSection = tractions->section();
if (tractionsSection.isNull()) {
ALE::MemoryLogger& logger = ALE::MemoryLogger::singleton();
- logger.stagePush("Fault");
+ //logger.stagePush("Fault");
const topology::Field<topology::SubMesh>& slip =_fields->get("slip");
tractions->newSection(slip, fiberDim);
tractions->allocate();
- logger.stagePop();
+ //logger.stagePop();
} // if
assert(!tractionsSection.isNull());
tractions->zero();
Modified: short/3D/PyLith/trunk/libsrc/faults/StepSlipFn.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/faults/StepSlipFn.cc 2009-07-05 02:21:29 UTC (rev 15427)
+++ short/3D/PyLith/trunk/libsrc/faults/StepSlipFn.cc 2009-07-06 02:12:35 UTC (rev 15428)
@@ -76,6 +76,10 @@
const double lengthScale = normalizer.lengthScale();
const double timeScale = normalizer.timeScale();
+ // Memory logging
+ ALE::MemoryLogger& logger = ALE::MemoryLogger::singleton();
+ logger.stagePush("Fault");
+
// Get vertices in fault mesh
const ALE::Obj<SieveMesh>& sieveMesh = faultMesh.sieveMesh();
assert(!sieveMesh.isNull());
@@ -84,12 +88,10 @@
const label_sequence::iterator verticesBegin = vertices->begin();
const label_sequence::iterator verticesEnd = vertices->end();
- ALE::MemoryLogger& logger = ALE::MemoryLogger::singleton();
- logger.stagePush("Fault");
-
delete _parameters; _parameters = new topology::Fields<topology::Field<topology::SubMesh> >(faultMesh);
assert(0 != _parameters);
_parameters->add("final slip", "final_slip");
+
topology::Field<topology::SubMesh>& finalSlip = _parameters->get("final slip");
finalSlip.newSection(vertices, spaceDim);
finalSlip.allocate();
Modified: short/3D/PyLith/trunk/libsrc/meshio/MeshBuilder.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/meshio/MeshBuilder.cc 2009-07-05 02:21:29 UTC (rev 15427)
+++ short/3D/PyLith/trunk/libsrc/meshio/MeshBuilder.cc 2009-07-06 02:12:35 UTC (rev 15428)
@@ -210,11 +210,12 @@
fault->setSieve(sieve);
MPI_Comm_rank(comm, &rank);
- // Memory debugging
+
+ // Memory logging
ALE::MemoryLogger& logger = ALE::MemoryLogger::singleton();
logger.setDebug(fault->debug()/2);
+ logger.stagePush("FaultCreation");
- logger.stagePush("FaultCreation");
if (0 == rank) {
assert(coordinates.size() == numVertices*spaceDim);
assert(cells.size() == numCells*numCorners);
Modified: short/3D/PyLith/trunk/pylith/Makefile.am
===================================================================
--- short/3D/PyLith/trunk/pylith/Makefile.am 2009-07-05 02:21:29 UTC (rev 15427)
+++ short/3D/PyLith/trunk/pylith/Makefile.am 2009-07-06 02:12:35 UTC (rev 15428)
@@ -92,6 +92,7 @@
perf/Logger.py \
perf/MemoryLogger.py \
perf/Mesh.py \
+ perf/Fault.py \
perf/Material.py \
perf/VertexGroup.py \
perf/Field.py \
Modified: short/3D/PyLith/trunk/pylith/apps/PyLithApp.py
===================================================================
--- short/3D/PyLith/trunk/pylith/apps/PyLithApp.py 2009-07-05 02:21:29 UTC (rev 15427)
+++ short/3D/PyLith/trunk/pylith/apps/PyLithApp.py 2009-07-06 02:12:35 UTC (rev 15428)
@@ -85,7 +85,6 @@
if "interfaces" in dir(self.problem):
interfaces = self.problem.interfaces.components()
mesh = self.mesher.create(self.problem.normalizer, interfaces)
- self.perfLogger.logMesh('Mesh', mesh)
del interfaces
del self.mesher
self._debug.log(resourceUsageString())
@@ -112,8 +111,10 @@
self.problem.finalize()
self._eventLogger.stagePop()
+ self.perfLogger.logMesh('Mesh', mesh)
self.compilePerformanceLog()
- if self.perfLogger.verbose: self.perfLogger.show()
+ if self.perfLogger.verbose:
+ self.perfLogger.show()
del mesh
del self.problem
Modified: short/3D/PyLith/trunk/pylith/faults/FaultCohesiveKin.py
===================================================================
--- short/3D/PyLith/trunk/pylith/faults/FaultCohesiveKin.py 2009-07-05 02:21:29 UTC (rev 15427)
+++ short/3D/PyLith/trunk/pylith/faults/FaultCohesiveKin.py 2009-07-06 02:12:35 UTC (rev 15428)
@@ -226,6 +226,7 @@
"""
Model memory allocation.
"""
+ self.perfLogger.logFault("Fault", self)
self.perfLogger.logFields("Fault", self.fields())
return
Added: short/3D/PyLith/trunk/pylith/perf/Fault.py
===================================================================
--- short/3D/PyLith/trunk/pylith/perf/Fault.py (rev 0)
+++ short/3D/PyLith/trunk/pylith/perf/Fault.py 2009-07-06 02:12:35 UTC (rev 15428)
@@ -0,0 +1,38 @@
+#!/usr/bin/env python
+#
+# ----------------------------------------------------------------------
+#
+# Brad T. Aagaard
+# U.S. Geological Survey
+#
+# <LicenseText>
+#
+# ----------------------------------------------------------------------
+#
+
+## @file pylith/perf/Fault.py
+##
+## @brief Python memory model for Fault.
+
+from Memory import Memory
+
+class Fault(Memory):
+ """
+ Fault object for holding mesh memory and performance information.
+ """
+ def __init__(self):
+ """
+ Constructor.
+ """
+ return
+
+
+ def tabulate(self, memDict):
+ """
+ Tabulate memory use.
+ """
+ memDict['Creation'] = 0
+ memDict['Stratification'] = 0
+ memDict['Coordinates'] = 0
+ return
+
Modified: short/3D/PyLith/trunk/pylith/perf/MemoryLogger.py
===================================================================
--- short/3D/PyLith/trunk/pylith/perf/MemoryLogger.py 2009-07-05 02:21:29 UTC (rev 15427)
+++ short/3D/PyLith/trunk/pylith/perf/MemoryLogger.py 2009-07-06 02:12:35 UTC (rev 15428)
@@ -162,6 +162,18 @@
return
+ def logFault(self, stage, mesh):
+ """
+ Lof fault parameters to determine memory from our model.
+ """
+ import pylith.perf.Fault
+
+ if not stage in self.memory: self.memory[stage] = {}
+ faultModel = pylith.perf.Fault.Fault()
+ faultModel.tabulate(self.memory[stage])
+ return
+
+
def mergeMemDict(self, memDictTarget, memDictSource):
for key in memDictSource:
if not key in memDictTarget:
Modified: short/3D/PyLith/trunk/pylith/perf/__init__.py
===================================================================
--- short/3D/PyLith/trunk/pylith/perf/__init__.py 2009-07-05 02:21:29 UTC (rev 15427)
+++ short/3D/PyLith/trunk/pylith/perf/__init__.py 2009-07-06 02:12:35 UTC (rev 15428)
@@ -1 +1,30 @@
-__all__ = ['Memory', 'Logger', 'MemoryLogger', 'Mesh', 'Material', 'Field', 'GlobalOrder']
+#!/usr/bin/env python
+#
+# ----------------------------------------------------------------------
+#
+# Brad T. Aagaard
+# U.S. Geological Survey
+#
+# <LicenseText>
+#
+# ----------------------------------------------------------------------
+#
+
+## @file pylith/perf/__init__.py
+
+## @brief Python PyLith perf module initialization.
+
+__all__ = ['Memory',
+ 'Logger',
+ 'MemoryLogger',
+ 'Mesh',
+ 'Fault',
+ 'Material',
+ 'Field',
+ 'GlobalOrder',
+ ]
+
+
+# End of file
+
+
More information about the CIG-COMMITS
mailing list