[CM] a question for experts?
Kjetil S. Matheussen
k.s.matheussen at notam02.no
Tue May 20 14:06:47 PDT 2008
On Tue, 20 May 2008, Frank Barknecht wrote:
> Bill Schottstaedt hat gesagt: // Bill Schottstaedt wrote:
>> Max asks "how to use dual-core processors in real time audio
>> applications?" -- I would mumble something about threads.
>> Actually, I've never looked into how much parallel processing
>> they provide. On my dual-processor machine, I have convinced
>> myself that they run at the same time, and in some cases give an
>> honest factor of two speed-up (via threads).
> Tricky question.
Yes. To give an impression how tricky it is, I thought
it was a good idea to use parallel programming for
copying a large area of memory at each audio block entry,
instead of doing a single memcpy() from one thread.
The area was usually 1-20MB, and each thread
was responsible for copying minimum 32k at the time,
but usually much more.
But no matter how much tweaking I put into the size
of the partly copied memory areas, and the number of
threads, and improving the scheduling by
using atomic operators etc., I seldom saw an
improvement in execution speed
of more than about 10-40%, now and then it even went
slower than non-parallel. So therefore a bunch
of cpu power was wasted compared to using just one
thread. I think its a cache issue though, and if
I had been copying from different parts of the
memory block, instead of copying sequentially,
the result could have been much better...
(I still have to try that out, but I'm not too
But this task would, at least from what I
first thought, had been the ideal task for
parallelisation, however it failed quite
(The source of this parallel memory copyer is starting on
line 243 in
Another example, Yann Orlarey just posted a message on the faust
development list, where he has managed to make faust about 18%/33%
faster (compared to scalar and non-scalar mode) by using something called
"openMP" on a dual-core machine:
More information about the Cmdist