Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Multithread python plug-in?
#2
(02-07-2021, 06:46 PM)ChameleonScales Wrote: My plugin performs a bunch of operations on dozens of large images which takes several minutes and only uses a single thread.

I'm wondering if there's a way to write code in the plug-in to allow for multithreading, e.g. by telling Gimp to open more instances of itself or any other way.

Is that possible?

Never tried. You can spawn new threads and try (especially since you only "read" the images, what do you risk...).

However:
  • If in Python you can model things with threads, in practice your threads never run in parallel due to the GIL
  • Maybe the problem is with I/O and adding more CPU isn't going to help
If the problem is indeed CPU, another approach would be to
  • Start a Gimp instance (without and image or that runs a script with a sleep delay to just remain around)
  • Start several parallel shell tasks that will each call Gimp to run your script on one image
Or even run several distinct instances of Gimp in paralllel (use gimp -n).
Reply


Messages In This Thread
Multithread python plug-in? - by ChameleonScales - 02-07-2021, 06:46 PM
RE: Multithread python plug-in? - by Ofnuts - 02-07-2021, 08:31 PM
RE: Multithread python plug-in? - by Ofnuts - 02-08-2021, 05:39 PM

Forum Jump: