[MOAB-dev] r3957 - MOAB/trunk/src/io

kraftche at cae.wisc.edu kraftche at cae.wisc.edu
Tue May 25 14:31:43 CDT 2010


Author: kraftche
Date: 2010-05-25 14:31:43 -0500 (Tue, 25 May 2010)
New Revision: 3957

Modified:
   MOAB/trunk/src/io/ReadHDF5.cpp
   MOAB/trunk/src/io/WriteHDF5.cpp
Log:
Write node coordinates in interleaved format.

Using HDF5 chunked IO to enable the on-disk layout of node coordinates to 
be column-major results in deadlocks when writing in parallel on cosmea.
So this is plan B: just write the node coorindates in interleaved format.
This requires extra buffering of node coordinate data when writing, but 
will hopefully avoid the long read times observed on cosmea.



Modified: MOAB/trunk/src/io/ReadHDF5.cpp
===================================================================
--- MOAB/trunk/src/io/ReadHDF5.cpp	2010-05-25 19:22:52 UTC (rev 3956)
+++ MOAB/trunk/src/io/ReadHDF5.cpp	2010-05-25 19:31:43 UTC (rev 3957)
@@ -54,6 +54,7 @@
 
 namespace moab {
 
+#undef BLOCKED_COORD_IO
 
 #define READ_HDF5_BUFFER_SIZE (40*1024*1024)
 
@@ -1042,7 +1043,6 @@
   if (is_error(status))
     return error(MB_FAILURE);
 
-  
   EntityHandle handle;
   std::vector<double*> arrays(dim);
   rval = readUtil->get_node_coords( dim, (int)node_file_ids.size(), 0, handle, arrays );
@@ -1051,33 +1051,62 @@
     mhdf_closeData( filePtr, data_id, &status );
     return error(rval);
   }
+
+#ifndef BLOCKED_COORD_IO
+  double* buffer = (double*)dataBuffer;
+  long chunk_size = bufferSize / (3*sizeof(double));
+  long coffset = 0;
+#endif
   
     // read blocks of coordinates
   Range::const_pair_iterator p;
   for (p = node_file_ids.const_pair_begin(); p != node_file_ids.const_pair_end(); ++p)
   {
-    long count = p->second - p->first + 1;
+    long remaining = p->second - p->first + 1;
     long offset = p->first - fileInfo->nodes.start_id;
     
-    debug_track.record_io( offset, count );
-    dbgOut.tprintf(4,"Reading nodes [%ld,%ld]\n", offset, offset+count-1);
+    if (!idMap.insert( p->first, handle, remaining ).second) {
+      mhdf_closeData( filePtr, data_id, &status );
+      return error(MB_FAILURE);
+    }
+    handle += remaining;
+
+#ifdef BLOCKED_COORD_IO  
+    
+    debug_track.record_io( offset, remaining );
+    dbgOut.tprintf(4,"Reading nodes [%ld,%ld]\n", offset, offset+remaining-1);


More information about the moab-dev mailing list