Multithreading not functioning on AMD Ryzen 7 1700

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
CataclysmZA
Posts: 5
Joined: 2017-07-20T06:03:20-07:00
Authentication code: 1151

Multithreading not functioning on AMD Ryzen 7 1700

Post by CataclysmZA »

I've been using Imagemagick again today to convert PDF slides to PNG images before I finally convert those to JPG. In the past, this has worked pretty well on my Phenom X4 processor as well as an Intel Core i5 Kaby Lake mobile processor.

However, on my Ryzen system, with updates to both Imagemagick and Ghostscript, the process is slower than my Athlon processor, and also far slower than the Kaby Lake notebook I have on hand. Most of the time the converter will take up one core for the workload, and it jumps around to different cores every so often, sometimes within a single Ryzen CCX, sometimes across to the other CCX. I have never experienced a 28-page PDF file taking almost a full hour to convert with this tool.

Image

Is there anything I can do to remedy this? The bottom-left graph that has a usage spike in the middle is me launching Chrome. You can see the jump between cores in the top graphs.

This is my launch argument: "convert -density 300 [filename].pdf -quality 100 [otherfilename].png"
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Multithreading not functioning on AMD Ryzen 7 1700

Post by snibgo »

What version IM? On Windows, I suppose?

What does "convert -version" say? Does Features have OpenMP?

I don't know if Ghostscript uses multithreading.
snibgo's IM pages: im.snibgo.com
CataclysmZA
Posts: 5
Joined: 2017-07-20T06:03:20-07:00
Authentication code: 1151

Re: Multithreading not functioning on AMD Ryzen 7 1700

Post by CataclysmZA »

Windows 10 1703 Creator's Update, specifically version number 15063.483. I've been on that version number for a while, no real updates to speak of.

Imagemagick is version number 7.0.6-1-Q16-x64 dynamic. Ghostscript is also version 9.21, both applications were cleanly uninstalled and updated today.

Convert-version spits out the following:

Code: Select all

Version: ImageMagick 7.0.6-1 Q16 x64 2017-07-15 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2015 ImageMagick Studio LLC
License: http://www.imagemagick.org/script/license.php
Visual C++: 180040629
Features: Cipher DPC Modules OpenMP 
Delegates (built-in): bzlib cairo flif freetype jng jp2 jpeg lcms lqr openexr pangocairo png ps rsvg tiff webp xml zlib
I mean, everything seems to be setup just fine, but it's not actually using more than 2-3 cores constantly. I know the behaviour on Windows 10 has been to shift workloads across cores in the past, but this was fixed by AMD about a month ago with new chipset drivers that altered the power profile.

The first time I ran IM through the workload, it ran out of space because it consumed 30-something gigs of space on C, which was not enough. After freeing up space, the workload ran the second time, but it still wasn't using more than three cores. Unless, somehow, in migrating this OS from my Athlon system, IM still thinks there are only three cores on the system. Perhaps there's a configuration file I need to look at to figure it out.

I could do the conversion again and log all the events, I guess.
Last edited by CataclysmZA on 2017-07-20T12:20:15-07:00, edited 1 time in total.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Multithreading not functioning on AMD Ryzen 7 1700

Post by fmw42 »

I do not see gslib list. That might mean that ImageMagick cannot find Ghostscript. On my Mac when I do

Code: Select all

magick -version
I get

Version: ImageMagick 7.0.6-1 Q16 x86_64 2017-07-16 http://www.imagemagick.org
Copyright: © 1999-2017 ImageMagick Studio LLC
License: http://www.imagemagick.org/script/license.php
Features: Cipher DPC HDRI Modules OpenMP
Delegates (built-in): bzlib cairo fftw fontconfig freetype gslib jbig jng jp2 jpeg lcms lqr ltdl lzma openexr png ps rsvg tiff webp x xml zlib

Also my Ghostscript is at 9.21, so you might want to upgrade that.
CataclysmZA
Posts: 5
Joined: 2017-07-20T06:03:20-07:00
Authentication code: 1151

Re: Multithreading not functioning on AMD Ryzen 7 1700

Post by CataclysmZA »

fmw42 wrote: 2017-07-20T11:56:14-07:00Also my Ghostscript is at 9.21, so you might want to upgrade that.
I mistyped, it's definitely version 9.21 on my system.

Output from magick -version:

Code: Select all

Version: ImageMagick 7.0.6-1 Q16 x64 2017-07-15 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2015 ImageMagick Studio LLC
License: http://www.imagemagick.org/script/license.php
Visual C++: 180040629
Features: Cipher DPC Modules OpenMP 
Delegates (built-in): bzlib cairo flif freetype jng jp2 jpeg lcms lqr openexr pangocairo png ps rsvg tiff webp xml zlib
How do I get gslib to show up in -version? Do I reinstall both, or is there a command I can run to fix that? I know convert is a legacy option I tick during the install phase.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Multithreading not functioning on AMD Ryzen 7 1700

Post by fmw42 »

I believe that not all OS list gslib. So it may be there. Does this work?

Code: Select all

magick -density 300 [filename].pdf -quality 100 [otherfilename].png
or

Code: Select all

magick.exe -density 300 [filename].pdf -quality 100 [otherfilename].png
CataclysmZA
Posts: 5
Joined: 2017-07-20T06:03:20-07:00
Authentication code: 1151

Re: Multithreading not functioning on AMD Ryzen 7 1700

Post by CataclysmZA »

Both arguments work, but using magick instead of convert now pegs it to a single core continuously.

I'm going to try figure out the log and debug options out quickly.
CataclysmZA
Posts: 5
Joined: 2017-07-20T06:03:20-07:00
Authentication code: 1151

Re: Multithreading not functioning on AMD Ryzen 7 1700

Post by CataclysmZA »

Well, the log and debug options are mad and don't pipe to a text file.

But I did discover that I could just use "convert [file] -density 300 -quality 100 [file] and it seems to work just fine, in fact it cuts down on the export time massively. Output doesn't seem to be dramatically different.

Still a single core process though. I'm not sure how I feel about that. Every other core just sits there doing nothing.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Multithreading not functioning on AMD Ryzen 7 1700

Post by snibgo »

CataclysmZA wrote:Well, the log and debug options are mad and don't pipe to a text file.
You are piping stderr, are you?

Omitting "-density 300" before the input will rasterize at (probably) 72 dpi, so approx 16 times faster.

The charts in the OP show memory and disk heavily used. Would more cores actually improve performance?
snibgo's IM pages: im.snibgo.com
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Multithreading not functioning on AMD Ryzen 7 1700

Post by fmw42 »

I do not think Ghostscript is multi-threaded
Post Reply