At Thu, 4 Nov 2010 00:19:58 -0000, Hicham Mouline wrote:
From: boost-users-bounces@lists.boost.org [mailto:boost-users- bounces@lists.boost.org] On Behalf Of Dave Abrahams
If I were you I would start by trying to do this with N processes per machine, rather than N threads, since you need the MPI communication anyway.
Just temporarily? You would still after that add a layer of multithreading to each process, and have only 1 process per machine, after that, no?
Not necessarily. It would depend if the performance was good enough or not.
A 1 process N threads in 1 machine is probably better total wall time than just N mono threaded processes because of the no need to duplicate the input memory to the tasks.
You can use shared memory for that, if you want. Whether there is a tangible advantage probably depends on the size of your input.
The question I really wanted to ask about is that I expect to have M*N outstanding threads (M computers, N threads in each process) just sitting there waiting for jobs. Then from the user interface, I click and that starts 100000 tasks, then it is spread all over the M machines and N threads in each process. Then result comes back, displayed... Then user clicks again and same thing happens.
You're saying this is doable with Boost.MPI + MPI impl?
If you are determined to have threads, you'll need more than just MPI, but yes, you can use Boost.MPI to handle the communication and synchronization across machines.
I wasn't expecting to divide the tasks into finer grained ones. All the tasks are atomic and have about the same exec time. It's rather pass 100000/M tasks to each machine, then divide this number by N for each thread in that process. This last bit is up to me to code. Ideally, the task is just a functor with operator() member and M machines and N threads are treated similarly. I guess it's up to me to write some abstraction layer to view the whole M*N in a flat way.
That's why I'd start with processes and MPI; it already has the abstraction layers that make two processes running on the same machine look identical to the same two processes running on different machines. -- Dave Abrahams BoostPro Computing http://www.boostpro.com