Jump to content

Improving image processing on low-end hardware (Linux, AMD, opencl)


Recommended Posts

Here's something I got working last night...

 

Prompted by my screen failing (there was a pop and a wiff of smoke), I've purchased a new computer solely for photo processing. I'm severely budget restricted, so it's nothing fast, I put the priority on getting a nice screen rather than a powerful CPU.

 

So, I have a system based around a budget AMD A9 processor. While it's slightly faster than my ~4 year old Intel Atom based laptop, it's certainly no speed demon. However, these AMD APUs have some fairly hefty integrated graphics processors and it seemed a shame that the GPUs were sitting idle while processing photos.

 

A little research found that my image processing software of choice, darktable, is able to use opencl to offload the image processing to the graphics cores, though the documentation suggests that this only really helps with some modules. I thought I'd give it a try anyway.

 

AMD, however, only supports opencl on their 'pro' cards and most certainly not on the integrated GPUs.

 

Just because they don't support it doesn't mean that it doesn't work though... after all, they'd rather you bought a higher-end card, right?

 

So, a little poking around on their support site was required in order to find software that would work with my processor.

 

 

Here's how to make it work, under Ubuntu 18.04.03 LTS

 

(Warning, back-up beforehand, making a mistake can trash your system. I assume Linux users know what they're doing...)

 

* Start with a clean install of 18.04, the AMD drivers are a bit picky about version numbers.

 

* Download the AMD drivers, I got them here:

https://www.amd.com/en/support/graphics/amd-radeon-r5-series/amd-radeon-r5-300-series/amd-radeon-r5-340

 

As far as I'm aware, the Ubuntu package is the same for all graphics cards, you might have to select a discrete graphics card that is more or less equivalent to your integrated card as AMD won't propose Linux drivers for the APUs.

Make sure to get the correct driver package for your system. 19.30 works with Ubuntu 18.04.3, other versions will fail to build and trash your system.

 

* Extract the tarball

 

* Run the install script with the --opencl=legacy,pal and --headless options set. This will install the opencl components without replacing the opensource display driver.

 

* Reboot (not normally required in Linux, but this is a Kernel module rebuild)

 

* Run darktable-cltest and see if opencl is working.

 

 

I ran a timing test on my machine. Exporting 5 RAW (Panasonic .RW2) files as finished jpeg images with varying degrees of postprocessing applied (just 5 photos I took the other week):

 

With opencl enabled: 2:30

 

Without opencl: 3:40

 

So the difference is fairly substantial and gives a significant speed increase on low-end hardware.

 

As a bonus, the CPU is no longer maxed at 100% on all cores when exporting images, so the system remains more responsive.

 

Temperatures maxed at 60°C during processing and, I felt, were slightly lower with GPU processing enabled.

 

 

So there you go, GPU processing, even if not officially supported, makes a difference. I imagine it will be even more significant with better hardware. My understanding is that with an Nvidia card, it will 'just work' with no faffing required. I have no idea if you can use Intel integrated graphics in the same way.

Link to comment
Share on other sites

  • 2 weeks later...

I ran the same test, same five images on my works PC (normally used for CAD/CAM), an Intel i5 7500T running at 3.2GHz with Intel's integrated graphics, Windows 10 64 bit with the latest drivers.

 

With opencl 1:30

 

Without opencl 1:15

 

Using darktable 2.6 rather than 2.4 on my PC.

 

 

So from these very rough tests, other than the obvious, that a faster processor, with twice as many cores, is faster, it would appear that the benefit of using opencl depends heavily on the graphics card. For a weak processor with a strong graphics card, it's highly beneficial, but if you have a strong processor with weak graphics, it's not worth bothering.

Link to comment
Share on other sites

For reference, my home PC is an AMD A9-9420, with 2 CPU cores at 3GHz and 3 GPU cores.

 

 

I know the works PC is severely underspecified for CAD, but it's the IT department's standard issue, we don't warrant workstations on the shop floor... it actually runs AutoCAD reasonably well for the simple stuff I need it for, but SCM Maestro causes it to cook, it spends most of the day at 100% cpu and 75°C. They say that if it actually melts, I can have something better...

Link to comment
Share on other sites

How do a couple of seconds saved stack up against the time spent manually editing?

 

I've sometimes worked for half-an-hour or more on a single image, and a couple of minutes spent cropping, adjusting colour balance, saturation, tone curve, etc. I would consider quite minimal. So a saving of a fraction of a second per image would go completely unnoticed.

Link to comment
Share on other sites

How do a couple of seconds saved stack up against the time spent manually editing?

 

I've sometimes worked for half-an-hour or more on a single image, and a couple of minutes spent cropping, adjusting colour balance, saturation, tone curve, etc. I would consider quite minimal. So a saving of a fraction of a second per image would go completely unnoticed.

Oh, I quite agree. Generally I'll hit export then go have dinner or something, it's the work beforehand that has value.

 

Saving ten seconds per image does add up though, if you're running a bulk conversion of say 100 files.

 

I chose the file export as it was easy for me to benchmark, but there is an improvement with every editing operation, every redraw of the image, so the software as a whole feels more responsive.

 

At the end of the day, it's a techy subject and I'm a techie, I get enjoyment from persuading machinery to do things the designers never envisaged.

 

If I wanted outright speed, I wouldn't have bought a €300 PC, that doesn't stop me in getting pleasure from improving the way it runs though.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...