Gimp speed up: gpu or cpu?

(Anton Vakulenko) #1

Hello to all! I’ve just asked similar question about Darktable. I’m planning to upgrade my PC to speed up photo processing. Mostly I use DT and Gimp. With DT the situation is clear : just get the most powerfull videocard I can afford and use OpenCl. Ok…
What about Gimp? Is Gimp use Opencl? Or I just need to get most powerfull CPU I can afford?

(Colin Paul Adams) #2

Googling GIMP and OpenCL says it uses it.

(Felix Kütt) #3

I believe GEGL has got GPU/Compute acceleration. Note sure if it was through GLSL or OpenCL, perhaps both.

I guess for canvas/viewport drawing -> GLSL(OpenGL)
For GEGL processing/filters -> Compute via OpenCL

This should not lead you to think that having a high performance CPU core design(Frequency * IPC) isn’t relevant.

(Anton Vakulenko) #4


(Benjamin Green) #5

In the GIMP preferences dialogue System Resources, you can enable Use OpenCL under Hardware Acceleration.

Whether or not OpenCL will work for you depends on how good your OpenCL environment is. It’s not always the easiest thing to get working, and a lot of support depends on proprietary drivers. That’s the case with Linux anyway, I’ve no idea how Windows things go in the OpenCL world, or how well GEGL is able to access them on that platform.

On the GIMP side of things, some GEGL filters have working OpenCL ports, as in they can work with OpenCL. Where they do, the speed up is very worthwhile. So, you are faced with a situation where many parts of GIMP’s background processing will still be processor bound.

For now I think, getting a really fast CPU is going to be the best bet. At least until:

  • Your platform has a solid OpenCL implementation.
  • All or most of GEGL is able to make use of that OpenCL implementation.

Good point about canvas drawing. I think go for the best CPU, but get a system which is going to allow you to add a good GPU later on.

(Stampede) #6

I saw this post and did a couple quick tests. When I enable open CL in the System Resources preferences, it’s either has no effect, or is much slower. My CPU is a modern AMD 8 core Ryzen 7 CPU. Should be pretty fast.

I have an Nvidia graphics card that’s a couple years old. I don’t remember if I’m using the drivers shipped with Kubuntu 17.10, or if I installed updated drivers from Nvidia.

I took a photo I have at 6000x4000 pixels in 32 bit gamma floating point mode. I changed the B curve in the colors --> Curves dialog. It took about 9 seconds for the change to reach the bottom of the monitor, and another 9 seconds when I clicked on “reset” in the curves dialog. This seems slow to me. No performance difference regardless of whether or not I had open CL enabled.

I did a similar test with Unsharp Mask, since I know that’s a GEGL operation. With Open CL disabled, it took between 9-12 seconds to get through the whole image. With OpenCL enabled, it took between 11-15 seconds, so it seems that based on this test, OpenCL slows me down.

What can I conclude from this, or what can I do to figure out if there’s a way to boost GIMP performance? Gimp 9.8.X was much faster. Maybe because it was 8-bit, so easier for the processor to do the math?

(Benjamin Green) #7

Higher bit depths are always going to mean more memory churn.

I’m guessing you have a working OpenCL stack, but it’s the software one, that is, OpenCL works, but the target is the CPU rather than the GPU. Check out your processor usage whilst doing the CL version, using ‘htop’ on the command line for example.

Try the ‘clinfo’ command, see what you get. Does it show your graphics card?

Also the 8 core Ryzen 7 doesn’t generally include a GPU does it? Which graphics card are you using?

(Benjamin Green) #8

Also for CPU work, have you set the “Number of threads to use” in GIMPs “system resources”?

(Stampede) #9

Thanks for the replies. Testing with the GEGL unsharp mask filter, htop shows my 16 cores at the top of the screen. They all spike up to around 40% processor usage while it’s doing the unsharping. Htop looks the same as far as CPU usage goes whether Open CL is enabled in GIMP preferences, or not.

The Gimp system resources preferences already tell it to use all 16 of my CPU cores.

Here are partial results of “clinfo.” There is more, but this seemed like the important part:

Platform Name                                   NVIDIA CUDA
Number of devices                                 1
  Device Name                                     GeForce GTX 960
  Device Vendor                                   NVIDIA Corporation
  Device Vendor ID                                0x10de
  Device Version                                  OpenCL 1.2 CUDA
  Driver Version                                  384.130
  Device OpenCL C Version                         OpenCL C 1.2 
  Device Type                                     GPU
  Device Profile                                  FULL_PROFILE
  Device Topology (NV)                            PCI-E, 0b:00.0
  Max compute units                               8                                   
  Max clock frequency                             1367MHz                             
  Compute Capability (NV)                         5.2

(Benjamin Green) #10

Thinking about it, I’m not sure if unsharp mask would use a GEGL filter that uses OpenCL, though you did see a difference in speed. There’s a list of which filters have and haven’t been ported here, though the website is down as I write:

Another factor might be that the Nvidia OpenCL implementation has been fairly weak, though I can’t see why it wouldn’t off some speed up.

(Stampede) #11

The wiki is back up and running. I tested the Alien Map function on my 6000x4000 16-bit image, since according to the wiki, Alien Map uses open CL.

Again, it was slower with Open CL enabled. (10.2 seconds with Open CL enabled, 9.3 seconds with it disabled). I have 16 GB of RAM, by the way, and not using any swap space, if that matters.

Note that I’m not actually applying the changes, just previewing them, then removing the preview to time it to go back to normal.

I wonder if other people show a performance detriment with hardware acceleration. Could it be a bug? Or maybe I need to go to a linux forum and ask for help with my graphics drivers.

(Benjamin Green) #12

Certainly your driver don’t appear to be the latest, 390.59 is in Debian, 390.48 in Bionic, 390.67 in Cosmic. If you are on 384.130 then does that does look like the shipped driver which came with Artful (17.10). Does that also mean GIMP 2.8.20? You should certainly be on GIMP 2.10 to consider testing OpenCL through GEGL, as that will also mean the more recent GEGL 0.4.0.

(Benjamin Green) #13

Ah of course you are on GIMP 2.10. Found this today, good speed up results, but they needed to use some demanding processing to see an improvement. Also was on the AMD GPU and Windows 7, so a platform that couldn’t have been more different from yours.

(Stampede) #14

Thanks for the followup. Sometime this month, I will be reinstalling my OS to upgrade to Kubuntu 18.04. I’ll look into getting updated video drivers then and see if that helps it go any faster. Seems to be the next logical step before I take to the linux forums and try to figure out how to get the most from my hardware.

(Benjamin Green) #15

I’ve since got a newer graphics card myself since this post. Processing is similar with OpenCL turned on, including those mentioned in the article above. I’ve tried with 2.10.6, and 2.10.7 and 2.99 from git. Despite now having a good OpenCL stack, nothing seems to run on the card. I have a rx560 now, and can run OpenCL benchmarks without issues. So I’m a bit stumped. It really looks like OpenCL is not working for GEGL operations. I’ve used ‘radeontop’ to see if there is any action going on on the card, there isn’t. It’s time to ask the developers I think.