Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Control nb of threads
#4
(10-17-2021, 12:14 PM)ChameleonScales Wrote: A plug-in I'm developing (in pythonfu), which does batch processing on multiple xcf files, performs several times faster when I use ~3 threads compared to when I use all my CPU threads (32) or some good percentage of it (24). Not sure why, I guess either the RAM or SSD drive is choking when I use too many threads.

Right now I can control the number of threads by going in Gimp's preferences but I would like to keep it high when I use Gimp's interface and low for my plug-in, so I would need a way to change or override it from within the code of my plug-in, so as to not do it manually every time I use it.

I didn't find a config file where this could be changed via text replacement, nor did I find any command for it.

Also I can't do it by forcing the entire plug-in to use less threads because it contains a progress bar which needs some CPU power in order to not freeze.

Is it at all possible ?

Yes, you can end up having I/O contention. And if your disk is encrypted you need some CPU for encoding. Also, Python itself isn't really multi-threading due to the GIL, so the performance improvement you see with a low thread count is possibly just Python being able to overlap IO and processing (which still means that there is only one thread using the CPU).

On the other hand nothing says that interactive Gimp benefits from more than a handful of threads.
Reply


Messages In This Thread
Control nb of threads - by ChameleonScales - 10-17-2021, 12:14 PM
num-processors - by Gimphried - 10-17-2021, 05:35 PM
RE: Control nb of threads - by ChameleonScales - 10-17-2021, 06:48 PM
RE: Control nb of threads - by Ofnuts - 10-18-2021, 07:00 AM

Forum Jump: