Csound Csound-dev Csound-tekno Search About

[Csnd] Design for a multi-channel Embedded DSP project.

Date2013-03-04 23:43
Fromimaia
Subject[Csnd] Design for a multi-channel Embedded DSP project.
I'm working in a DSP project with four channels doing processing in real time
on a dual core ARM board running Linux in RT.

The processing in each channel will be: phaser, delay, compress, noise gate,
equalizer(4band) and a hipass filter.

I'm planing to develop the software by using C++ csound's API with the
following features:
-> Live interaction: OSC messages
-> Mixing: Software bus
-> Channel Design: A .orc of instruments(Each one in mono mode)
-> Threads: One thread per channel, one thread for mixing outputs, and a
last one for live interaction

The question is whether this design above is a good choice. I could build an
entire .orc containig all channels doing mixing in a single thread for
example.

I'd appreciate advices

Thanks.




--
View this message in context: http://csound.1045644.n5.nabble.com/Design-for-a-multi-channel-Embedded-DSP-project-tp5720738.html
Sent from the Csound - General mailing list archive at Nabble.com.

Date2013-03-04 23:45
FromRory Walsh
SubjectRe: [Csnd] Design for a multi-channel Embedded DSP project.
Where are the OSC messages coming from?

On 4 March 2013 23:43, imaia  wrote:
> I'm working in a DSP project with four channels doing processing in real time
> on a dual core ARM board running Linux in RT.
>
> The processing in each channel will be: phaser, delay, compress, noise gate,
> equalizer(4band) and a hipass filter.
>
> I'm planing to develop the software by using C++ csound's API with the
> following features:
> -> Live interaction: OSC messages
> -> Mixing: Software bus
> -> Channel Design: A .orc of instruments(Each one in mono mode)
> -> Threads: One thread per channel, one thread for mixing outputs, and a
> last one for live interaction
>
> The question is whether this design above is a good choice. I could build an
> entire .orc containig all channels doing mixing in a single thread for
> example.
>
> I'd appreciate advices
>
> Thanks.
>
>
>
>
> --
> View this message in context: http://csound.1045644.n5.nabble.com/Design-for-a-multi-channel-Embedded-DSP-project-tp5720738.html
> Sent from the Csound - General mailing list archive at Nabble.com.
>
>
> Send bugs reports to the Sourceforge bug tracker
>             https://sourceforge.net/tracker/?group_id=81968&atid=564599
> Discussions of bugs and features can be posted here
> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"
>

Date2013-03-04 23:49
Fromimaia
Subject[Csnd] Re: Design for a multi-channel Embedded DSP project.
I'll receive OSC messages from a local network; A client will generate OSC
commands from the other side.



--
View this message in context: http://csound.1045644.n5.nabble.com/Design-for-a-multi-channel-Embedded-DSP-project-tp5720738p5720740.html
Sent from the Csound - General mailing list archive at Nabble.com.

Date2013-03-05 11:09
FromRory Walsh
SubjectRe: [Csnd] Re: Design for a multi-channel Embedded DSP project.
I would tend to try to write a single orchestra that looked after
everything. I would use the software bus within the instrument for
mixing and things like that. OSC messages can be used to route audio
within the csd file.



On 4 March 2013 23:49, imaia  wrote:
> I'll receive OSC messages from a local network; A client will generate OSC
> commands from the other side.
>
>
>
> --
> View this message in context: http://csound.1045644.n5.nabble.com/Design-for-a-multi-channel-Embedded-DSP-project-tp5720738p5720740.html
> Sent from the Csound - General mailing list archive at Nabble.com.
>
>
> Send bugs reports to the Sourceforge bug tracker
>             https://sourceforge.net/tracker/?group_id=81968&atid=564599
> Discussions of bugs and features can be posted here
> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"
>

Date2013-03-05 17:06
Fromimaia
Subject[Csnd] Re: Design for a multi-channel Embedded DSP project.
I worry about the CPU workload running everything from a single orchestra
file. I thought distribute the work amongst CPUs. Can I do that using a
single orcherstra file? I mean: A single orcherstra file modeling four
channels using a thread for each channel? It would be simpler this way
because I could use mixing opcodes in a simple manner.

Thanks.



--
View this message in context: http://csound.1045644.n5.nabble.com/Design-for-a-multi-channel-Embedded-DSP-project-tp5720738p5720755.html
Sent from the Csound - General mailing list archive at Nabble.com.

Date2013-03-05 17:41
FromRory Walsh
SubjectRe: [Csnd] Re: Design for a multi-channel Embedded DSP project.
I guess it's a case of trying it out and seeing. I've never tried
running things on different threads so I can't say. Maybe others have
more experience..

Date2013-03-05 18:22
FromMichael Gogins
SubjectRe: [Csnd] Re: Design for a multi-channel Embedded DSP project.
Csound has supported concurrent synthesis for some time now. However, in Csound 5 the implementation was flawed, so only certain kinds of pieces speeded up, most pieces actually slowed down. 

The implementation in Csound 6 may be much better. I will be trying this out.

The way it works is that Csound analyses the lists of instruments and opcodes to discover what layers of processing depend upon what other layers. Within a layer, things can happen at the same time, for example 2 instances of the same instrument can often run at the same time on different cores.

The good thing about Csound's implementation is that it is transparent, the user doesn't need to do anything special except tell Csound before performance how many threads are available. This is fairly advanced computer science.

Outside of this, if you are using the Csound API as a synthesis engine, you could of course run several instances of Csound in parallel if the processing in each instance was independent. For example, I could have 4 instances of Csound, each one for a different instrument. A fifth thread could mix the outputs of the other 4 threads into a common signal bus and apply further processing. In this case the setup would be hard-coded by you for a particular "orchestra."

As I said, I will be testing Csound 6 for efficient concurrency. John ffitch has already reported encouraging results.

Hope this helps,
Mike


On Tue, Mar 5, 2013 at 12:41 PM, Rory Walsh <rorywalsh@ear.ie> wrote:
I guess it's a case of trying it out and seeing. I've never tried
running things on different threads so I can't say. Maybe others have
more experience..


Send bugs reports to the Sourceforge bug tracker
            https://sourceforge.net/tracker/?group_id=81968&atid=564599
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"




--
Michael Gogins
Irreducible Productions
http://www.michael-gogins.com
Michael dot Gogins at gmail dot com

Date2013-03-05 19:18
Fromimaia
Subject[Csnd] Re: Design for a multi-channel Embedded DSP project.
It's a great news about csound 6.

Looking at 'Top/threads.c' in cs5,  I can see that everything is done with
mutexes and condition variables.  I don't know if I'm looking at the right
file, but the problem with mutexes is the context switch overhead, it wastes
a lot of time to switch threads in this way.

I've been working with  multi-thread implementations. In fine grained
processing like synthesis I think spinlocks are better and faster for thread
synchronization.  

Another good feature in cs6 could be "CPU affinity". In this way users could
associate instruments to certain CPU set. It improves locality and cache
utilisation leading better performance. 
System tasks like interrupts and syscalls(printf) could use a specific CPU. 
These features would be great in embedded environments.

I'm tuning my implementation in this way, but it's a lot of work. 
I'm planning to write an article at the end to report my experience.

Thanks.



--
View this message in context: http://csound.1045644.n5.nabble.com/Design-for-a-multi-channel-Embedded-DSP-project-tp5720738p5720760.html
Sent from the Csound - General mailing list archive at Nabble.com.

Date2013-03-05 19:24
FromVictor Lazzarini
SubjectRe: [Csnd] Re: Design for a multi-channel Embedded DSP project.
The Csound 6 multicore implementation delivers substantial gains, and the way it has been designed, context-switching is not problematic. You
can check the code in csound6 GIT. The multicore code is in Top/csound.c. 

Victor
On 5 Mar 2013, at 19:18, imaia wrote:

> It's a great news about csound 6.
> 
> Looking at 'Top/threads.c' in cs5,  I can see that everything is done with
> mutexes and condition variables.  I don't know if I'm looking at the right
> file, but the problem with mutexes is the context switch overhead, it wastes
> a lot of time to switch threads in this way.
> 
> I've been working with  multi-thread implementations. In fine grained
> processing like synthesis I think spinlocks are better and faster for thread
> synchronization.  
> 
> Another good feature in cs6 could be "CPU affinity". In this way users could
> associate instruments to certain CPU set. It improves locality and cache
> utilisation leading better performance. 
> System tasks like interrupts and syscalls(printf) could use a specific CPU. 
> These features would be great in embedded environments.
> 
> I'm tuning my implementation in this way, but it's a lot of work. 
> I'm planning to write an article at the end to report my experience.
> 
> Thanks.
> 
> 
> 
> --
> View this message in context: http://csound.1045644.n5.nabble.com/Design-for-a-multi-channel-Embedded-DSP-project-tp5720738p5720760.html
> Sent from the Csound - General mailing list archive at Nabble.com.
> 
> 
> Send bugs reports to the Sourceforge bug tracker
>            https://sourceforge.net/tracker/?group_id=81968&atid=564599
> Discussions of bugs and features can be posted here
> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"
> 

Dr Victor Lazzarini
Senior Lecturer
Dept. of Music
NUI Maynooth Ireland
tel.: +353 1 708 3545
Victor dot Lazzarini AT nuim dot ie





Date2013-03-05 19:55
FromMichael Gogins
SubjectRe: [Cs-dev] [Csnd] Re: Design for a multi-channel Embedded DSP project.
AttachmentsNone  None  
I tried GIT head for Csound 6 a few days ago and didn't see speedups for multicore. Is it in a separate branch or is there some build configuration I need? 

Regards,
Mike


On Tue, Mar 5, 2013 at 2:24 PM, Victor Lazzarini <Victor.Lazzarini@nuim.ie> wrote:
The Csound 6 multicore implementation delivers substantial gains, and the way it has been designed, context-switching is not problematic. You
can check the code in csound6 GIT. The multicore code is in Top/csound.c.

Victor
On 5 Mar 2013, at 19:18, imaia wrote:

> It's a great news about csound 6.
>
> Looking at 'Top/threads.c' in cs5,  I can see that everything is done with
> mutexes and condition variables.  I don't know if I'm looking at the right
> file, but the problem with mutexes is the context switch overhead, it wastes
> a lot of time to switch threads in this way.
>
> I've been working with  multi-thread implementations. In fine grained
> processing like synthesis I think spinlocks are better and faster for thread
> synchronization.
>
> Another good feature in cs6 could be "CPU affinity". In this way users could
> associate instruments to certain CPU set. It improves locality and cache
> utilisation leading better performance.
> System tasks like interrupts and syscalls(printf) could use a specific CPU.
> These features would be great in embedded environments.
>
> I'm tuning my implementation in this way, but it's a lot of work.
> I'm planning to write an article at the end to report my experience.
>
> Thanks.
>
>
>
> --
> View this message in context: http://csound.1045644.n5.nabble.com/Design-for-a-multi-channel-Embedded-DSP-project-tp5720738p5720760.html
> Sent from the Csound - General mailing list archive at Nabble.com.
>
>
> Send bugs reports to the Sourceforge bug tracker
>            https://sourceforge.net/tracker/?group_id=81968&atid=564599
> Discussions of bugs and features can be posted here
> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"
>

Dr Victor Lazzarini
Senior Lecturer
Dept. of Music
NUI Maynooth Ireland
tel.: +353 1 708 3545
Victor dot Lazzarini AT nuim dot ie





Send bugs reports to the Sourceforge bug tracker
            https://sourceforge.net/tracker/?group_id=81968&atid=564599
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"




--
Michael Gogins
Irreducible Productions
http://www.michael-gogins.com
Michael dot Gogins at gmail dot com

Date2013-03-05 20:08
FromVictor Lazzarini
SubjectRe: [Cs-dev] [Csnd] Re: Design for a multi-channel Embedded DSP project.
AttachmentsNone  None  
No, there is no special branch.

Victor
On 5 Mar 2013, at 19:55, Michael Gogins wrote:

I tried GIT head for Csound 6 a few days ago and didn't see speedups for multicore. Is it in a separate branch or is there some build configuration I need? 

Regards,
Mike


On Tue, Mar 5, 2013 at 2:24 PM, Victor Lazzarini <Victor.Lazzarini@nuim.ie> wrote:
The Csound 6 multicore implementation delivers substantial gains, and the way it has been designed, context-switching is not problematic. You
can check the code in csound6 GIT. The multicore code is in Top/csound.c.

Victor
On 5 Mar 2013, at 19:18, imaia wrote:

> It's a great news about csound 6.
>
> Looking at 'Top/threads.c' in cs5,  I can see that everything is done with
> mutexes and condition variables.  I don't know if I'm looking at the right
> file, but the problem with mutexes is the context switch overhead, it wastes
> a lot of time to switch threads in this way.
>
> I've been working with  multi-thread implementations. In fine grained
> processing like synthesis I think spinlocks are better and faster for thread
> synchronization.
>
> Another good feature in cs6 could be "CPU affinity". In this way users could
> associate instruments to certain CPU set. It improves locality and cache
> utilisation leading better performance.
> System tasks like interrupts and syscalls(printf) could use a specific CPU.
> These features would be great in embedded environments.
>
> I'm tuning my implementation in this way, but it's a lot of work.
> I'm planning to write an article at the end to report my experience.
>
> Thanks.
>
>
>
> --
> View this message in context: http://csound.1045644.n5.nabble.com/Design-for-a-multi-channel-Embedded-DSP-project-tp5720738p5720760.html
> Sent from the Csound - General mailing list archive at Nabble.com.
>
>
> Send bugs reports to the Sourceforge bug tracker
>            https://sourceforge.net/tracker/?group_id=81968&atid=564599
> Discussions of bugs and features can be posted here
> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"
>

Dr Victor Lazzarini
Senior Lecturer
Dept. of Music
NUI Maynooth Ireland
tel.: +353 1 708 3545
Victor dot Lazzarini AT nuim dot ie





Send bugs reports to the Sourceforge bug tracker
            https://sourceforge.net/tracker/?group_id=81968&atid=564599
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"




--
Michael Gogins
Irreducible Productions
http://www.michael-gogins.com
Michael dot Gogins at gmail dot com
------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_feb_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel

Dr Victor Lazzarini
Senior Lecturer
Dept. of Music
NUI Maynooth Ireland
tel.: +353 1 708 3545
Victor dot Lazzarini AT nuim dot ie




Date2013-03-05 20:08
Frompeiman khosravi
SubjectRe: [Csnd] Re: Design for a multi-channel Embedded DSP project.
Yes I have. Inside maxmsp. I use one instance of Csound per channel,
distributed amongst CPUs and it makes a big difference.

P

On 5 March 2013 17:41, Rory Walsh  wrote:
> I guess it's a case of trying it out and seeing. I've never tried
> running things on different threads so I can't say. Maybe others have
> more experience..
>
>
> Send bugs reports to the Sourceforge bug tracker
>             https://sourceforge.net/tracker/?group_id=81968&atid=564599
> Discussions of bugs and features can be posted here
> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"
>

Date2013-03-05 20:25
Fromimaia
Subject[Csnd] Re: Design for a multi-channel Embedded DSP project.
Hello Victor.
I didn't find the address of csound 6 git repo.
This version is already usable? 

Thanks.



--
View this message in context: http://csound.1045644.n5.nabble.com/Design-for-a-multi-channel-Embedded-DSP-project-tp5720738p5720769.html
Sent from the Csound - General mailing list archive at Nabble.com.

Date2013-03-05 22:39
FromVictor Lazzarini
SubjectRe: [Csnd] Re: Design for a multi-channel Embedded DSP project.
git clone git://git.code.sf.net/p/csound/csound6-git csound-csound6-git

We're at alpha stage.
On 5 Mar 2013, at 20:25, imaia wrote:

> Hello Victor.
> I didn't find the address of csound 6 git repo.
> This version is already usable? 
> 
> Thanks.
> 
> 
> 
> --
> View this message in context: http://csound.1045644.n5.nabble.com/Design-for-a-multi-channel-Embedded-DSP-project-tp5720738p5720769.html
> Sent from the Csound - General mailing list archive at Nabble.com.
> 
> 
> Send bugs reports to the Sourceforge bug tracker
>            https://sourceforge.net/tracker/?group_id=81968&atid=564599
> Discussions of bugs and features can be posted here
> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"
> 

Dr Victor Lazzarini
Senior Lecturer
Dept. of Music
NUI Maynooth Ireland
tel.: +353 1 708 3545
Victor dot Lazzarini AT nuim dot ie





Date2013-03-06 10:10
Fromjpff@cs.bath.ac.uk
SubjectRe: [Csnd] Re: Design for a multi-channel Embedded DSP project.
If you look at Engine/cs_new_dispatch.c you will see that the design is
not to use mutex as they cause delay.  We use atomic swap and similar. 
Read the code?  Or I could send you the draft technical note.

Affinity would be good when available generally.

==John

> It's a great news about csound 6.
>
> Looking at 'Top/threads.c' in cs5,  I can see that everything is done with
> mutexes and condition variables.  I don't know if I'm looking at the right
> file, but the problem with mutexes is the context switch overhead, it
> wastes
> a lot of time to switch threads in this way.
>
> I've been working with  multi-thread implementations. In fine grained
> processing like synthesis I think spinlocks are better and faster for
> thread
> synchronization.
>
> Another good feature in cs6 could be "CPU affinity". In this way users
> could
> associate instruments to certain CPU set. It improves locality and cache
> utilisation leading better performance.
> System tasks like interrupts and syscalls(printf) could use a specific
> CPU.
> These features would be great in embedded environments.
>
> I'm tuning my implementation in this way, but it's a lot of work.
> I'm planning to write an article at the end to report my experience.
>
> Thanks.
>
>
>
> --
> View this message in context:
> http://csound.1045644.n5.nabble.com/Design-for-a-multi-channel-Embedded-DSP-project-tp5720738p5720760.html
> Sent from the Csound - General mailing list archive at Nabble.com.
>
>
> Send bugs reports to the Sourceforge bug tracker
>             https://sourceforge.net/tracker/?group_id=81968&atid=564599
> Discussions of bugs and features can be posted here
> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe
> csound"
>
>
>
>



Date2013-03-07 17:14
Fromimaia
Subject[Csnd] Re: Design for a multi-channel Embedded DSP project.
I analysed the code(cs_new_dispatch.c) a bit. I can see atomic functions 
__sync_fetch... and spinlocks
but I didn't understand the logic and the state machine you are implementing
on the dispatch.  I would like to see the draft, thanks
In some functions like moveWatch I can see clearly what you are doing but
I'm lost in understanding the global logic.

CPU affinity is quite simple with "sched_setaffinity" function on linux:
http://www.ibm.com/developerworks/library/l-affinity/index.html



--
View this message in context: http://csound.1045644.n5.nabble.com/Design-for-a-multi-channel-Embedded-DSP-project-tp5720738p5720837.html
Sent from the Csound - General mailing list archive at Nabble.com.

Date2013-03-07 17:27
FromVictor Lazzarini
SubjectRe: [Csnd] Re: Design for a multi-channel Embedded DSP project.
yes, but Csound is not only for Linux. On OSX10.6 for instance, affinity is not implemented afaik (beyond 'hints').
 
On 7 Mar 2013, at 17:14, imaia wrote:

CPU affinity is quite simple with "sched_setaffinity" function on linux:
http://www.ibm.com/developerworks/library/l-affinity/index.html

Dr Victor Lazzarini
Senior Lecturer
Dept. of Music
NUI Maynooth Ireland
tel.: +353 1 708 3545
Victor dot Lazzarini AT nuim dot ie




Date2013-03-20 00:55
FromAndres Cabrera
SubjectRe: [Csnd] Re: Design for a multi-channel Embedded DSP project.
Hi,

Are the atomic operations supported in llvm? I think Apple is moving
in that direction. I think there are atomic operations as part of C11
but I'm not sure we want to go there yet...

Cheers,
Andrés

On Thu, Mar 7, 2013 at 9:27 AM, Victor Lazzarini
 wrote:
> yes, but Csound is not only for Linux. On OSX10.6 for instance, affinity is
> not implemented afaik (beyond 'hints').
>
> On 7 Mar 2013, at 17:14, imaia wrote:
>
> CPU affinity is quite simple with "sched_setaffinity" function on linux:
> http://www.ibm.com/developerworks/library/l-affinity/index.html
>
>
> Dr Victor Lazzarini
> Senior Lecturer
> Dept. of Music
> NUI Maynooth Ireland
> tel.: +353 1 708 3545
> Victor dot Lazzarini AT nuim dot ie
>
>
>