Hi Thomas,
Thanks for your answer. Good to know that I am not the only one who
has encountered this. Like you say, disabling multithreading entirely
would be a pity given how well it is integrated into deal.II
otherwise.
I have made a little progress since my last email. I found out how to
set the number of threads that TBB uses, although this is not
recommended generally. I found the info in the Threaded Building
Blocks Tutorial document from Intel. Basically you include an extra
library and using line:
#include <tbb/task_scheduler_init.h>
using namespace tbb;
And then call the following method early in your main loop:
task_scheduler_init init(n_desired_threads + 1);
The argument is the number of threads you want in addition to the
calling thread. If this is called multiple times the value called
first wins, so by calling it with the value you want to use before the
library calls it itself you ensure that threaded building blocks uses
that number of threads.
This seems to work in that if I use task_scheduler_init init(1); the
program hangs around the time tasks are first used, consistent with
tasks being scheduled without anything to run it on. Unfortunately if
I use 2 or more threads I still get a high number of cores used (it
looks like about 14 to 18). In addition, the number of cores used is
high well before the place it normally would hang.
I take it that something else is creating threads or using cores
beside TBB. So I have also set multithread_info.n_default_threads = 2;
early in my main loop to try can catch other threaded code portions.
This successfully changes the number of cores reported used, but does
not change the actual program load.
I suppose this is what you mean by saying it is not possible to set
this value. For the record, I found the mailing list thread on the
subject entitled 'Multithread-Version of vmult' which I see you also
commented on.
Thanks for your answer,
Michael
On Sat, May 22, 2010 at 12:54 PM, Thomas Wick
<[email protected]> wrote:
> Hi Michael!
>
> We have the same problem on our machine in our working group.
> As far as I know, in actual versions of deal.ii there is no possibility to
> set Multithreadinfo::n_default_threads to any kind of number.
> However, in older deal.ii versions this was possible.
>
>
>> Hi all,
>>
>> I have a question regarding controlling the number of threads that
>> deal.II uses when run multithreading is enabled. This problem arose
>> because I am now running code on an SMP machine with about 240 cores
>> and a batch system (Torque I believe). My job does not require many
>> cores so I request 4 from the batch system, however when my deal.II
>> code starts it correctly determines that the machine has 240 cores and
>> attempts to use them all. Apart from tying up the cluster, this also
>> means that my own program is very slow.
>>
>> How can I limit the number of cores that deal.II attempts to use? I
>> believe that this question has come up before, but unfortunately can't
>> find the response. If my memory serves me no real answer came for the
>> question since the person who asked it was not using an SMP machine of
>> this size and it wasn't a real issue. I have testing creating an
>> instance of MultiThreadInfo and setting
>> MultithreadInfo::n_default_threads to 4, but this made no difference.
>>
>> My current best option would be to decide how many cores I want to use
>> once off, modify the source of MultithreadInfo::n_cpus to return that
>> number (since this seems to the value that the number of threads is
>> set from) and recompile. This isn't a very elegant solution and any
>> suggestions are appreciated.
>>
>
> If it does work, you make this. However, you always have the possibility
> to configure deal.ii with the option --disable-threads and run your
> program on just one core. But this is probably not your intention.
>
>
>> Regards,
>> Michael
>
> Best regards,
>
> Thomas
>
>
>>>--------------------------------------->>
> Thomas Wick
> Universität Heidelberg
> AG Numerik, Raum 213
> Im Neuenheimer Feld 293
> 69120 Heidelberg
>
> Tel.: +49-(0)6221 / 54-5449
> E-mail: [email protected]
> Web: numerik.iwr.uni-heidelberg.de/~twick/
>>>--------------------------------------->>
>
>
_______________________________________________
dealii mailing list http://poisson.dealii.org/mailman/listinfo/dealii