[MOAB-dev] r4847 - in MOAB/trunk/src: io parallel

kraftche at cae.wisc.edu kraftche at cae.wisc.edu
Wed May 18 17:50:04 CDT 2011


Author: kraftche
Date: 2011-05-18 17:50:03 -0500 (Wed, 18 May 2011)
New Revision: 4847

Modified:
   MOAB/trunk/src/io/WriteHDF5.cpp
   MOAB/trunk/src/io/WriteHDF5.hpp
   MOAB/trunk/src/parallel/WriteHDF5Parallel.cpp
   MOAB/trunk/src/parallel/WriteHDF5Parallel.hpp
Log:
Improve "CPUTIME" writer option for WriteHDF5(Parallel):
  o More fine-grained timing data
  o Print max over all procs from root if parallel


Modified: MOAB/trunk/src/io/WriteHDF5.cpp
===================================================================
--- MOAB/trunk/src/io/WriteHDF5.cpp	2011-05-18 22:13:06 UTC (rev 4846)
+++ MOAB/trunk/src/io/WriteHDF5.cpp	2011-05-18 22:50:03 UTC (rev 4847)
@@ -59,6 +59,15 @@
 #define RUNTIME (clock()/(double)CLOCKS_PER_SEC)
 #endif
 
+class CpuTimer {
+private:
+  double atBirth, atLast;
+public:
+  CpuTimer() : atBirth(RUNTIME), atLast(atBirth) {}
+  double since_birth() { return (atLast = RUNTIME) - atBirth; };
+  double elapsed() { double tmp = atLast; return (atLast = RUNTIME) - tmp; }
+};
+
 /* Access HDF5 file handle for debugging
 #include <H5Fpublic.h>
 struct file { uint32_t magic; hid_t handle; };
@@ -135,7 +144,6 @@
 static inline ErrorCode error( ErrorCode rval )
   { return rval; }
 
-
 // Call \c error function during HDF5 library errors to make
 // it easier to trap such errors in the debugger.  This function
 // gets registered with the HDF5 library as a callback.  It
@@ -296,7 +304,6 @@
   CheckOpenWriteHDF5Handles check_open_handles_(filePtr,__LINE__)
 #endif
 
-
 bool WriteHDF5::convert_handle_tag( const EntityHandle* source,
                                     EntityHandle* dest, size_t count ) const
 {
@@ -482,9 +489,8 @@
 
   // Enable debug output
   int tmpval = 0;
-  if (MB_SUCCESS == opts.get_int_option("DEBUG_IO", 1, tmpval)) {
+  if (MB_SUCCESS == opts.get_int_option("DEBUG_IO", 1, tmpval))
     dbgOut.set_verbosity(tmpval);
-  }
 
   //writeTagDense = (MB_SUCCESS == opts.get_null_option("DENSE_TAGS"));
   writeTagDense = true; 
@@ -565,7 +571,7 @@
   std::list<TagDesc>::const_iterator t_itor;
   std::list<ExportSet>::iterator ex_itor;
   EntityHandle elem_count, max_id;


More information about the moab-dev mailing list