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

kraftche at cae.wisc.edu kraftche at cae.wisc.edu
Tue Mar 1 11:01:19 CST 2011


Author: kraftche
Date: 2011-03-01 11:01:19 -0600 (Tue, 01 Mar 2011)
New Revision: 4536

Modified:
   MOAB/trunk/src/io/WriteHDF5.cpp
   MOAB/trunk/src/io/WriteHDF5.hpp
   MOAB/trunk/src/parallel/WriteHDF5Parallel.cpp
Log:
collective parallel IO for writing variable-length tag data to .h5m file

Modified: MOAB/trunk/src/io/WriteHDF5.cpp
===================================================================
--- MOAB/trunk/src/io/WriteHDF5.cpp	2011-02-28 23:16:06 UTC (rev 4535)
+++ MOAB/trunk/src/io/WriteHDF5.cpp	2011-03-01 17:01:19 UTC (rev 4536)
@@ -1890,6 +1890,182 @@
   return MB_SUCCESS;
 }
 
+
+ErrorCode WriteHDF5::write_var_len_indices( const SparseTag& tag_data,
+                                            const Range& range,
+                                            hid_t idx_table,
+                                            size_t table_size,
+                                            int type_size,
+                                            const char* name )
+{
+  ErrorCode rval;
+  mhdf_Status status;
+
+  CHECK_OPEN_HANDLES;
+
+  std::string tname(name ? name : "<UNKNOWN TAG?>");
+  tname += " - End Indices";
+  IODebugTrack track( debugTrack, tname, table_size );
+
+    // Set up data buffer for writing indices
+  size_t chunk_size = bufferSize / (std::max(sizeof(void*),sizeof(long)) + sizeof(int));
+  long* idx_buffer = (long*)dataBuffer;
+  const void** junk = (const void**)dataBuffer;
+  int* size_buffer = (int*)(dataBuffer + chunk_size*std::max(sizeof(void*),sizeof(long)));
+  
+    // Write IDs of tagged entities.
+  long data_offset = tag_data.varDataOffset - 1; // offset at which to write data buffer
+  size_t remaining = range.size();
+  size_t offset = tag_data.offset;
+  size_t num_writes = (remaining + chunk_size - 1)/chunk_size;
+  size_t num_global_writes = num_writes;
+  if (tag_data.max_num_ents) {
+    assert(tag_data.max_num_ents >= (unsigned long)remaining);
+    num_global_writes = (tag_data.max_num_ents + chunk_size - 1)/chunk_size;
+  }
+  Range::const_iterator iter = range.begin();
+  while (remaining)
+  {
+    VALGRIND_MAKE_MEM_UNDEFINED( dataBuffer, bufferSize );
+
+      // write "chunk_size" blocks of data
+    size_t count = remaining > chunk_size ? chunk_size : remaining;
+    remaining -= count;
+    Range::const_iterator stop = iter;
+    stop += count;


More information about the moab-dev mailing list