Take a look at revision 4214 to src/mesh/mesh_refinement.C

It's the "implicit PointLocator construction fails" bug again, but
this time with no threads involved.  If a problem with periodic
boundaries was run under certain conditions and on the right
partitioning, then some of the MPI ranks (those with partitions
falling on a periodic boundary) would need to construct/update a
PointLocator to do searches across the boundary, while other ranks
would not.  PointLocatorTree's constructor needs to run on all ranks
to build a bounding box, and so fails.

The fix is the same, but I'm not sure how to make sure we catch this
problem in the future.  That "libmesh_assert(!Threads::in_threads)"
call is a good safeguard for the "in threaded code" case, but what
about the "in an ordinary local_elements loop" case?

The library is fixed for now, but it's an easy mistake to repeat.  I'm
going to Cc: Derek since his people are probably the most likely to
get bitten by this in user code too.

The problem:

point_locator(), and topological_neighbor(), and perhaps an expanding
range of future functions, should not be used inside element loops
unless the loop is preceded by an explicit PointLocator construction.

The only solutions I can think of:

1. The default: we accept that code with this problem may work fine on
N processors but then die horribly on N+1.

2. We could create a convoluted functor-class-based paradigm similar
to Threads::/TBB to enable a similar test... but if we go through that
much trouble we might as well just make every single local_elements
loop multithreaded.

3. We could wait for the neat lambda function support in C++0x... or
was that C++1x?

4. We always generate a PointLocatorTree when preparing an updated
Mesh.  This is too expensive for users who don't need the tree, and it
won't fix things when (as was just the case) the problem is in a class
like MeshRefinement that's in the middle of the Mesh-updating process.
---
Roy

------------------------------------------------------------------------------
Free Software Download: Index, Search & Analyze Logs and other IT data in 
Real-Time with Splunk. Collect, index and harness all the fast moving IT data 
generated by your applications, servers and devices whether physical, virtual
or in the cloud. Deliver compliance at lower cost and gain new business 
insights. http://p.sf.net/sfu/splunk-dev2dev 
_______________________________________________
Libmesh-devel mailing list
Libmesh-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libmesh-devel

Reply via email to