我正在运行具有8个核心的Ubuntu服务器。但是imagemagick始终仅使用1个单核。
运行identify -version
返回:
Version: ImageMagick 6.6.9-7 2012-08-17 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2011 ImageMagick Studio LLC
Features: OpenMP
因此启用了多线程显然需要的
OpenMP
。按照here所述,使用
-bench
选项(例如convert logo: -resize 500% -bench 10 logo.png
)运行基准测试Performance: 10i 1.17647ips 14.390u 0.14166666666833332977:08.500
它没有通过in the manual所描述的
Performance[1]
返回Performance[8]
,这使我感到奇怪。有什么想法可以使imagemagick使用所有8个核心吗?
更新:这是imagemagick调用的strace输出:http://pastebin.com/Q0gC3k09
最佳答案
我能够在Ubuntu 10.04上重现此行为。 apt-get中的ImageMagick似乎具有OpenMP功能,并使用-fopenmp
标志进行配置,但似乎未启用该功能。可以通过运行以下行并将“ FEATURES ”列表(如果有)与各种配置标志进行比较来验证这一点。
identify -list Configure | less
我可以通过遵循文章“Installing ImageMagick from Source on Ubuntu 8.04”来解决此问题,该文章详细介绍了以下过程。
wget http://www.imagemagick.org/download/ImageMagick-6.8.6-6.tar.gz
./configure
,make
和sudo make install
步骤/usr/local/lib
当OpenMP现在出现在“ FEATURES ”列表下时,以及当我执行
convert logo: -resize 500% -bench 10 logo.png
时,这似乎起作用。我看到以下Performance[1]: 10i 0.750ips 1.000e 18.750u 0:13.330
Performance[2]: 10i 0.751ips 0.500e 18.660u 0:13.320
Performance[3]: 10i 0.738ips 0.496e 18.840u 0:13.550
Performance[4]: 10i 0.469ips 0.385e 19.560u 0:21.320
这些结果符合我的期望。
关于Imagemagick仅使用一个核心,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17659916/