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

iulian at mcs.anl.gov iulian at mcs.anl.gov
Tue Feb 19 23:37:27 CST 2013


Author: iulian
Date: 2013-02-19 23:37:27 -0600 (Tue, 19 Feb 2013)
New Revision: 6014

Modified:
   MOAB/trunk/src/io/ReadHDF5.cpp
Log:
resolves ticket 273
the bug was in intersecting the subranges.
For a partial read (that appears in parallel), the id_map between file ids and local entity handles is 
fragmented, in terms of file ids. 
When we populate the local sets, we are reading "complete" sets from the file, on each processor, 
and we have to carefully fish out only the file entities that are found in the id_map (and exist on the local processor)
Because of efficiency, we are doing this intersection of subranges using 2 advancing pointers; 
the construct that crashed was this:
 hint = merge.insert( hint, it->value + off, it->value + off + count - 1 );

for some low values of it->value, and negative count, this number  it->value + off + count - 1 was actually negative,
but because it is an EntityHandle, it is an unsigned long int; it became something like 0xfffff...fffd
which is valid :( positive, very large. the set blowed up really bad, because this range that was added was 
ridiculously large. 

two fixes (redundant, in a way): 
1) break out when count becomes negative, and treat the next range in the ranged set. 
2) when advance to a next subrange in id_map, check if we passed the "end", and break out if yes

passes make check in parallel, but I should add a test to capture this bug
it showed up only at reading in parallel, I need to find out how to exercise the partial read of a file in serial 
and manufacture a simpler test


Modified: MOAB/trunk/src/io/ReadHDF5.cpp
===================================================================
--- MOAB/trunk/src/io/ReadHDF5.cpp	2013-02-19 19:41:19 UTC (rev 6013)
+++ MOAB/trunk/src/io/ReadHDF5.cpp	2013-02-20 05:37:27 UTC (rev 6014)
@@ -608,7 +608,7 @@
   }
   
   
-  dbgOut.tprint( 1, "Cleaining up\n" );
+  dbgOut.tprint( 1, "Cleaning up\n" );
   ErrorCode rval2 = clean_up_read( opts );
   if (rval == MB_SUCCESS && rval2 != MB_SUCCESS)
     rval = rval2;
@@ -3449,11 +3449,20 @@
       if (id < it->begin) id = it->begin;
       const long off = id - it->begin;
       long count = std::min( it->count - off,  end - id );
+      // it is possible that this new subrange is starting after the end
+      // it will result in negative count, which does not make sense
+      // we are done with this range, go to the next one
+      if (count <= 0)
+        break;
       hint = merge.insert( hint, it->value + off, it->value + off + count - 1 );
       id += count;
       if (id < end)
+      {
         if (++it == id_map.end())
           break;
+        if (it->begin > end)
+          break; //
+      }
     }
   }
 }



More information about the moab-dev mailing list