On Thu, 11 Mar 2010, Roy Stogner wrote:

> On Thu, 11 Mar 2010, Kirk, Benjamin (JSC-EG311) wrote:
>
>> tangential issue - did you find that ACX_TLS and is it sufficient to just
>> throw TLS in front of a variable to make it so?
>
> Rhys Ulerich pointed me to it, IIRC.  I'm afraid I haven't tested it
> myself yet (I just rebuilt to use threads yesterday and haven't run
> the FIN-S regression tests with --n-threads=4 yet) but they've been
> using it successfully for a while.
>
> But yeah, if you're going where I think you're going with this, then I
> suspect using "TLS STRING_VECTOR" for those secretly-mutable members
> might workaround the problem for you.

Okay, problems should be fixed now.  Plural.

libMesh problems:

1.  That ACX_TLS interacted nicely with our "prefix everything with
LIBMESH_" configure option, and so LIBMESH_TLS was defined but TLS was
not.  Unfortunately I had getpot.h testing for TLS

2.  TLS is useless here, because at least with icpc Thread Local
Storage only applies to static and extern variables.

3.  That's okay, because I wrapped access to the mutable members in a
lock around Threads::spin_mtx instead.  But wait - that causes
problems if anyone tries to call a GetPot function while holding that
lock for another reason.  So we're now using a per-GetPot object
member mutex, which I think is the Right Thing To Do.


FIN-S problem:

4.  When all that *still* didn't work, I started digging into the
FIN-S code.  It turns out that there was a race condition which wasn't
caused by the new GetPot:

if (!atomic_int++) { initialize_stuff(); }
copy_initialized_stuff();

The atomic variable prevented multiple threads from trying to
initialize_stuff() at the same time, but it allowed one thread to
reach copy_initialized_stuff() before the other had finished
initialize_stuff().  Various badness then ensued.

I haven't switched FIN-S trunk back to libMesh getpot.h yet, but it's
passing my own small (mpirun -np 2 ... --n_threads=2) tests now.  Give
it a shot and see if it's working for you too.
---
Roy

------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Libmesh-devel mailing list
Libmesh-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libmesh-devel

Reply via email to