[MOAB-dev] r4932 - MOAB/trunk/src/parallel

kraftche at cae.wisc.edu kraftche at cae.wisc.edu
Thu Jun 2 16:45:00 CDT 2011


Author: kraftche
Date: 2011-06-02 16:45:00 -0500 (Thu, 02 Jun 2011)
New Revision: 4932

Modified:
   MOAB/trunk/src/parallel/WriteHDF5Parallel.cpp
   MOAB/trunk/src/parallel/WriteHDF5Parallel.hpp
Log:
Fix bugs in parallel write of shared sets

Modified: MOAB/trunk/src/parallel/WriteHDF5Parallel.cpp
===================================================================
--- MOAB/trunk/src/parallel/WriteHDF5Parallel.cpp	2011-06-02 20:40:36 UTC (rev 4931)
+++ MOAB/trunk/src/parallel/WriteHDF5Parallel.cpp	2011-06-02 21:45:00 UTC (rev 4932)
@@ -2307,10 +2307,30 @@
     // the description
   std::list<ParallelSet>::const_iterator iter;
   size_t count = 0;
-  for (iter = parallelSets.begin(); iter != parallelSets.end(); ++iter)
-    if (iter->description)
+  std::vector<id_t> ids;
+  for (iter = parallelSets.begin(); iter != parallelSets.end(); ++iter) {
+    if (iter->description) {
       ++count;
+      
+      id_t file_id = idMap.find( iter->handle );
+      assert( file_id && file_id >= start_id );
+      ids.push_back( file_id );
+    }
+  }
   
+    // Sort set handles by file ID, and construct range of file IDs
+    // build range of offsets into dataset
+  Range indices;
+  std::sort( ids.begin(), ids.end() );
+  if (std::unique(ids.begin(), ids.end()) != ids.end()) {
+    std::cerr << "Internal error at " __FILE__ ":" << __LINE__ << std::endl
+              << "Overlapping offsets for shared set descriptions" << std::endl;
+    std::cerr.flush();
+    MPI_Abort( myPcomm->proc_config().proc_comm(), 1 );
+  }
+  for (std::vector<id_t>::reverse_iterator it = ids.rbegin(); it != ids.rend(); ++it)
+    indices.insert( *it );
+  
     // get a large enough buffer for all of the shared set metadata
   std::vector<mhdf_index_t> tmp_buffer;
   size_t buffer_size = bufferSize / (4*sizeof(mhdf_index_t));
@@ -2324,20 +2344,16 @@
   }
   
     // get a buffer for offset locations
-  Range indices;
-  Range::iterator hint;
-  
-  mhdf_index_t* buff_iter = buffer;
-  for( iter = parallelSets.begin();
-        iter != parallelSets.end(); ++iter)
+  for( iter = parallelSets.begin(); iter != parallelSets.end(); ++iter)
   {
     if (!iter->description)
       continue;  // handled by a different processor


More information about the moab-dev mailing list