-
-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MultiThreading #628
Comments
Nice find! If diiz or another developer approves of this, would you be able to help out making it come true? |
Does this have anything to do with making LMMS Real Time Safe? On Sun, Apr 20, 2014 at 10:50 PM, Stian Jørgensrud <notifications@github.com
Jonathan Aquilina |
AFAIK we already use separate threads for GUI and DSP. I'm not sure if |
and one thing to remember, how will a multithreaded architecture work on systems with 2 or even 1 cpu? |
@musikBear - yes, this is why it needs testing, but really you can live with stable-1.0 for that and for all those who got much more powerful cpu it would be a significant++, between 2 cpu (2cores) QThreadPool could balance all those things and to make more viable i thought to split even synths for few groups. |
We have multi-threading in the Mixer. The MixerWorkerThread instances process independent play handles (i.e. rendering the sound of an instrument), effect chains etc. in parallel. That way we can make use of all available CPU cores. QtConcurrent etc. are not suited here as they're not lightweight enough and probably not RT-safe. As a reference I suggest to look at the code in the master branch as there have been major improvements/cleanups -> src/core/MixerWorkerThread.cpp |
i didn't found cpu balancing there and as i understand you are using WorkerScript |
There's one worker thread for each CPU - that's it. They're not explicitely pinned but that's not neccessary and a task of the OS scheduler. I also don't see why we should use different threading technologies for RT playback and rendering - just adds unneccessary complexity and more code to maintain. Furthermore we don't need QObject-specific features (like signals/slots) when rendering as that would cost lots of performance and eventually there's no need for it. |
looks like /me using QFuture somehow, so just thinking about something that not in this time yet. |
Again, LMMS does already make use of all available CPU cores! Offloading rendering jobs to other hardware than CPU would have to be done by the specific plugins itself. Usually exporting a project with high quality settings still is just a thing of minutes on modern computers. Blender is a completely different thing as there's a lot more data to be processed which at the same time can be processed through standardized computing/shading languages and thus offloaded to GPU easily. |
I think what he's asking is, can one playHandle be divided to be I'd think the answer is no since the rendering function is a single Which IMO is the way it should be. If we have to start worrying about |
separate thread per instrument-track. |
This is implicitely done. If you play e.g. 4 notes with an InstrumentTrack the sound of these 4 notes will be processed by the available worker threads. If you have 4 CPUs, the 4 notes will be rendered in parallel. For single-streamed instruments, the individual InstrumentPlayHandles will be processed (rendered) in parallel as well so basically there's one thread for e.g. each ZynAddSubFX instrument. The same for independent effect chains. This is far more generic and less error-prone than starting to think about multi-threading in the DSP code itself. As long as things are splitted into enough single jobs, this scales well. When rendering projects on my QuadCore LMMS usually does have a CPU usage of 350-380% which is quite good given that there're still other things which can't be parallelized (like encoding the output stream). |
I haven't measured it, but I always wandered why LMMS never uses 100% (or
|
100% will maybe crash your PC, LMMS or make it unresponding? My guess. |
As already said, 100% will never be possible as there's always work which can't be parallelized and thus only computed by one core each period before and after doing the main work in parallel. |
On 04/27/2014 11:56 PM, Tobias Doerffel wrote:
Toby, since we're talking about threads, did you see the post I made |
Hi, i've searched code for
QFuture
QtConcurrent
QThreadPool
QRunnable
and didn't find it
http://qt-project.org/doc/qt-5/threads-technologies.html
it's supposed to use all available processors and control threads, so it will be much powerful i guess on 4 cores cpu.
sorry, maybe not an issue, i don't know Qt, i see there are threads, but Zynaddsubfx uses all those i've been searchng, not any other plugin for example, so having different threadpools for different groups of synths, effects, gui and visualization plugins could ease very well a lot of things, especially basic play mode.
but well needs a kind of testing first i guess.
The text was updated successfully, but these errors were encountered: