> 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.

Right.  By default TBB detects the number of cores in a box and sets that
equal to the number of threads.  Unfortunately that is a really bad idea if
you are mixing MPI and threading - usually you want the

(# of MPI tasks) X (# of threads) =  (# of cores)

So we just set the number of threads to 1, requiring user intervention to be
smart...

> 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's right here too - MeshTools gives you an idea of how things are done,
but I should put together an ex4_threaded.C or something like that.  There
is a little more boilerplate needed to get the assembly into TBB-speak - a
functor that takes a range of elements to operate on, and some mutex'ing as
mentioned previously...

-Ben


------------------------------------------------------------------------------
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