On Thu, 14 Jan 2010, Joa Ljungvall wrote:

> However, some threading would be nice... I tried to compile libmesh
> with --enable-tbb and then running example 14, but no threads
> around? Any ideas?

Ben can correct me if I'm wrong and if he's not too busy, but I think
there's two issues here:

We currently don't try to autodetect the number of cores you have
available.  (if you have 4 cores there's often good reason to run 4
MPI processes on them, and you don't want those processes to spawn an
extra three threads each).  So you need to specify --n_threads=4 (or
whatever) on the command line.

Example 14 isn't currently threaded.  Unfortunately, most of the
System classes require the user to write their own outer assembly
loop, and our examples of those aren't threaded, because it would be
cruel to new users to say "oh, and don't just write a for loop, write
a new functor class with proper mutex handling".  The FEMSystem class
does the looping in the library, but that isn't threaded yet, because
I'm lazy.  Also because the C^1 elements I use frequently aren't yet
thread-safe in our implementation.

I'm afraid that some of the best threading examples are in Ben's
private application code, but there are some examples in the library
that you could examine.  The simplest are probably the ones in
MeshTools.  The remaining complication for assembly is that you need
to hold a mutex around the add_vector() and add_matrix() calls to make
sure they aren't called from two threads at once.
---
Roy

------------------------------------------------------------------------------
Throughout its 18-year history, RSA Conference consistently attracts the
world's best and brightest in the field, creating opportunities for Conference
attendees to learn about information security's most important issues through
interactions with peers, luminaries and emerging and established companies.
http://p.sf.net/sfu/rsaconf-dev2dev
_______________________________________________
Libmesh-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/libmesh-users

Reply via email to