Csound Csound-dev Csound-tekno Search About

csound multithread design

Date2017-03-13 19:50
FromKelly Hirai
Subjectcsound multithread design
its been a while since i've thought about software design in the 
abstract so i ordered a used copy of "Design Patterns" by Gemma et al. 
In the preface it declares that the book doesn't address "any patterns 
dealing with concurrency or distributed programming or realtime 
programming" just the things i'm looking for tips on.

So my question to the list is, what concurrency patterns are used in 
csound? Does anybody have any tips on books that address realtime 
concurrent design patterns specifically?

picking through the wikipedia article now:
https://en.wikipedia.org/wiki/Concurrency_pattern

kelly

Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here

Date2017-03-13 20:00
FromJohn ff
SubjectRe: csound multithread design
I think that the paper by ffitch &Brain at the Start Petersburg conference describes the Csound multi core design.  Other concurrent design is in the cuda parts.  Some distribution in remote opcode etc. 

Not sure that is what you want.

Sent from TypeApp
On 13 Mar 2017, at 19:52, Kelly Hirai <khirai@ONGAKU.ISA-GEEK.NET> wrote:
its been a while since i've thought about software design in the 
abstract so i ordered a used copy of "Design Patterns" by Gemma et al.
In the preface it declares that the book doesn't address "any patterns
dealing with concurrency or distributed programming or realtime
programming" just the things i'm looking for tips on.

So my question to the list is, what concurrency patterns are used in
csound? Does anybody have any tips on books that address realtime
concurrent design patterns specifically?

picking through the wikipedia article now:
https://en.wikipedia.org/wiki/Concurrency_pattern

kelly

Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here

Date2017-03-13 21:31
FromMichael Gogins
SubjectRe: csound multithread design
I think he wanted some tips on how design patterns can be used with
multi-threading in Csound code.

The whole point of your excellent design is that it is not necessary
for users of Csound to adapt Csound orc code to be multi-threaded,
Csound itself takes care of that.

If he wants to know patterns of multi-threaded programming in general,
look at the following summary:

http://www.cs.wustl.edu/~schmidt/patterns-ace.html

The left-hand column shows the actual concurrency patterns. The other
columns show other patterns that are used with the concurrency
patterns. This summary does not consider SIMD or
machine-language-level concurrency.

Concurrency patterns - Csound analyses the signal flow graph into
tasks, then schedules them using a combination of the thread per
session (main thread) and thread pool (extra threads) pattern. Some
time-consuming initialization time events are scheduled as
asynchronous tasks (request specific thread pattern).

Event patterns: Mostly the active object pattern.

Initialization patterns: Not much. Locks are simply acquired and released.

Synchronization patterns: The Csound API uses the thread-safe
interface pattern. Internally there is some use of the strategized
locking pattern.

Csound code is by default optimized to use some SIMD. Additional
machine-language-level concurrency can be obtained with the CUDA
opcodes.

This is all reasonably close to the start of the art in concurrent
programming. Doing more would require getting much more of Csound to
run on a GPU.

Correct me if I am wrong!

As for tips, if in C++, use the standard C++ library, use std::thread,
use the task pattern with a thread pool, and use RAII for locks. You
could do better, but you could do much worse.

Best,
Mike

-----------------------------------------------------
Michael Gogins
Irreducible Productions
http://michaelgogins.tumblr.com
Michael dot Gogins at gmail dot com


On Tue, Mar 14, 2017 at 7:00 AM, John ff  wrote:
> I think that the paper by ffitch &Brain at the Start Petersburg conference
> describes the Csound multi core design.  Other concurrent design is in the
> cuda parts.  Some distribution in remote opcode etc.
>
> Not sure that is what you want.
>
> Sent from TypeApp
> On 13 Mar 2017, at 19:52, Kelly Hirai  wrote:
>>
>> its been a while since i've thought about software design in the
>> abstract so i ordered a used copy of "Design Patterns" by Gemma et al.
>> In the preface it declares that the book doesn't address "any patterns
>> dealing with concurrency or distributed programming or realtime
>> programming" just the things i'm looking for tips on.
>>
>> So my question to the list is, what concurrency patterns are used in
>> csound? Does anybody have any tips on books that address realtime
>> concurrent design patterns specifically?
>>
>> picking through the wikipedia article now:
>> https://en.wikipedia.org/wiki/Concurrency_pattern
>>
>> kelly
>>
>> Csound mailing list
>> Csound@listserv.heanet.ie
>> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
>> Send bugs reports to
>>         https://github.com/csound/csound/issues
>> Discussions of bugs and features can be posted here
>
> Csound mailing list Csound@listserv.heanet.ie
> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to
> https://github.com/csound/csound/issues Discussions of bugs and features can
> be posted here

Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here

Date2017-03-13 21:50
FromKelly Hirai
SubjectRe: csound multithread design
found it.
https://zenodo.org/record/50357/files/ffitch_Brain.pdf
yes, these are the kind of engineering details i'm looking for.
thank you.

k.

On 03/13/2017 04:00 PM, John ff wrote:
> I think that the paper by ffitch &Brain at the Start Petersburg conference describes the Csound multi core design.  Other concurrent design is in the cuda parts.  Some distribution in remote opcode etc.
>
> Not sure that is what you want.
>
> ⁣Sent from TypeApp ​
>
> On 13 Mar 2017, 19:52, at 19:52, Kelly Hirai  wrote:
>> its been a while since i've thought about software design in the
>> abstract so i ordered a used copy of "Design Patterns" by Gemma et al.
>> In the preface it declares that the book doesn't address "any patterns
>> dealing with concurrency or distributed programming or realtime
>> programming" just the things i'm looking for tips on.
>>
>> So my question to the list is, what concurrency patterns are used in
>> csound? Does anybody have any tips on books that address realtime
>> concurrent design patterns specifically?
>>
>> picking through the wikipedia article now:
>> https://en.wikipedia.org/wiki/Concurrency_pattern
>>
>> kelly
>>
>> Csound mailing list
>> Csound@listserv.heanet.ie
>> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
>> Send bugs reports to
>>        https://github.com/csound/csound/issues
>> Discussions of bugs and features can be posted here
>
> Csound mailing list
> Csound@listserv.heanet.ie
> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
> Send bugs reports to
>         https://github.com/csound/csound/issues
> Discussions of bugs and features can be posted here
>

Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here

Date2017-03-14 16:48
FromKelly Hirai
SubjectRe: csound multithread design
this patterns page is the vocabulary i'm looking for, thanks!

part of the question is motivated by the will to write efficient code 
for csound. part is the notion that as with all public software, one may 
have to curate code that one is so attached to. so anything that 
clarifies its design is really interesting.

really though, i think i'm looking to learn something from these event 
patterns. i got a new midi button box (xtouch mini). i would like to 
create a generalized way to assign its events to parameters on the fly. 
so really i'm looking to express patterns in the csound language itself.

which begs another question about how you would write such structures in 
csound, technically not a procedural language perhaps a different 
pattern emerges. is a "design patterns for csound" chapter is in the 
future? likely some of the examples will be trivial.

k.


On 03/13/2017 05:31 PM, Michael Gogins wrote:
> I think he wanted some tips on how design patterns can be used with
> multi-threading in Csound code.
>
> The whole point of your excellent design is that it is not necessary
> for users of Csound to adapt Csound orc code to be multi-threaded,
> Csound itself takes care of that.
>
> If he wants to know patterns of multi-threaded programming in general,
> look at the following summary:
>
> http://www.cs.wustl.edu/~schmidt/patterns-ace.html
>
> The left-hand column shows the actual concurrency patterns. The other
> columns show other patterns that are used with the concurrency
> patterns. This summary does not consider SIMD or
> machine-language-level concurrency.
>
> Concurrency patterns - Csound analyses the signal flow graph into
> tasks, then schedules them using a combination of the thread per
> session (main thread) and thread pool (extra threads) pattern. Some
> time-consuming initialization time events are scheduled as
> asynchronous tasks (request specific thread pattern).
>
> Event patterns: Mostly the active object pattern.
>
> Initialization patterns: Not much. Locks are simply acquired and released.
>
> Synchronization patterns: The Csound API uses the thread-safe
> interface pattern. Internally there is some use of the strategized
> locking pattern.
>
> Csound code is by default optimized to use some SIMD. Additional
> machine-language-level concurrency can be obtained with the CUDA
> opcodes.
>
> This is all reasonably close to the start of the art in concurrent
> programming. Doing more would require getting much more of Csound to
> run on a GPU.
>
> Correct me if I am wrong!
>
> As for tips, if in C++, use the standard C++ library, use std::thread,
> use the task pattern with a thread pool, and use RAII for locks. You
> could do better, but you could do much worse.
>
> Best,
> Mike
>
> -----------------------------------------------------
> Michael Gogins
> Irreducible Productions
> http://michaelgogins.tumblr.com
> Michael dot Gogins at gmail dot com
>
>
> On Tue, Mar 14, 2017 at 7:00 AM, John ff  wrote:
>> I think that the paper by ffitch &Brain at the Start Petersburg conference
>> describes the Csound multi core design.  Other concurrent design is in the
>> cuda parts.  Some distribution in remote opcode etc.
>>
>> Not sure that is what you want.
>>
>> Sent from TypeApp
>> On 13 Mar 2017, at 19:52, Kelly Hirai  wrote:
>>>
>>> its been a while since i've thought about software design in the
>>> abstract so i ordered a used copy of "Design Patterns" by Gemma et al.
>>> In the preface it declares that the book doesn't address "any patterns
>>> dealing with concurrency or distributed programming or realtime
>>> programming" just the things i'm looking for tips on.
>>>
>>> So my question to the list is, what concurrency patterns are used in
>>> csound? Does anybody have any tips on books that address realtime
>>> concurrent design patterns specifically?
>>>
>>> picking through the wikipedia article now:
>>> https://en.wikipedia.org/wiki/Concurrency_pattern
>>>
>>> kelly
>>>
>>> Csound mailing list
>>> Csound@listserv.heanet.ie
>>> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
>>> Send bugs reports to
>>>         https://github.com/csound/csound/issues
>>> Discussions of bugs and features can be posted here
>>
>> Csound mailing list Csound@listserv.heanet.ie
>> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to
>> https://github.com/csound/csound/issues Discussions of bugs and features can
>> be posted here
>
> Csound mailing list
> Csound@listserv.heanet.ie
> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
> Send bugs reports to
>         https://github.com/csound/csound/issues
> Discussions of bugs and features can be posted here
>

Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here