Csound Csound-dev Csound-tekno Search About

[Csnd] live performance options

Date2020-02-26 18:05
FromChristian Bacherr <000005d2745f1ec0-dmarc-request@LISTSERV.HEANET.IE>
Subject[Csnd] live performance options
hi, i would like to know some options to do when a single cpu thread 
goes to 100% with csound and producing audio glitches while the other 
cpu threads  idle. i have tried the option e.g -j6 but this results in 
600% cpu  (i.e. 6 cpu threads goto 100%) and same glitches. i wonder for 
what this parameter -j is used actually.

are there some options to use the other cpu threads as well in a manner 
of balancing the computing?

i have minimal global variables - almost all is done in instruments. use 
the channel system for control parameters, in/outleta/connect for audio 
routing and i am already on ksmps=64 (with B=512 and b=128 and a NI 
Komplete Audio 6 interface on a 6 core 2.6-4GHZ linux laptop )

are there concepts/ideas to handle this besides starting several csound 
processes which may have some uncomfortable issues?

thx.

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

Date2020-02-26 18:22
FromRory Walsh
SubjectRe: [Csnd] live performance options
What kind of processing are you doing? 

On Wed 26 Feb 2020, 18:05 Christian Bacherr, <000005d2745f1ec0-dmarc-request@listserv.heanet.ie> wrote:
hi, i would like to know some options to do when a single cpu thread
goes to 100% with csound and producing audio glitches while the other
cpu threads  idle. i have tried the option e.g -j6 but this results in
600% cpu  (i.e. 6 cpu threads goto 100%) and same glitches. i wonder for
what this parameter -j is used actually.

are there some options to use the other cpu threads as well in a manner
of balancing the computing?

i have minimal global variables - almost all is done in instruments. use
the channel system for control parameters, in/outleta/connect for audio
routing and i am already on ksmps=64 (with B=512 and b=128 and a NI
Komplete Audio 6 interface on a 6 core 2.6-4GHZ linux laptop )

are there concepts/ideas to handle this besides starting several csound
processes which may have some uncomfortable issues?

thx.

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

Date2020-02-26 18:40
Fromjohn
SubjectRe: [Csnd] live performance options
The -j option works best with global variables as they are distinct while 
all channels are treated as one global.  There are papers in LAC and ICMC 
that describe the parallelism on multi-core.  If you run with -v option 
you should see the available parallelism laid out as semantic analysis. 
May not be easy to red but I can explain it.

Use of larger ksmps and --sample-accurate also reduces load

Or you can roll you own parallel execution with the API.

We would need to see what you were doing to give further advice

On Wed, 26 Feb 2020, Christian Bacherr wrote:

> hi, i would like to know some options to do when a single cpu thread goes to 
> 100% with csound and producing audio glitches while the other cpu threads  
> idle. i have tried the option e.g -j6 but this results in 600% cpu  (i.e. 6 
> cpu threads goto 100%) and same glitches. i wonder for what this parameter -j 
> is used actually.
>
> are there some options to use the other cpu threads as well in a manner of 
> balancing the computing?
>
> i have minimal global variables - almost all is done in instruments. use the 
> channel system for control parameters, in/outleta/connect for audio routing 
> and i am already on ksmps=64 (with B=512 and b=128 and a NI Komplete Audio 6 
> interface on a 6 core 2.6-4GHZ linux laptop )
>
> are there concepts/ideas to handle this besides starting several csound 
> processes which may have some uncomfortable issues?
>
> thx.
>
> 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

Date2020-02-26 19:00
FromMichael Gogins
SubjectRe: [Csnd] live performance options
The -j option is more efficient than a single thread only in certain cases. These are when there are a few instrument definitions and several copies of each instrument definition running for a fairly long time, or some combination of these factors. In such cases I have observed a significant speedup, e.g. -j4 running almost 2 x as fast. Without these favorable factors that essentially enable instances of the same instrument definition to run each in a separate thread without incurring too much overhead, most likely using more than one thread will actually degrade performance.

Regards,
Mike

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


On Wed, Feb 26, 2020 at 7:05 PM Christian Bacherr <000005d2745f1ec0-dmarc-request@listserv.heanet.ie> wrote:
hi, i would like to know some options to do when a single cpu thread
goes to 100% with csound and producing audio glitches while the other
cpu threads  idle. i have tried the option e.g -j6 but this results in
600% cpu  (i.e. 6 cpu threads goto 100%) and same glitches. i wonder for
what this parameter -j is used actually.

are there some options to use the other cpu threads as well in a manner
of balancing the computing?

i have minimal global variables - almost all is done in instruments. use
the channel system for control parameters, in/outleta/connect for audio
routing and i am already on ksmps=64 (with B=512 and b=128 and a NI
Komplete Audio 6 interface on a 6 core 2.6-4GHZ linux laptop )

are there concepts/ideas to handle this besides starting several csound
processes which may have some uncomfortable issues?

thx.

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

Date2020-02-26 19:09
FromMichael Gogins
SubjectRe: [Csnd] live performance options
After re-reading your email I advise you to use a single instrument definition with a single instance to manage all control channels. This should be an always on instrument that reads channel values and assigns them to global variables that are distinguished by instrument number, name, or ID. This works as well for sending values, the other instruments can assign values to global variables that the one always on control channel instrument sends to the appropriate named channels. Doing this has significantly speeded up my orchestras. For an example of how this works you may read this, https://github.com/gogins/csound-extended/blob/develop/silencio/patches/modular_csound.pdf, page 5.

The key to this system is to build the instrument names or numbers, and parameter names, into the global variable names which are exactly the same as the channel names.

Regards,
Mike

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


On Wed, Feb 26, 2020 at 8:00 PM Michael Gogins <michael.gogins@gmail.com> wrote:
The -j option is more efficient than a single thread only in certain cases. These are when there are a few instrument definitions and several copies of each instrument definition running for a fairly long time, or some combination of these factors. In such cases I have observed a significant speedup, e.g. -j4 running almost 2 x as fast. Without these favorable factors that essentially enable instances of the same instrument definition to run each in a separate thread without incurring too much overhead, most likely using more than one thread will actually degrade performance.

Regards,
Mike

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


On Wed, Feb 26, 2020 at 7:05 PM Christian Bacherr <000005d2745f1ec0-dmarc-request@listserv.heanet.ie> wrote:
hi, i would like to know some options to do when a single cpu thread
goes to 100% with csound and producing audio glitches while the other
cpu threads  idle. i have tried the option e.g -j6 but this results in
600% cpu  (i.e. 6 cpu threads goto 100%) and same glitches. i wonder for
what this parameter -j is used actually.

are there some options to use the other cpu threads as well in a manner
of balancing the computing?

i have minimal global variables - almost all is done in instruments. use
the channel system for control parameters, in/outleta/connect for audio
routing and i am already on ksmps=64 (with B=512 and b=128 and a NI
Komplete Audio 6 interface on a 6 core 2.6-4GHZ linux laptop )

are there concepts/ideas to handle this besides starting several csound
processes which may have some uncomfortable issues?

thx.

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

Date2020-02-27 20:03
FromChristian Bacher <000005d2745f1ec0-dmarc-request@LISTSERV.HEANET.IE>
SubjectRe: [Csnd] live performance options
Thanks for all answers!
John explained that the problem with the -j parameter could be that i have no global variables but only channels.
All control values are passed from the osc handler via chnset to channels and read by the instruments via chnget.
i.e. the oschandler calls e.g. chnset 2000,"/instr1/freq" and the instrument: kfreq chnget "/instr1/freq"  -- nothing inbetween.

(unfortunately the -v option produces an init log file of >50000 lines so it is kind of hard to read)

My goal would be still to try to enabling the use of more cpu threads.

Of course i may speed up some stuff with some measures but some time later i could face the same problem again.

So I would try to refactor using global variables for control channels.
Would it be the same effect using chnexport instead of making an instrument reading the channel values into global variables?
The problem i see in the approach making a single instrument for all channels/instruments is that i cannot plug in new instruments without changing this global instrument.

Currently i can generate the csd with a script which takes the instruments files as input (i.e. including them in the csd and generate a mixer instrument inside)

The next question would be: Does the use of outleta/inleta/connect influence the possibility of concurrent processing?

Should e.g the reverb bus also be realized with a global variable instead with inleta/outleta?

A side question: Does the chebychevpoly opcode with 11 harmonics consume a lot of cpu?

Thx and best regards,

Christian

On 2/26/20 8:09 PM, Michael Gogins wrote:
After re-reading your email I advise you to use a single instrument definition with a single instance to manage all control channels. This should be an always on instrument that reads channel values and assigns them to global variables that are distinguished by instrument number, name, or ID. This works as well for sending values, the other instruments can assign values to global variables that the one always on control channel instrument sends to the appropriate named channels. Doing this has significantly speeded up my orchestras. For an example of how this works you may read this, https://github.com/gogins/csound-extended/blob/develop/silencio/patches/modular_csound.pdf, page 5.

The key to this system is to build the instrument names or numbers, and parameter names, into the global variable names which are exactly the same as the channel names.

Regards,
Mike

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


On Wed, Feb 26, 2020 at 8:00 PM Michael Gogins <michael.gogins@gmail.com> wrote:
The -j option is more efficient than a single thread only in certain cases. These are when there are a few instrument definitions and several copies of each instrument definition running for a fairly long time, or some combination of these factors. In such cases I have observed a significant speedup, e.g. -j4 running almost 2 x as fast. Without these favorable factors that essentially enable instances of the same instrument definition to run each in a separate thread without incurring too much overhead, most likely using more than one thread will actually degrade performance.

Regards,
Mike

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


On Wed, Feb 26, 2020 at 7:05 PM Christian Bacherr <000005d2745f1ec0-dmarc-request@listserv.heanet.ie> wrote:
hi, i would like to know some options to do when a single cpu thread
goes to 100% with csound and producing audio glitches while the other
cpu threads  idle. i have tried the option e.g -j6 but this results in
600% cpu  (i.e. 6 cpu threads goto 100%) and same glitches. i wonder for
what this parameter -j is used actually.

are there some options to use the other cpu threads as well in a manner
of balancing the computing?

i have minimal global variables - almost all is done in instruments. use
the channel system for control parameters, in/outleta/connect for audio
routing and i am already on ksmps=64 (with B=512 and b=128 and a NI
Komplete Audio 6 interface on a 6 core 2.6-4GHZ linux laptop )

are there concepts/ideas to handle this besides starting several csound
processes which may have some uncomfortable issues?

thx.

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