[cig-commits] r12680 - in short/3D/PyLith/trunk/libsrc: meshio utils

knepley at geodynamics.org knepley at geodynamics.org
Tue Aug 19 08:04:59 PDT 2008


Author: knepley
Date: 2008-08-19 08:04:59 -0700 (Tue, 19 Aug 2008)
New Revision: 12680

Modified:
   short/3D/PyLith/trunk/libsrc/meshio/MeshIO.cc
   short/3D/PyLith/trunk/libsrc/utils/sievetypes.hh
Log:
Memory debugging


Modified: short/3D/PyLith/trunk/libsrc/meshio/MeshIO.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/meshio/MeshIO.cc	2008-08-18 23:19:01 UTC (rev 12679)
+++ short/3D/PyLith/trunk/libsrc/meshio/MeshIO.cc	2008-08-19 15:04:59 UTC (rev 12680)
@@ -99,10 +99,15 @@
   (*_mesh)->setSieve(sieve);
 
   MPI_Comm_rank(comm, &rank);
+  // Memory debugging
+  ALE::MemoryLogger& logger = ALE::MemoryLogger::singleton();
+  logger.setDebug(_debug);
+
+  logger.stagePush("MeshCreation");
   if (!rank) {
     assert(coordinates.size() == numVertices*spaceDim);
     assert(cells.size() == numCells*numCorners);
-    /// NEED TO CHANGE TEST DATA if (!_interpolate) {
+    //if (!_interpolate) {
     if (0) {
       // Create the ISieve
       sieve->setChart(Mesh::sieve_type::chart_type(0, numCells+numVertices));
@@ -133,6 +138,8 @@
       std::map<Mesh::point_type,Mesh::point_type> renumbering;
       ALE::ISieveConverter::convertSieve(*s, *sieve, renumbering);
     }
+    logger.stagePop();
+    logger.stagePush("MeshStratification");
     if (!_interpolate) {
       // Optimized stratification
       const ALE::Obj<Mesh::label_type>& height = (*_mesh)->createLabel("height");
@@ -150,11 +157,18 @@
     } else {
       (*_mesh)->stratify();
     }
+    logger.stagePop();
   } else {
+    logger.stagePush("MeshStratification");
     (*_mesh)->getSieve()->setChart(sieve_type::chart_type());
     (*_mesh)->getSieve()->allocate();
     (*_mesh)->stratify();
+    logger.stagePop();
   }
+  std::cout << std::endl << "MeshCreation " << logger.getNumAllocations("MeshCreation") << " allocations " << logger.getAllocationTotal("MeshCreation") << " bytes" << std::endl;
+  std::cout << std::endl << "MeshCreation " << logger.getNumDeallocations("MeshCreation") << " deallocations " << logger.getDeallocationTotal("MeshCreation") << " bytes" << std::endl;
+  std::cout << std::endl << "MeshStratification " << logger.getNumAllocations("MeshStratification") << " allocations " << logger.getAllocationTotal("MeshStratification") << " bytes" << std::endl;
+  std::cout << std::endl << "MeshStratification " << logger.getNumDeallocations("MeshStratification") << " deallocations " << logger.getDeallocationTotal("MeshStratification") << " bytes" << std::endl;
   ALE::SieveBuilder<Mesh>::buildCoordinates(*_mesh, spaceDim, &coordinates[0]);
 } // _buildMesh
 

Modified: short/3D/PyLith/trunk/libsrc/utils/sievetypes.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/utils/sievetypes.hh	2008-08-18 23:19:01 UTC (rev 12679)
+++ short/3D/PyLith/trunk/libsrc/utils/sievetypes.hh	2008-08-19 15:04:59 UTC (rev 12680)
@@ -10,6 +10,9 @@
 // ======================================================================
 //
 
+// This turns on memory debugging, see ALE_mem.hh
+#define ALE_MEM_LOGGING
+
 /**
  * @file pylith/utils/sievetypes.hh
  *



More information about the cig-commits mailing list