For a project with very big synthDefs, I have to set very high values for the option numWireBufs of the server. Otherwise, I get an error mentioning I have to increase this value.
And I would like to know which is the maximum value I can set for numWireBufs (on both OSX and Linux) ?
Because I have remarked that setting very high numWireBufs values is OK on OSX, but generates GREY count errors on Linux.
I do not have a linux computer right now, but which is the max value for numWireBufs on Linux I can have without generating GREY count errors ?
What is the action you’re taking, right before the grey count errors? Because there are a lot of moving parts in your scenario, so it’s hard to guess based on “I did something (unspecified) and got this message.”
Grey count errors are a part of sclang (related to garbage collection), not the audio server, so the wirebuf count should be completely unrelated.
If your SynthDef is complex/large enough that you’re having to set an extremely high wirebuf count, it’s possible that you’re uncovering a memory-related bug on Linux - this could result in a grey count error. If you have one mega-SynthDef you might consider trying to break it up into multiple smaller SynthDefs you can chain together - this could side-step any potential problems resulting from the SynthDef being too large.
Also, fwiw: I often use very complex SynthDefs, to the point that I can only run one or two copies at a time before maxing out my CPU. My numWireBufs is still only set to 4092… orders of magnitude smaller than what you’ve suggested. If you’re needing a count as high as 8192*12000, it might be that you’ve got a bug in your SynthDef that’s generating a lot more complexity than you intend to. You might try using assertChannels in your SynthDef to ensure that you actually have the channel counts that you expect. (extAssertShape.sc · GitHub)
SynthDef(\channelTest, {
var sig;
sig = SinOsc.ar([100, 200, 300]);
sig.assertChannels(3); // expect an array[3]
sig = [sig, sig];
sig.assertChannels(2, 3); // expect an array[2] of array[3]'s
sig = SinOsc.ar([100, 200, 300, 400]);
sig.assertChannels(3); // this errors because sig is 4 channels now
});
SynthDef’s topological sort is designed to minimize wirebuf usage (that is, it prefers narrow over wide graphs). This may increase usage of CPU cache over RAM, improving processing speed. It performs best on the very common case of parallel chains of UGens, mixed down at the end.
Each Saw → LPF can use 1 wirebuf, and they’re separate chains, so you need 4 wirebufs so far.
Note that the SynthDef code creates 100 Saws first, then 100 LPFs, so you’d think this is a wide graph, but the topo-sort links them up into vertical chains.
[ 8_Sum4, audio, [ 7_LPF, 1_LPF, 3_LPF, 5_LPF ] ]
Now these 4 are mixed down: back to 1 wirebuf. And you don’t need these LPFs for anything else, so this can reuse one of them.
Mix in 3 more chains – but these can reuse wirebufs, so in theory we’re still using only 4.
… and so on, all the way down.
233 units, but could be handled with only 4 wirebufs.
If you need ten million wirebufs, you have a very interesting, odd case that the devs should check out (so the absence of code sharing in this thread limits the scope of the investigation).
Buuuut… I just found a case where multichannel expansion → mixdown produces a wide graph: (a * b).sum can result in a chain of MulAdd units, and it puts all of the a units upfront (requiring one wire buffer per channel).
Thanks to all for the answers and still sorry for my long delay for answering (I was lost with this and other things).
Unfortunately, I cannot post a simple example, since it is linked to a big experimental project for spatial performance, I have been working on for several years, that I will announce very soon on this forum.
@scztt The reason why I wrongly linked high values of numWireBufs with grey count errors is because I noticed setting high values on Linux (above 1024) would generate automatically grey count errors with my program, whereas on Mac I can rarely have this issue.
That is why I set a limit for Linux on this line of the project.